Skip to content

Commit 4737b42

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents e3078dc + 254a792 commit 4737b42

File tree

8 files changed

+1153
-3
lines changed

8 files changed

+1153
-3
lines changed

tests/common/environment.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ package common
1919
import (
2020
"flag"
2121
"os"
22+
"os/exec"
2223
"slices"
24+
"strings"
2325

2426
. "github.com/opendatahub-io/distributed-workloads/tests/common/support"
2527
)
@@ -81,6 +83,49 @@ func GetNotebookUserPassword(t Test) string {
8183
return password
8284
}
8385

86+
// GenerateNotebookUserToken generates an OpenShift token using oc login with username and password
87+
func GenerateNotebookUserToken(t Test) string {
88+
userName := GetNotebookUserName(t)
89+
password := GetNotebookUserPassword(t)
90+
91+
// Use own kubeconfig file to retrieve user token to keep it separated from main test credentials
92+
tempFile, err := os.CreateTemp("", "custom-kubeconfig-")
93+
if err != nil {
94+
t.T().Fatalf("Failed to create temp kubeconfig file: %v", err)
95+
}
96+
defer os.Remove(tempFile.Name())
97+
98+
// Login by oc CLI using username and password
99+
cmd := exec.Command("oc", "login", "-u", userName, "-p", password, GetOpenShiftApiUrl(t), "--insecure-skip-tls-verify=true", "--kubeconfig="+tempFile.Name())
100+
out, err := cmd.Output()
101+
if err != nil {
102+
if exitError, ok := err.(*exec.ExitError); ok {
103+
t.T().Logf("Error running 'oc login' command: %v\n", exitError)
104+
t.T().Logf("Output: %s\n", out)
105+
t.T().Logf("Error output: %s\n", exitError.Stderr)
106+
} else {
107+
t.T().Logf("Error running 'oc login' command: %v\n", err)
108+
}
109+
t.T().FailNow()
110+
}
111+
112+
// Use oc CLI to retrieve user token from kubeconfig
113+
cmd = exec.Command("oc", "whoami", "--show-token", "--kubeconfig="+tempFile.Name())
114+
out, err = cmd.Output()
115+
if err != nil {
116+
if exitError, ok := err.(*exec.ExitError); ok {
117+
t.T().Logf("Error running 'oc whoami' command: %v\n", exitError)
118+
t.T().Logf("Output: %s\n", out)
119+
t.T().Logf("Error output: %s\n", exitError.Stderr)
120+
} else {
121+
t.T().Logf("Error running 'oc whoami' command: %v\n", err)
122+
}
123+
t.T().FailNow()
124+
}
125+
126+
return strings.TrimSpace(string(out))
127+
}
128+
84129
func GetNotebookImage(t Test) string {
85130
notebook_image, ok := os.LookupEnv(notebookImage)
86131
if !ok {

tests/trainer/kubeflow_sdk_test.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,51 @@ func TestSftTrainingHubMultiNodeMultiGPU(t *testing.T) {
4040
Tags(t, KftoCuda, MultiNodeMultiGpu(2, support.NVIDIA, 1))
4141
sdktests.RunSftTrainingHubMultiGpuDistributedTraining(t)
4242
}
43+
44+
// CPU tests
45+
func TestRhaiTrainingProgressionCPU(t *testing.T) {
46+
Tags(t, Tier1)
47+
sdktests.RunRhaiFeaturesProgressionTest(t, support.CPU)
48+
}
49+
50+
func TestRhaiJitCheckpointingCPU(t *testing.T) {
51+
Tags(t, Tier1)
52+
sdktests.RunRhaiFeaturesCheckpointTest(t, support.CPU)
53+
}
54+
55+
func TestRhaiFeaturesCPU(t *testing.T) {
56+
Tags(t, Tier1)
57+
sdktests.RunRhaiFeaturesAllTest(t, support.CPU)
58+
}
59+
60+
// CUDA (NVIDIA) GPU tests - 2 nodes, 1 GPU each
61+
func TestRhaiTrainingProgressionCuda(t *testing.T) {
62+
Tags(t, KftoCuda, MultiNodeGpu(2, support.NVIDIA))
63+
sdktests.RunRhaiFeaturesProgressionTest(t, support.NVIDIA)
64+
}
65+
66+
func TestRhaiJitCheckpointingCuda(t *testing.T) {
67+
Tags(t, KftoCuda, MultiNodeGpu(2, support.NVIDIA))
68+
sdktests.RunRhaiFeaturesCheckpointTest(t, support.NVIDIA)
69+
}
70+
71+
func TestRhaiFeaturesCuda(t *testing.T) {
72+
Tags(t, KftoCuda, MultiNodeGpu(2, support.NVIDIA))
73+
sdktests.RunRhaiFeaturesAllTest(t, support.NVIDIA)
74+
}
75+
76+
// ROCm (AMD) GPU tests - 2 nodes, 1 GPU each
77+
func TestRhaiTrainingProgressionRocm(t *testing.T) {
78+
Tags(t, KftoRocm, MultiNodeGpu(2, support.AMD))
79+
sdktests.RunRhaiFeaturesProgressionTest(t, support.AMD)
80+
}
81+
82+
func TestRhaiJitCheckpointingRocm(t *testing.T) {
83+
Tags(t, KftoRocm, MultiNodeGpu(2, support.AMD))
84+
sdktests.RunRhaiFeaturesCheckpointTest(t, support.AMD)
85+
}
86+
87+
func TestRhaiFeaturesRocm(t *testing.T) {
88+
Tags(t, KftoRocm, MultiNodeGpu(2, support.AMD))
89+
sdktests.RunRhaiFeaturesAllTest(t, support.AMD)
90+
}

0 commit comments

Comments
 (0)