diff --git a/src/modules/docker_context.rs b/src/modules/docker_context.rs index bc18d834..1237565f 100644 --- a/src/modules/docker_context.rs +++ b/src/modules/docker_context.rs @@ -57,6 +57,10 @@ pub fn module<'a>(context: &'a Context) -> Option> { } }; + if ctx == "default" { + return None; + } + let parsed = StringFormatter::new(config.format).and_then(|formatter| { formatter .map_meta(|variable, _| match variable { @@ -307,6 +311,24 @@ mod tests { cfg_dir.close() } + #[test] + fn test_docker_context_default() -> io::Result<()> { + let cfg_dir = tempfile::tempdir()?; + + let actual = ModuleRenderer::new("docker_context") + .env("DOCKER_CONTEXT", "default") + .config(toml::toml! { + [docker_context] + only_with_files = false + }) + .collect(); + let expected = None; + + assert_eq!(expected, actual); + + cfg_dir.close() + } + #[test] fn test_docker_context_overrides_config() -> io::Result<()> { let cfg_dir = tempfile::tempdir()?;