Skip to content

Commit

Permalink
Testing deleted extra keys
Browse files Browse the repository at this point in the history
  • Loading branch information
EmanElsaban committed May 16, 2024
1 parent b3fae57 commit ac6183c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tests/config/config_parse_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,9 +873,11 @@ def test_config_cleanup_requires(self, capfd):
)

expected_msg = "Unknown keys in CleanupAction : requires: removing them.\n"
valid_config(test_config)
output_config = valid_config(test_config)
exception, err = capfd.readouterr()
assert_equal(expected_msg, str(exception))
# assert that "requires" key doesn't exist in the dictionary
assert "requires" not in output_config.jobs.get("MASTER.test_job0").cleanup_action

def test_validate_job_no_actions(self):
job_config = dict(
Expand Down Expand Up @@ -915,10 +917,11 @@ def test_validate_job_extra_secret_env(self, capfd):
key="no_secret_name",
extra_key="unknown",
)
config_parse.valid_secret_source(secret_env, NullConfigContext)
output_config = config_parse.valid_secret_source(secret_env, NullConfigContext)
expected_msg = "Unknown keys in SecretSource : extra_key: removing them.\n"
exception, err = capfd.readouterr()
assert_equal(expected_msg, str(exception))
assert not hasattr(output_config, "extra_key")

def test_valid_job_secret_env_success(self):
secret_env = dict(
Expand Down Expand Up @@ -1032,10 +1035,11 @@ def test_invalid_node_pool_config(self):

def test_invalid_named_update(self, capfd):
test_config = dict(bozray=None)
validate_fragment("foo", test_config)
output_config = validate_fragment("foo", test_config)
expected_msg = "Unknown keys in NamedConfigFragment : bozray: removing them.\n"
exception, err = capfd.readouterr()
assert_equal(expected_msg, str(exception))
assert not hasattr(output_config, "bozray")


class TestValidateJobs(TestCase):
Expand Down Expand Up @@ -1566,10 +1570,11 @@ class TestValidSecretVolumeItem:
],
)
def test_extra_keys(self, config, capfd):
config_parse.valid_secret_volume_item(config, NullConfigContext)
output_config = config_parse.valid_secret_volume_item(config, NullConfigContext)
expected_msg = "Unknown keys in SecretVolumeItem : extra_key: removing them.\n"
exception, err = capfd.readouterr()
assert_equal(expected_msg, str(exception))
assert not hasattr(output_config, "extra_key")

@pytest.mark.parametrize(
"config",
Expand Down

0 comments on commit ac6183c

Please sign in to comment.