From d6ecba7f79caa58045d257fd46799d7ef723aeae Mon Sep 17 00:00:00 2001 From: Samuel Allan Date: Tue, 5 Mar 2024 11:03:08 +1030 Subject: [PATCH] Add func tests for validate action (tempest-k8s) Change-Id: I0abb08f9ca54e42d48f43cd606ff550f3cc7ce7f --- .../sunbeam/charm_tests/tempest_k8s/tests.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/local/zaza/sunbeam/charm_tests/tempest_k8s/tests.py b/tests/local/zaza/sunbeam/charm_tests/tempest_k8s/tests.py index 53182c1d..71974d10 100644 --- a/tests/local/zaza/sunbeam/charm_tests/tempest_k8s/tests.py +++ b/tests/local/zaza/sunbeam/charm_tests/tempest_k8s/tests.py @@ -223,3 +223,23 @@ class TempestK8sTest(test_utils.BaseCharmTest): self.check_charm_created_resources(domain_id) after_test_accounts_resources = self.get_tempest_init_resources(domain_id) self.assertEqual(after_test_accounts_resources, before_test_accounts_resources) + + def test_validate_with_readonly_quick_tests(self): + """Verify that the validate action runs tests as expected.""" + action = model.run_action_on_leader( + self.application_name, "validate", + action_params={ + "test-list": "readonly-quick", + } + ) + # log the data so we can debug failures + logger.info("action.data = %s", action.data) + summary = action.data["results"]["summary"] + + # No tests should fail, and all the summary items should be present and populated + self.assertRegex(summary, "Ran: [1-9]\d* test") # at least one test should run + self.assertRegex(summary, "Passed: \d+") + self.assertRegex(summary, "Skipped: \d+") + self.assertIn("Expected Fail: 0", summary) + self.assertIn("Unexpected Success: 0", summary) + self.assertIn("Failed: 0", summary)