Skip to content

Commit 53e4173

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents d52e824 + 008c01c commit 53e4173

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+3695
-635
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818

1919
### Common environment variables
2020

21-
* `CODEFLARE_TEST_OUTPUT_DIR` - Output directory for test logs
22-
* `CODEFLARE_TEST_TIMEOUT_SHORT` - Timeout duration for short tasks
23-
* `CODEFLARE_TEST_TIMEOUT_MEDIUM` - Timeout duration for medium tasks
24-
* `CODEFLARE_TEST_TIMEOUT_LONG` - Timeout duration for long tasks
25-
* `CODEFLARE_TEST_RAY_IMAGE` (Optional) - Ray image used for raycluster configuration
21+
* `TEST_OUTPUT_DIR` - Output directory for test logs
22+
* `TEST_TIMEOUT_SHORT` - Timeout duration for short tasks
23+
* `TEST_TIMEOUT_MEDIUM` - Timeout duration for medium tasks
24+
* `TEST_TIMEOUT_LONG` - Timeout duration for long tasks
25+
* `TEST_RAY_IMAGE` (Optional) - Ray image used for raycluster configuration
2626
* `MINIO_CLI_IMAGE` (Optional) - Minio CLI image used for uploading/downloading data from/into s3 bucket
2727
* `TEST_TIER` (Optional) - Specifies test tier to run, skipping tests which don't belong to specified test tier. Supported test tiers: Smoke, Sanity, Tier1, Tier2, Tier3, Pre-Upgrade and Post-Upgrade.
2828

29-
NOTE: `quay.io/modh/ray:2.35.0-py311-cu121` is the default image used for creating a RayCluster resource. If you have your own custom ray image which suits your purposes, specify it in `CODEFLARE_TEST_RAY_IMAGE` environment variable.
29+
NOTE: `quay.io/modh/ray:2.35.0-py311-cu121` is the default image used for creating a RayCluster resource. If you have your own custom ray image which suits your purposes, specify it in `TEST_RAY_IMAGE` environment variable.
3030

3131
### Environment variables for fms-hf-tuning test suite
3232

go.mod

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ require (
66
github.com/kubeflow/training-operator v1.7.0
77
github.com/matoous/go-nanoid/v2 v2.1.0
88
github.com/onsi/gomega v1.32.0
9+
github.com/openshift/api v0.0.0-20230718161610-2a3e8b481cec
10+
github.com/openshift/client-go v0.0.0-20230718165156-6014fb98e86a
911
github.com/project-codeflare/appwrapper v0.8.0
10-
github.com/project-codeflare/codeflare-common v0.0.0-20250317102908-1c124db97844
1112
github.com/prometheus/client_golang v1.20.4
1213
github.com/prometheus/common v0.57.0
1314
github.com/ray-project/kuberay/ray-operator v1.1.1
@@ -18,9 +19,7 @@ require (
1819
)
1920

2021
require (
21-
github.com/aymerick/douceur v0.2.0 // indirect
2222
github.com/beorn7/perks v1.0.1 // indirect
23-
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
2423
github.com/cespare/xxhash/v2 v2.3.0 // indirect
2524
github.com/davecgh/go-spew v1.1.1 // indirect
2625
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
@@ -31,29 +30,22 @@ require (
3130
github.com/go-openapi/jsonreference v0.20.2 // indirect
3231
github.com/go-openapi/swag v0.22.4 // indirect
3332
github.com/gogo/protobuf v1.3.2 // indirect
34-
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
35-
github.com/golang/glog v1.0.0 // indirect
3633
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
3734
github.com/golang/protobuf v1.5.4 // indirect
3835
github.com/google/gnostic-models v0.6.8 // indirect
3936
github.com/google/go-cmp v0.6.0 // indirect
4037
github.com/google/gofuzz v1.2.0 // indirect
4138
github.com/google/uuid v1.3.1 // indirect
42-
github.com/gorilla/css v1.0.0 // indirect
4339
github.com/imdario/mergo v0.3.16 // indirect
4440
github.com/josharian/intern v1.0.0 // indirect
4541
github.com/jpillora/backoff v1.0.0 // indirect
4642
github.com/json-iterator/go v1.1.12 // indirect
4743
github.com/klauspost/compress v1.17.9 // indirect
4844
github.com/mailru/easyjson v0.7.7 // indirect
49-
github.com/microcosm-cc/bluemonday v1.0.18 // indirect
5045
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5146
github.com/modern-go/reflect2 v1.0.2 // indirect
5247
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
5348
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
54-
github.com/openshift-online/ocm-sdk-go v0.1.368 // indirect
55-
github.com/openshift/api v0.0.0-20230718161610-2a3e8b481cec // indirect
56-
github.com/openshift/client-go v0.0.0-20230718165156-6014fb98e86a // indirect
5749
github.com/pkg/errors v0.9.1 // indirect
5850
github.com/prometheus/client_model v0.6.1 // indirect
5951
github.com/prometheus/procfs v0.15.1 // indirect

go.sum

Lines changed: 0 additions & 595 deletions
Large diffs are not rendered by default.

tests/common/environment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"os"
2121
"slices"
2222

23-
. "github.com/project-codeflare/codeflare-common/support"
23+
. "github.com/opendatahub-io/distributed-workloads/tests/common/support"
2424
)
2525

2626
const (

tests/common/notebook.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ import (
2222
"strings"
2323

2424
gomega "github.com/onsi/gomega"
25-
. "github.com/project-codeflare/codeflare-common/support"
2625

2726
corev1 "k8s.io/api/core/v1"
2827
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2928
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
3029
"k8s.io/apimachinery/pkg/runtime/schema"
3130
"k8s.io/apimachinery/pkg/util/yaml"
31+
32+
. "github.com/opendatahub-io/distributed-workloads/tests/common/support"
3233
)
3334

3435
const (

tests/common/support/accelerator.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
Copyright 2025.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package support
18+
19+
var (
20+
AMD = Accelerator{Type: "gpu", ResourceLabel: "amd.com/gpu"}
21+
CPU = Accelerator{Type: "cpu"}
22+
NVIDIA = Accelerator{Type: "gpu", ResourceLabel: "nvidia.com/gpu", PrometheusGpuUtilizationLabel: "DCGM_FI_DEV_GPU_UTIL"}
23+
)
24+
25+
type Accelerator struct {
26+
Type string
27+
ResourceLabel string
28+
PrometheusGpuUtilizationLabel string
29+
}
30+
31+
// Method to check if the accelerator is a GPU
32+
func (a Accelerator) IsGpu() bool {
33+
return a != CPU
34+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
Copyright 2023.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package support
18+
19+
import (
20+
"github.com/onsi/gomega"
21+
22+
authenticationv1 "k8s.io/api/authentication/v1"
23+
corev1 "k8s.io/api/core/v1"
24+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
25+
)
26+
27+
func CreateToken(t Test, namespace string, serviceAccount *corev1.ServiceAccount) string {
28+
t.T().Helper()
29+
30+
treq := &authenticationv1.TokenRequest{
31+
Spec: authenticationv1.TokenRequestSpec{
32+
ExpirationSeconds: Ptr(int64(3600)),
33+
},
34+
}
35+
treq, err := t.Client().Core().CoreV1().ServiceAccounts(namespace).CreateToken(t.Ctx(), serviceAccount.Name, treq, metav1.CreateOptions{})
36+
t.Expect(err).NotTo(gomega.HaveOccurred())
37+
t.T().Logf("Created TokenRequest %s/%s successfully", treq.Namespace, treq.Name)
38+
39+
return treq.Status.Token
40+
}

tests/common/support/batch.go

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
Copyright 2023.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package support
18+
19+
import (
20+
"github.com/onsi/gomega"
21+
22+
batchv1 "k8s.io/api/batch/v1"
23+
corev1 "k8s.io/api/core/v1"
24+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
25+
)
26+
27+
func Job(t Test, namespace, name string) func(g gomega.Gomega) *batchv1.Job {
28+
return func(g gomega.Gomega) *batchv1.Job {
29+
job, err := t.Client().Core().BatchV1().Jobs(namespace).Get(t.Ctx(), name, metav1.GetOptions{})
30+
g.Expect(err).NotTo(gomega.HaveOccurred())
31+
return job
32+
}
33+
}
34+
35+
func GetJob(t Test, namespace, name string) *batchv1.Job {
36+
t.T().Helper()
37+
return Job(t, namespace, name)(t)
38+
}
39+
40+
func JobConditionCompleted(job *batchv1.Job) corev1.ConditionStatus {
41+
return JobCondition(job, batchv1.JobComplete)
42+
}
43+
44+
func JobConditionFailed(job *batchv1.Job) corev1.ConditionStatus {
45+
return JobCondition(job, batchv1.JobFailed)
46+
}
47+
48+
func JobCondition(job *batchv1.Job, conditionType batchv1.JobConditionType) corev1.ConditionStatus {
49+
for _, condition := range job.Status.Conditions {
50+
if condition.Type == conditionType {
51+
return condition.Status
52+
}
53+
}
54+
return corev1.ConditionUnknown
55+
}

tests/common/support/batch_test.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
Copyright 2023.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package support
18+
19+
import (
20+
"testing"
21+
22+
"github.com/onsi/gomega"
23+
24+
batchv1 "k8s.io/api/batch/v1"
25+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
26+
)
27+
28+
func TestGetJob(t *testing.T) {
29+
30+
test := NewTest(t)
31+
32+
Job := &batchv1.Job{
33+
ObjectMeta: metav1.ObjectMeta{
34+
Name: "my-job-1",
35+
Namespace: "my-namespace",
36+
},
37+
}
38+
39+
test.client.Core().BatchV1().Jobs("my-namespace").Create(test.ctx, Job, metav1.CreateOptions{})
40+
41+
// Call the Job function using the fake client
42+
jobs := GetJob(test, "my-namespace", "my-job-1")
43+
44+
test.Expect(jobs.Name).To(gomega.Equal("my-job-1"))
45+
test.Expect(jobs.Namespace).To(gomega.Equal("my-namespace"))
46+
47+
}

0 commit comments

Comments
 (0)