Skip to content

Commit

Permalink
eksconfig: do not run conformance with mng
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <[email protected]>
  • Loading branch information
gyuho committed May 24, 2020
1 parent 240764a commit 3f23edb
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 42 deletions.
34 changes: 34 additions & 0 deletions eksconfig/add-on-conformance.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,35 @@ func getDefaultAddOnConformance() *AddOnConformance {
return addOn
}

/*
TODO: fix this... conformance with managed node group does not work
Plugin: e2e
Status: failed
Total: 4897
Passed: 267
Failed: 9
Skipped: 4621
Failed tests:
[sig-network] Services should be able to change the type from ClusterIP to ExternalName [Conformance]
[sig-network] Services should be able to create a functioning NodePort service [Conformance]
[sig-api-machinery] Aggregator Should be able to support the 1.10 Sample API Server using the current Aggregator [Conformance]
[sig-network] Networking Granular Checks: Pods should function for intra-pod communication: udp [LinuxOnly] [NodeConformance] [Conformance]
[sig-cli] Kubectl client Kubectl run --rm job should create a job from an image, then delete the job [Conformance]
[sig-network] Services should be able to change the type from ExternalName to NodePort [Conformance]
[sig-network] DNS should provide DNS for ExternalName services [Conformance]
[sig-network] Networking Granular Checks: Pods should function for node-pod communication: udp [LinuxOnly] [NodeConformance] [Conformance]
[sig-network] DNS should provide DNS for pods for Hostname [LinuxOnly] [Conformance]
Plugin: systemd-logs
Status: passed
Total: 14
Passed: 14
Failed: 0
Skipped: 0
*/

func (cfg *Config) validateAddOnConformance() error {
if !cfg.IsEnabledAddOnConformance() {
return nil
Expand All @@ -92,6 +121,11 @@ func (cfg *Config) validateAddOnConformance() error {
return errors.New("AddOnConformance.Enable true but no node group is enabled")
}

// TODO: fix this...
if cfg.IsEnabledAddOnManagedNodeGroups() {
return errors.New("AddOnConformance.Enable true with AddOnManagedNodeGroups.Enable true")
}

if cfg.AddOnConformance.Namespace == "" {
cfg.AddOnConformance.Namespace = cfg.Name + "-conformance"
}
Expand Down
105 changes: 63 additions & 42 deletions eksconfig/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,23 +406,6 @@ func TestEnv(t *testing.T) {
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_STRESSER_REMOTE_REQUESTS_SUMMARY_READS_OUTPUT_NAME_PREFIX", "stresser-out-pfx")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_STRESSER_REMOTE_REQUESTS_SUMMARY_READS_OUTPUT_NAME_PREFIX")

os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_ENABLE", "true")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_ENABLE")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_NAMESPACE", "conformance-test")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_NAMESPACE")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_PATH", "aaaaa")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_PATH")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_DOWNLOAD_URL", "sonobuoy-download-here")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_DOWNLOAD_URL")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_DELETE_TIMEOUT", "10s")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_DELETE_TIMEOUT")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_RUN_TIMEOUT", "10h")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_RUN_TIMEOUT")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_RUN_MODE", "non-disruptive-conformance")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_RUN_MODE")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_RUN_KUBE_CONFORMANCE_IMAGE", "hello.com/v1")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_RUN_KUBE_CONFORMANCE_IMAGE")

if err := cfg.UpdateFromEnvs(); err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -1080,31 +1063,6 @@ func TestEnv(t *testing.T) {
t.Fatalf("unexpected cfg.AddOnStresserRemote.RequestsSummaryReadsOutputNamePrefix %v", cfg.AddOnStresserRemote.RequestsSummaryReadsOutputNamePrefix)
}

if !cfg.AddOnConformance.Enable {
t.Fatalf("unexpected cfg.AddOnConformance.Enable %v", cfg.AddOnConformance.Enable)
}
if cfg.AddOnConformance.Namespace != "conformance-test" {
t.Fatalf("unexpected cfg.AddOnConformance.Namespace %q", cfg.AddOnConformance.Namespace)
}
if cfg.AddOnConformance.SonobuoyPath != "aaaaa" {
t.Fatalf("unexpected cfg.AddOnConformance.SonobuoyPath %q", cfg.AddOnConformance.SonobuoyPath)
}
if cfg.AddOnConformance.SonobuoyDownloadURL != "sonobuoy-download-here" {
t.Fatalf("unexpected cfg.AddOnConformance.SonobuoyDownloadURL %q", cfg.AddOnConformance.SonobuoyDownloadURL)
}
if cfg.AddOnConformance.SonobuoyDeleteTimeout != 10*time.Second {
t.Fatalf("unexpected cfg.AddOnConformance.SonobuoyDeleteTimeout %v", cfg.AddOnConformance.SonobuoyDeleteTimeout)
}
if cfg.AddOnConformance.SonobuoyRunTimeout != 10*time.Hour {
t.Fatalf("unexpected cfg.AddOnConformance.SonobuoyRunTimeout %v", cfg.AddOnConformance.SonobuoyRunTimeout)
}
if cfg.AddOnConformance.SonobuoyRunMode != "non-disruptive-conformance" {
t.Fatalf("unexpected cfg.AddOnConformance.SonobuoyRunMode %q", cfg.AddOnConformance.SonobuoyRunMode)
}
if cfg.AddOnConformance.SonobuoyRunKubeConformanceImage != "hello.com/v1" {
t.Fatalf("unexpected cfg.AddOnConformance.SonobuoyRunKubeConformanceImage %q", cfg.AddOnConformance.SonobuoyRunKubeConformanceImage)
}

cfg.Parameters.RoleManagedPolicyARNs = nil
cfg.Parameters.RoleServicePrincipals = nil
cfg.AddOnManagedNodeGroups.RoleName = ""
Expand Down Expand Up @@ -1231,6 +1189,69 @@ func TestEnvAddOnNodeGroupsGetRef(t *testing.T) {
}
}

func TestEnvAddOnConformance(t *testing.T) {
cfg := NewDefault()
defer func() {
os.RemoveAll(cfg.ConfigPath)
os.RemoveAll(cfg.KubectlCommandsOutputPath)
os.RemoveAll(cfg.RemoteAccessCommandsOutputPath)
}()

os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_NODE_GROUPS_ENABLE", `true`)
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_NODE_GROUPS_ENABLE")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_NODE_GROUPS_ASGS", `{"GetRef.Name-ng-for-cni":{"name":"GetRef.Name-ng-for-cni","remote-access-user-name":"ec2-user","ami-type":"AL2_x86_64","asg-min-size":30,"asg-max-size":35,"asg-desired-capacity":34,"image-id":"my-ami", "ssm-document-create":true, "instance-types":["type-2"], "ssm-document-cfn-stack-name":"GetRef.Name-ssm", "ssm-document-name":"GetRef.Name-document", "kubelet-extra-args":"aaa aa", "volume-size":500}}`)
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_NODE_GROUPS_ASGS")

os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_ENABLE", "true")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_ENABLE")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_NAMESPACE", "conformance-test")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_NAMESPACE")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_PATH", "aaaaa")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_PATH")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_DOWNLOAD_URL", "sonobuoy-download-here")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_DOWNLOAD_URL")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_DELETE_TIMEOUT", "10s")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_DELETE_TIMEOUT")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_RUN_TIMEOUT", "10h")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_RUN_TIMEOUT")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_RUN_MODE", "non-disruptive-conformance")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_RUN_MODE")
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_RUN_KUBE_CONFORMANCE_IMAGE", "hello.com/v1")
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_SONOBUOY_RUN_KUBE_CONFORMANCE_IMAGE")

if err := cfg.UpdateFromEnvs(); err != nil {
t.Fatal(err)
}
if err := cfg.ValidateAndSetDefaults(); err != nil {
t.Fatal(err)
}

if !cfg.AddOnConformance.Enable {
t.Fatalf("unexpected cfg.AddOnConformance.Enable %v", cfg.AddOnConformance.Enable)
}
if cfg.AddOnConformance.Namespace != "conformance-test" {
t.Fatalf("unexpected cfg.AddOnConformance.Namespace %q", cfg.AddOnConformance.Namespace)
}
if cfg.AddOnConformance.SonobuoyPath != "aaaaa" {
t.Fatalf("unexpected cfg.AddOnConformance.SonobuoyPath %q", cfg.AddOnConformance.SonobuoyPath)
}
if cfg.AddOnConformance.SonobuoyDownloadURL != "sonobuoy-download-here" {
t.Fatalf("unexpected cfg.AddOnConformance.SonobuoyDownloadURL %q", cfg.AddOnConformance.SonobuoyDownloadURL)
}
if cfg.AddOnConformance.SonobuoyDeleteTimeout != 10*time.Second {
t.Fatalf("unexpected cfg.AddOnConformance.SonobuoyDeleteTimeout %v", cfg.AddOnConformance.SonobuoyDeleteTimeout)
}
if cfg.AddOnConformance.SonobuoyRunTimeout != 10*time.Hour {
t.Fatalf("unexpected cfg.AddOnConformance.SonobuoyRunTimeout %v", cfg.AddOnConformance.SonobuoyRunTimeout)
}
if cfg.AddOnConformance.SonobuoyRunMode != "non-disruptive-conformance" {
t.Fatalf("unexpected cfg.AddOnConformance.SonobuoyRunMode %q", cfg.AddOnConformance.SonobuoyRunMode)
}
if cfg.AddOnConformance.SonobuoyRunKubeConformanceImage != "hello.com/v1" {
t.Fatalf("unexpected cfg.AddOnConformance.SonobuoyRunKubeConformanceImage %q", cfg.AddOnConformance.SonobuoyRunKubeConformanceImage)
}
}

// TestEnvAddOnManagedNodeGroupsCNI tests CNI integration test MNG settings.
// https://github.com/aws/amazon-vpc-cni-k8s/blob/master/scripts/lib/cluster.sh
func TestEnvAddOnManagedNodeGroupsCNI(t *testing.T) {
Expand Down

0 comments on commit 3f23edb

Please sign in to comment.