Skip to content

Commit

Permalink
remove tests which are not relevant anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
ademariag committed Dec 8, 2022
1 parent ef20bbb commit b9fb3aa
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions tests/test_kubernetes_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ def test_validate(self):
manifest_path = os.path.join(self.cache_dir, "service_manifest.yaml")
with open(manifest_path, "w") as fp:
fp.write(service_manifest_string)
self.validator.validate([manifest_path], kind="service", version="1.14.0")

with self.assertRaises(KubernetesManifestValidationError):
self.validator.validate([manifest_path], kind="deployment", version="1.14.0")
self.validator.validate([manifest_path], version="1.14.0")

def test_validate_command_pass(self):
sys.argv = ["kapitan", "validate", "--schemas-path", self.cache_dir]
Expand All @@ -70,29 +67,6 @@ def test_validate_command_pass(self):
except SystemExit:
self.fail("Kubernetes manifest validation error raised unexpectedly")

def test_validate_command_fail(self):
file_name_format = "inventory/classes/component/mysql{}.yml"
original_file = file_name_format.format("")
copied_file = file_name_format.format("_copy")
copyfile(original_file, copied_file)
wrong_manifest_kind = "deployment"
with open(original_file, "r") as fp:
d = yaml.safe_load(fp)
# change kind from service to deployment
d["parameters"]["kapitan"]["validate"][0]["kind"] = wrong_manifest_kind
with open(original_file, "w") as fp:
yaml.dump(d, fp, default_flow_style=False)

sys.argv = ["kapitan", "validate", "--schemas-path", self.cache_dir]
with self.assertRaises(SystemExit), self.assertLogs(logger="kapitan.targets", level="ERROR") as log:
try:
main()
finally:
# copy back the original file
copyfile(copied_file, original_file)
os.remove(copied_file)
self.assertTrue(" ".join(log.output).find("invalid '{}' manifest".format(wrong_manifest_kind)) != -1)

def test_validate_after_compile(self):
sys.argv = [
"kapitan",
Expand Down

0 comments on commit b9fb3aa

Please sign in to comment.