From a35f1d04fe86ed06f315ec6a00ca87ba49efc992 Mon Sep 17 00:00:00 2001 From: Brian Bland Date: Wed, 21 Jan 2015 12:02:51 -0800 Subject: [PATCH] Adds test for extraneous configuration environment variables Signed-off-by: Brian Bland --- configuration/configuration_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/configuration/configuration_test.go b/configuration/configuration_test.go index 91169e03..ad845a41 100644 --- a/configuration/configuration_test.go +++ b/configuration/configuration_test.go @@ -183,6 +183,17 @@ func (suite *ConfigSuite) TestParseWithDifferentEnvStorageType(c *C) { c.Assert(config, DeepEquals, suite.expectedConfig) } +// TestParseWithExtraneousEnvStorageParams validates that environment variables +// that change parameters out of the scope of the specified storage type are +// ignored. +func (suite *ConfigSuite) TestParseWithExtraneousEnvStorageParams(c *C) { + os.Setenv("REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY", "/tmp/testroot") + + config, err := Parse(bytes.NewReader([]byte(configYamlV0_1))) + c.Assert(err, IsNil) + c.Assert(config, DeepEquals, suite.expectedConfig) +} + // TestParseWithDifferentEnvStorageTypeAndParams validates that providing an environment variable // that changes the storage type will be reflected in the parsed Configuration struct and that // environment storage parameters will also be included