2019-06-17 18:11:22 -07:00
|
|
|
package testrunner
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
2019-08-29 18:48:58 -07:00
|
|
|
func Test_Mutate_EndPoint(t *testing.T) {
|
|
|
|
testScenario(t, "/test/scenarios/test/scenario_mutate_endPpoint.yaml")
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_Mutate_imagePullPolicy(t *testing.T) {
|
|
|
|
testScenario(t, "/test/scenarios/test/scenario_mutate_imagePullPolicy.yaml")
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_Mutate_Validate_qos(t *testing.T) {
|
|
|
|
testScenario(t, "/test/scenarios/test/scenario_mutate_validate_qos.yaml")
|
|
|
|
}
|
2019-08-29 11:44:50 -07:00
|
|
|
|
2019-08-29 18:48:58 -07:00
|
|
|
func Test_validate_containerSecurityContext(t *testing.T) {
|
|
|
|
testScenario(t, "/test/scenarios/test/scenario_validate_containerSecurityContext.yaml")
|
2019-07-01 12:16:12 -07:00
|
|
|
}
|
2019-08-29 18:48:58 -07:00
|
|
|
|
2019-09-09 10:36:56 -07:00
|
|
|
func Test_validate_deny_runasrootuser(t *testing.T) {
|
2019-09-09 10:56:19 -07:00
|
|
|
testScenario(t, "test/scenarios/test/scenario_validate_deny_runasrootuser.yaml")
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_validate_disallow_priviledgedprivelegesecalation(t *testing.T) {
|
|
|
|
testScenario(t, "test/scenarios/test/scenario_validate_container_disallow_priviledgedprivelegesecalation.yaml")
|
2019-09-06 18:54:19 -07:00
|
|
|
}
|
|
|
|
|
2019-08-29 18:48:58 -07:00
|
|
|
func Test_validate_healthChecks(t *testing.T) {
|
|
|
|
testScenario(t, "/test/scenarios/test/scenario_validate_healthChecks.yaml")
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_validate_imageRegistries(t *testing.T) {
|
|
|
|
testScenario(t, "/test/scenarios/test/scenario_validate_imageRegistries.yaml")
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_validate_nonRootUsers(t *testing.T) {
|
|
|
|
testScenario(t, "/test/scenarios/test/scenario_validate_nonRootUser.yaml")
|
|
|
|
}
|
|
|
|
|
2019-08-30 14:06:47 -07:00
|
|
|
func Test_generate_networkPolicy(t *testing.T) {
|
|
|
|
testScenario(t, "/test/scenarios/test/scenario_generate_networkPolicy.yaml")
|
|
|
|
}
|
2019-09-06 10:03:24 -07:00
|
|
|
|
|
|
|
// namespace is blank, not "default" as testrunner evaulates the policyengine, but the "default" is added by kubeapiserver
|
|
|
|
func Test_validate_image_latest_ifnotpresent_deny(t *testing.T) {
|
|
|
|
testScenario(t, "/test/scenarios/test/scenario_validate_image_latest_ifnotpresent_deny.yaml")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_validate_image_latest_ifnotpresent_pass(t *testing.T) {
|
|
|
|
testScenario(t, "test/scenarios/test/scenario_validate_image_latest_ifnotpresent_pass.yaml")
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_validate_image_tag_notspecified_deny(t *testing.T) {
|
|
|
|
testScenario(t, "test/scenarios/test/scenario_validate_image_tag_notspecified_deny.yaml")
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_validate_image_tag_notspecified_pass(t *testing.T) {
|
|
|
|
testScenario(t, "test/scenarios/test/scenario_validate_image_tag_notspecified_pass.yaml")
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_validate_image_pullpolicy_notalways_deny(t *testing.T) {
|
|
|
|
testScenario(t, "test/scenarios/test/scenario_validate_image_pullpolicy_notalways_deny.yaml")
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_validate_image_pullpolicy_notalways_pass(t *testing.T) {
|
|
|
|
testScenario(t, "test/scenarios/test/scenario_validate_image_pullpolicy_notalways_pass.yaml")
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_validate_image_tag_latest_deny(t *testing.T) {
|
|
|
|
testScenario(t, "test/scenarios/test/scenario_validate_image_tag_latest_deny.yaml")
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_validate_image_tag_latest_pass(t *testing.T) {
|
|
|
|
testScenario(t, "test/scenarios/test/scenario_validate_image_tag_latest_pass.yaml")
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_mutate_pod_disable_automoutingapicred_pass(t *testing.T) {
|
|
|
|
testScenario(t, "test/scenarios/test/scenario_mutate_pod_disable_automountingapicred.yaml")
|
|
|
|
}
|
2019-09-09 14:33:55 -07:00
|
|
|
|
|
|
|
func Test_validate_default_namespace(t *testing.T) {
|
|
|
|
testScenario(t, "test/scenarios/test/scenario_validate_default_namespace.yaml")
|
|
|
|
}
|