Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
e2e test util: Add func to verify supported platform
Browse files Browse the repository at this point in the history
This commit adds a function which verifies if the platform on which this
test is running is supported to run test.

Signed-off-by: Suraj Deshmukh <suraj@kinvolk.io>
  • Loading branch information
surajssd committed Mar 23, 2020
1 parent c6c93e8 commit f3cbc83
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/components/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,23 @@ func (p *PortForwardInfo) WaitUntilForwardingAvailable(t *testing.T) {
}
p.findLocalPort(t)
}

// IsPlatformSupported takes in the test object and the map of supported platform. The function
// detects the supported platform from environment variable. And if the platform is available in the
// supported platforms provided then this returns true otherwise false.
func IsPlatformSupported(t *testing.T, platforms map[string]interface{}) bool {
if _, ok := platforms["*"]; ok {
return true
}

platform := os.Getenv("PLATFORM")
if platform == "" {
t.Fatalf("env var PLATFORM was not set")
}

if _, ok := platforms[platform]; !ok {
return false
}

return true
}

0 comments on commit f3cbc83

Please sign in to comment.