Skip to content

Commit

Permalink
Create separate aws and azure e2e scenario sets
Browse files Browse the repository at this point in the history
  • Loading branch information
whatnick committed Sep 14, 2024
1 parent b26fa30 commit adb5bf1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
16 changes: 11 additions & 5 deletions test/e2e/jobs/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@ func DeleteTestInfraAWS(accID, clusterName, region string) *types.Job {
return job
}

func InstallAndTestRetinaBasicMetrics(kubeConfigFilePath, chartPath string) *types.Job {
func InstallAndTestRetinaBasicMetrics(kubeConfigFilePath, chartPath, cloudProvider string) *types.Job {
job := types.NewJob("Install and test Retina with basic metrics")

apiEndpoint := getCloudApiIP(cloudProvider)

job.AddStep(&kubernetes.InstallHelmChart{
Namespace: "kube-system",
ReleaseName: "retina",
Expand All @@ -99,7 +101,9 @@ func InstallAndTestRetinaBasicMetrics(kubeConfigFilePath, chartPath string) *typ
TagEnv: generic.DefaultTagEnv,
}, nil)

job.AddScenario(drop.ValidateDropMetric())
if cloudProvider == "azure" {
job.AddScenario(drop.ValidateDropMetric())
}

job.AddScenario(tcp.ValidateTCPMetrics())

Expand All @@ -122,7 +126,7 @@ func InstallAndTestRetinaBasicMetrics(kubeConfigFilePath, chartPath string) *typ
Query: "kubernetes.default.svc.cluster.local.",
QueryType: "A",
ReturnCode: "No Error",
Response: "10.0.0.1",
Response: apiEndpoint,
},
},
{
Expand Down Expand Up @@ -151,7 +155,7 @@ func InstallAndTestRetinaBasicMetrics(kubeConfigFilePath, chartPath string) *typ
return job
}

func UpgradeAndTestRetinaAdvancedMetrics(kubeConfigFilePath, chartPath, valuesFilePath string) *types.Job {
func UpgradeAndTestRetinaAdvancedMetrics(kubeConfigFilePath, chartPath, valuesFilePath, cloudProvider string) *types.Job {
job := types.NewJob("Upgrade and test Retina with advanced metrics")
// enable advanced metrics
job.AddStep(&kubernetes.UpgradeRetinaHelmChart{
Expand All @@ -163,6 +167,8 @@ func UpgradeAndTestRetinaAdvancedMetrics(kubeConfigFilePath, chartPath, valuesFi
ValuesFile: valuesFilePath,
}, nil)

apiEndpoint := getCloudApiIP(cloudProvider)

dnsScenarios := []struct {
name string
req *dns.RequestValidationParams
Expand All @@ -182,7 +188,7 @@ func UpgradeAndTestRetinaAdvancedMetrics(kubeConfigFilePath, chartPath, valuesFi
Query: "kubernetes.default.svc.cluster.local.",
QueryType: "A",
ReturnCode: "NOERROR",
Response: "10.0.0.1",
Response: apiEndpoint,
},
},
{
Expand Down
16 changes: 16 additions & 0 deletions test/e2e/jobs/jobs_util.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package retina

func getCloudApiIP(cloudProvider string) string {
apiEndpoint := "0.0.0.0"

switch cloudProvider {
case "aws":
apiEndpoint = "10.100.0.1"
case "azure":
apiEndpoint = "10.0.0.1"
default:
panic("Cloud Provider not supported")
}

return apiEndpoint
}
8 changes: 4 additions & 4 deletions test/e2e/retina_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ func TestE2ERetinaAZ(t *testing.T) {
}()

// Install and test Retina basic metrics
basicMetricsE2E := types.NewRunner(t, jobs.InstallAndTestRetinaBasicMetrics(kubeConfigFilePath, chartPath))
basicMetricsE2E := types.NewRunner(t, jobs.InstallAndTestRetinaBasicMetrics(kubeConfigFilePath, chartPath, "azure"))
basicMetricsE2E.Run()

// Upgrade and test Retina with advanced metrics
advanceMetricsE2E := types.NewRunner(t, jobs.UpgradeAndTestRetinaAdvancedMetrics(kubeConfigFilePath, chartPath, profilePath))
advanceMetricsE2E := types.NewRunner(t, jobs.UpgradeAndTestRetinaAdvancedMetrics(kubeConfigFilePath, chartPath, profilePath, "azure"))
advanceMetricsE2E.Run()
}

Expand Down Expand Up @@ -103,10 +103,10 @@ func TestE2ERetinaAWS(t *testing.T) {
}()

// Install and test Retina basic metrics
basicMetricsE2E := types.NewRunner(t, jobs.InstallAndTestRetinaBasicMetrics(kubeConfigFilePath, chartPath))
basicMetricsE2E := types.NewRunner(t, jobs.InstallAndTestRetinaBasicMetrics(kubeConfigFilePath, chartPath, "aws"))
basicMetricsE2E.Run()

// Upgrade and test Retina with advanced metrics
advanceMetricsE2E := types.NewRunner(t, jobs.UpgradeAndTestRetinaAdvancedMetrics(kubeConfigFilePath, chartPath, profilePath))
advanceMetricsE2E := types.NewRunner(t, jobs.UpgradeAndTestRetinaAdvancedMetrics(kubeConfigFilePath, chartPath, profilePath, "aws"))
advanceMetricsE2E.Run()
}

0 comments on commit adb5bf1

Please sign in to comment.