-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run devfile create Interation test on kubernetes cluster
- Loading branch information
1 parent
77681be
commit 0cc2060
Showing
3 changed files
with
64 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package helper | ||
|
||
import ( | ||
"fmt" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
// CreateRandNamespace create new project with random name in kubernetes cluster (10 letters) | ||
func CreateRandNamespace(context string) string { | ||
projectName := RandString(10) | ||
fmt.Fprintf(GinkgoWriter, "Creating a new project: %s\n", projectName) | ||
CmdShouldPass("kubectl", "create", "namespace", projectName) | ||
CmdShouldPass("kubectl", "config", "set-context", context, "--namespace", projectName) | ||
session := CmdShouldPass("kubectl", "get", "namespaces") | ||
Expect(session).To(ContainSubstring(projectName)) | ||
return projectName | ||
} | ||
|
||
// DeleteNamespace deletes a specified project in kubernetes cluster | ||
func DeleteNamespace(projectName string) { | ||
fmt.Fprintf(GinkgoWriter, "Deleting project: %s\n", projectName) | ||
CmdShouldPass("kubectl", "delete", "namespaces", projectName) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters