From fb0a7f425c238eeeb6d1bd3ed16254f0884fb8d8 Mon Sep 17 00:00:00 2001 From: James Sturtevant Date: Wed, 23 Feb 2022 11:38:24 -0800 Subject: [PATCH] make compiler happy --- test/e2e/aks.go | 1 + test/e2e/azure_gpu.go | 1 + test/e2e/azure_lb.go | 1 + test/e2e/azure_machinepool_drain.go | 1 + test/e2e/e2e_suite.go | 66 ++++++++++++++++++++++ test/e2e/e2e_suite_test.go | 57 ------------------- test/e2e/helpers.go | 1 + test/e2e/kubernetes/namespace/namespace.go | 1 + test/e2e/kubescape.go | 1 + test/e2e/log.go | 3 + test/e2e/retry.go | 1 + 11 files changed, 77 insertions(+), 57 deletions(-) create mode 100644 test/e2e/e2e_suite.go diff --git a/test/e2e/aks.go b/test/e2e/aks.go index 54f72e269bea..9611b13356b6 100644 --- a/test/e2e/aks.go +++ b/test/e2e/aks.go @@ -1,3 +1,4 @@ +//go:build e2e // +build e2e /* diff --git a/test/e2e/azure_gpu.go b/test/e2e/azure_gpu.go index 28daa2e60e2d..6ff5de60a2a7 100644 --- a/test/e2e/azure_gpu.go +++ b/test/e2e/azure_gpu.go @@ -1,3 +1,4 @@ +//go:build e2e // +build e2e /* diff --git a/test/e2e/azure_lb.go b/test/e2e/azure_lb.go index 79e5953a4ae7..a8e561eecf89 100644 --- a/test/e2e/azure_lb.go +++ b/test/e2e/azure_lb.go @@ -1,3 +1,4 @@ +//go:build e2e // +build e2e /* diff --git a/test/e2e/azure_machinepool_drain.go b/test/e2e/azure_machinepool_drain.go index 6ae78e1ddb16..e2849c8086e5 100644 --- a/test/e2e/azure_machinepool_drain.go +++ b/test/e2e/azure_machinepool_drain.go @@ -1,3 +1,4 @@ +//go:build e2e // +build e2e /* diff --git a/test/e2e/e2e_suite.go b/test/e2e/e2e_suite.go new file mode 100644 index 000000000000..f5ec8be60c3c --- /dev/null +++ b/test/e2e/e2e_suite.go @@ -0,0 +1,66 @@ +package e2e + +import ( + "regexp" + + "sigs.k8s.io/cluster-api/test/framework" + "sigs.k8s.io/cluster-api/test/framework/bootstrap" + "sigs.k8s.io/cluster-api/test/framework/clusterctl" +) + +const ( + kubesystem = "kube-system" + activitylog = "azure-activity-logs" +) + +// Test suite flags +var ( + // configPath is the path to the e2e config file. + configPath string + + // useExistingCluster instructs the test to use the current cluster instead of creating a new one (default discovery rules apply). + useExistingCluster bool + + // artifactFolder is the folder to store e2e test artifacts. + artifactFolder string + + // skipCleanup prevents cleanup of test resources e.g. for debug purposes. + skipCleanup bool +) + +// Test suite global vars +var ( + // e2eConfig to be used for this test, read from configPath. + e2eConfig *clusterctl.E2EConfig + + // clusterctlConfigPath to be used for this test, created by generating a clusterctl local repository + // with the providers specified in the configPath. + clusterctlConfigPath string + + // bootstrapClusterProvider manages provisioning of the the bootstrap cluster to be used for the e2e tests. + // Please note that provisioning will be skipped if e2e.use-existing-cluster is provided. + bootstrapClusterProvider bootstrap.ClusterProvider + + // bootstrapClusterProxy allows to interact with the bootstrap cluster to be used for the e2e tests. + bootstrapClusterProxy framework.ClusterProxy + + // kubetestConfigFilePath is the path to the kubetest configuration file + kubetestConfigFilePath string + + // kubetestRepoListPath + kubetestRepoListPath string + + // useCIArtifacts specifies whether or not to use the latest build from the main branch of the Kubernetes repository + useCIArtifacts bool + + // usePRArtifacts specifies whether or not to use the build from a PR of the Kubernetes repository + usePRArtifacts bool +) + +// validateStableReleaseString validates the string format that declares "get be the latest stable release for this ." +// it should be called wherever we process a stable version string expression like "stable-1.22" +func validateStableReleaseString(stableVersion string) (bool, []string) { + stableReleaseFormat := regexp.MustCompile(`^stable-(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$`) + matches := stableReleaseFormat.FindStringSubmatch(stableVersion) + return len(matches) > 0, matches +} diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index fea545714df7..ec1f17dfdc18 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -59,55 +59,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" ) -const ( - kubesystem = "kube-system" - activitylog = "azure-activity-logs" -) - -// Test suite flags -var ( - // configPath is the path to the e2e config file. - configPath string - - // useExistingCluster instructs the test to use the current cluster instead of creating a new one (default discovery rules apply). - useExistingCluster bool - - // artifactFolder is the folder to store e2e test artifacts. - artifactFolder string - - // skipCleanup prevents cleanup of test resources e.g. for debug purposes. - skipCleanup bool -) - -// Test suite global vars -var ( - // e2eConfig to be used for this test, read from configPath. - e2eConfig *clusterctl.E2EConfig - - // clusterctlConfigPath to be used for this test, created by generating a clusterctl local repository - // with the providers specified in the configPath. - clusterctlConfigPath string - - // bootstrapClusterProvider manages provisioning of the the bootstrap cluster to be used for the e2e tests. - // Please note that provisioning will be skipped if e2e.use-existing-cluster is provided. - bootstrapClusterProvider bootstrap.ClusterProvider - - // bootstrapClusterProxy allows to interact with the bootstrap cluster to be used for the e2e tests. - bootstrapClusterProxy framework.ClusterProxy - - // kubetestConfigFilePath is the path to the kubetest configuration file - kubetestConfigFilePath string - - // kubetestRepoListPath - kubetestRepoListPath string - - // useCIArtifacts specifies whether or not to use the latest build from the main branch of the Kubernetes repository - useCIArtifacts bool - - // usePRArtifacts specifies whether or not to use the build from a PR of the Kubernetes repository - usePRArtifacts bool -) - type ( AzureClusterProxy struct { framework.ClusterProxy @@ -571,11 +522,3 @@ func getLatestSkuForMinor(version string, skus semver.Versions) string { // otherwise, we just return the version as-is. This allows for versions in other formats, such as "latest" or "latest-1.21". return version } - -// validateStableReleaseString validates the string format that declares "get be the latest stable release for this ." -// it should be called wherever we process a stable version string expression like "stable-1.22" -func validateStableReleaseString(stableVersion string) (bool, []string) { - stableReleaseFormat := regexp.MustCompile(`^stable-(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$`) - matches := stableReleaseFormat.FindStringSubmatch(stableVersion) - return len(matches) > 0, matches -} diff --git a/test/e2e/helpers.go b/test/e2e/helpers.go index 3c722e29971a..a5d0ad9a3eb9 100644 --- a/test/e2e/helpers.go +++ b/test/e2e/helpers.go @@ -1,3 +1,4 @@ +//go:build e2e // +build e2e /* diff --git a/test/e2e/kubernetes/namespace/namespace.go b/test/e2e/kubernetes/namespace/namespace.go index ea803e33488b..119a9f1db1e7 100644 --- a/test/e2e/kubernetes/namespace/namespace.go +++ b/test/e2e/kubernetes/namespace/namespace.go @@ -1,3 +1,4 @@ +//go:build e2e // +build e2e /* diff --git a/test/e2e/kubescape.go b/test/e2e/kubescape.go index 915647866e0f..c34f0b668d59 100644 --- a/test/e2e/kubescape.go +++ b/test/e2e/kubescape.go @@ -1,3 +1,4 @@ +//go:build e2e // +build e2e /* diff --git a/test/e2e/log.go b/test/e2e/log.go index 5e37e2fc7160..74e212fa0ba1 100644 --- a/test/e2e/log.go +++ b/test/e2e/log.go @@ -1,3 +1,6 @@ +//go:build e2e +// +build e2e + /* Copyright 2021 The Kubernetes Authors. diff --git a/test/e2e/retry.go b/test/e2e/retry.go index 7760c460121a..9e72eaf49586 100644 --- a/test/e2e/retry.go +++ b/test/e2e/retry.go @@ -1,3 +1,4 @@ +//go:build e2e // +build e2e /*