From e6a5b1ceb8105421878e1670d8a682b64d697492 Mon Sep 17 00:00:00 2001 From: Shuting Zhao Date: Tue, 10 Sep 2019 12:27:21 -0700 Subject: [PATCH] add namespace_quota testrunner --- pkg/testrunner/testrunner_test.go | 6 ++--- .../scenario_validate_namespace_quota.yaml | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 test/scenarios/test/scenario_validate_namespace_quota.yaml diff --git a/pkg/testrunner/testrunner_test.go b/pkg/testrunner/testrunner_test.go index 9fb2fb3ab9..cbc06f85ad 100644 --- a/pkg/testrunner/testrunner_test.go +++ b/pkg/testrunner/testrunner_test.go @@ -100,9 +100,9 @@ func Test_validate_not_readonly_rootfilesystem(t *testing.T) { testScenario(t, "test/scenarios/test/scenario_validate_not_readonly_rootfilesystem.yaml") } -// func Test_validate_namespace_quota(t *testing.T) { -// testScenario(t, "test/scenarios/test/scenario_validate_namespace_quota.yaml") -// } +func Test_validate_namespace_quota(t *testing.T) { + testScenario(t, "test/scenarios/test/scenario_validate_namespace_quota.yaml") +} func Test_validate_disallow_node_port(t *testing.T) { testScenario(t, "test/scenarios/test/scenario_validate_disallow_node_port.yaml") diff --git a/test/scenarios/test/scenario_validate_namespace_quota.yaml b/test/scenarios/test/scenario_validate_namespace_quota.yaml new file mode 100644 index 0000000000..b3aea93203 --- /dev/null +++ b/test/scenarios/test/scenario_validate_namespace_quota.yaml @@ -0,0 +1,22 @@ +# file path relative to project root +input: + policy: examples/best_practices/policy_validate_namespace_quota.yaml + resource: examples/best_practices/resources/resource_validate_namespace_quota.yaml +expected: + generation: + generatedResources: + - name: defaultresourcequota + kind: ResourceQuota + namespace: test-namespace-quota + policyresponse: + policy: validate-namespace-quota + resource: + kind: Namespace + apiVersion: v1 + namespace: '' + name: test-namespace-quota + rules: + - name: validate-namespace-quota + type: Generation + success: true + message: created resource ResourceQuota/test-namespace-quota/defaultresourcequota