Skip to content

Commit

Permalink
Use CreateOrGetTestNamespace for test namespace creation
Browse files Browse the repository at this point in the history
  • Loading branch information
sutaakar committed Nov 22, 2024
1 parent 3460a94 commit 7c522a5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 25 deletions.
2 changes: 1 addition & 1 deletion tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ toolchain go1.21.5

require (
github.com/onsi/gomega v1.31.1
github.com/project-codeflare/codeflare-common v0.0.0-20241108084652-0d76fd215a22
github.com/project-codeflare/codeflare-common v0.0.0-20241121090634-e99e941c6921
k8s.io/api v0.29.2
k8s.io/apimachinery v0.29.2
)
Expand Down
4 changes: 2 additions & 2 deletions tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/project-codeflare/appwrapper v0.8.0 h1:vWHNtXUtHutN2EzYb6rryLdESnb8iDXsCokXOuNYXvg=
github.com/project-codeflare/appwrapper v0.8.0/go.mod h1:FMQ2lI3fz6LakUVXgN1FTdpsc3BBkNIZZgtMmM9J5UM=
github.com/project-codeflare/codeflare-common v0.0.0-20241108084652-0d76fd215a22 h1:wzIJHoGAmNZupO3ZI7gbONuXgIUireabHsZvMt+3fqQ=
github.com/project-codeflare/codeflare-common v0.0.0-20241108084652-0d76fd215a22/go.mod h1:v7XKwaDoCspsHQlWJNarO7gOpR+iumSS+c1bWs3kJOI=
github.com/project-codeflare/codeflare-common v0.0.0-20241121090634-e99e941c6921 h1:OI9jKDW4yxbXDTpf4Y+8H4uVfdCH+jIqN0JTQfdUMYw=
github.com/project-codeflare/codeflare-common v0.0.0-20241121090634-e99e941c6921/go.mod h1:v7XKwaDoCspsHQlWJNarO7gOpR+iumSS+c1bWs3kJOI=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
Expand Down
2 changes: 1 addition & 1 deletion tests/standalone/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

### Misc environment variables

* `TEST_NAMESPACE` (Optional) - Specify test namespace which should be used to run the tests
* `TEST_NAMESPACE_NAME` (Optional) - Specify test namespace which should be used to run the tests
* `TEST_ILAB_STORAGE_CLASS_NAME` (Optional) - Specify name of StorageClass which supports ReadWriteMany access mode. If not specified then test assumes StorageClass `nfs-csi` to exist.
* `RHELAI_WORKBENCH_IMAGE` (Optional) - Specify Workbench image to be used to run Standalone tool. If not specified then test uses Workbench image `quay.io/opendatahub/workbench-images:jupyter-datascience-ubi9-python-3.11-20241004-609ffb8`.
Provided image should contain `click==8.1.7` and `kubernetes==26.1.0` packages.
Expand Down
23 changes: 2 additions & 21 deletions tests/standalone/e2e/ilab_standalone_rhoai_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,8 @@ func instructlabDistributedTrainingOnRhoai(t *testing.T, numGpus int) {
test.T().Logf("Storage class is not provided. Using default %s", ilabStorageClassName)
}

// Create a namespace
test_namespace, test_namespace_exists := GetTestNamespace()
var namespace *corev1.Namespace

if !test_namespace_exists {
namespace = test.NewTestNamespace()
} else {
_, namespace_exists_err := test.Client().Core().CoreV1().Namespaces().Get(test.Ctx(), test_namespace, metav1.GetOptions{})

if namespace_exists_err != nil {

test.T().Logf("%s namespace doesn't exists. Creating ...", test_namespace)
namespace = CreateTestNamespaceWithName(test, test_namespace)

} else {
namespace = GetNamespaceWithName(test, test_namespace)
test.T().Logf("Using the namespace name which is provided using environment variable..")
}
}

defer test.Client().Core().CoreV1().Namespaces().Delete(test.Ctx(), namespace.Name, metav1.DeleteOptions{})
// Create a namespace or retrieve existing namespace based on env variable
namespace := test.CreateOrGetTestNamespace()

// Create configmap to store standalone script and mount in workbench pod
workingDirectory, err := os.Getwd()
Expand Down

0 comments on commit 7c522a5

Please sign in to comment.