Add new flags for node arch

This commit is contained in:
Ciprian Hacman 2020-07-12 09:13:39 +03:00
parent 19f0a54d6b
commit 33ac3c36cc
4 changed files with 20 additions and 0 deletions

View File

@ -213,6 +213,13 @@ func SkipUnlessNodeOSDistroIs(supportedNodeOsDistros ...string) {
}
}
// SkipUnlessNodeOSArchIs skips if the node OS distro is not included in the supportedNodeOsArchs.
func SkipUnlessNodeOSArchIs(supportedNodeOsArchs ...string) {
if !framework.NodeOSArchIs(supportedNodeOsArchs...) {
skipInternalf(1, "Only supported for node OS arch %v (not %s)", supportedNodeOsArchs, framework.TestContext.NodeOSArch)
}
}
// SkipIfNodeOSDistroIs skips if the node OS distro is included in the unsupportedNodeOsDistros.
func SkipIfNodeOSDistroIs(unsupportedNodeOsDistros ...string) {
if framework.NodeOSDistroIs(unsupportedNodeOsDistros...) {

View File

@ -116,6 +116,7 @@ type TestContextType struct {
ImageServiceEndpoint string
MasterOSDistro string
NodeOSDistro string
NodeOSArch string
VerifyServiceAccount bool
DeleteNamespace bool
DeleteNamespaceOnFailure bool
@ -324,6 +325,7 @@ func RegisterClusterFlags(flags *flag.FlagSet) {
flags.StringVar(&TestContext.Prefix, "prefix", "e2e", "A prefix to be added to cloud resources created during testing.")
flags.StringVar(&TestContext.MasterOSDistro, "master-os-distro", "debian", "The OS distribution of cluster master (debian, ubuntu, gci, coreos, or custom).")
flags.StringVar(&TestContext.NodeOSDistro, "node-os-distro", "debian", "The OS distribution of cluster VM instances (debian, ubuntu, gci, coreos, or custom).")
flags.StringVar(&TestContext.NodeOSArch, "node-os-arch", "amd64", "The OS architecture of cluster VM instances (amd64, arm64, or custom).")
flags.StringVar(&TestContext.ClusterDNSDomain, "dns-domain", "cluster.local", "The DNS Domain of the cluster.")
// TODO: Flags per provider? Rename gce-project/gce-zone?

View File

@ -203,6 +203,16 @@ func NodeOSDistroIs(supportedNodeOsDistros ...string) bool {
return false
}
// NodeOSArchIs returns true if the node OS arch is included in the supportedNodeOsArchs. Otherwise false.
func NodeOSArchIs(supportedNodeOsArchs ...string) bool {
for _, arch := range supportedNodeOsArchs {
if strings.EqualFold(arch, TestContext.NodeOSArch) {
return true
}
}
return false
}
// DeleteNamespaces deletes all namespaces that match the given delete and skip filters.
// Filter is by simple strings.Contains; first skip filter, then delete filter.
// Returns the list of deleted namespaces or an error.

View File

@ -39,6 +39,7 @@ go_library(
"//test/e2e/framework/node:go_default_library",
"//test/e2e/framework/pod:go_default_library",
"//test/e2e/framework/service:go_default_library",
"//test/e2e/framework/skipper:go_default_library",
"//test/e2e/framework/testfiles:go_default_library",
"//test/e2e/framework/websocket:go_default_library",
"//test/e2e/scheduling:go_default_library",