Skip to content

Commit 814f71f

Browse files
committed
fix(RHOAIENG-20531): adjusted unit tests
Signed-off-by: Pat O'Connor <[email protected]>
1 parent 032bf03 commit 814f71f

File tree

12 files changed

+89
-12
lines changed

12 files changed

+89
-12
lines changed

Diff for: demo-notebooks/guided-demos/0_basic_ray.ipynb

+2-7
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@
189189
],
190190
"metadata": {
191191
"kernelspec": {
192-
"display_name": "Python 3 (ipykernel)",
192+
"display_name": "codeflare-sdk-e3w2-nkw-py3.11",
193193
"language": "python",
194194
"name": "python3"
195195
},
@@ -203,12 +203,7 @@
203203
"name": "python",
204204
"nbconvert_exporter": "python",
205205
"pygments_lexer": "ipython3",
206-
"version": "3.9.18"
207-
},
208-
"vscode": {
209-
"interpreter": {
210-
"hash": "f9f85f796d01129d0dd105a088854619f454435301f6ffec2fea96ecbd9be4ac"
211-
}
206+
"version": "3.11.11"
212207
}
213208
},
214209
"nbformat": 4,

Diff for: poetry.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ markers = [
5959
]
6060
addopts = "--timeout=900"
6161
testpaths = ["src/codeflare_sdk"]
62-
collect_ignore = ["src/codeflare_sdk/common/utils/unit_test_support.py"]
62+
collect_ignore = ["src/codeflare_sdk/common/utils/unit_test_support.py"]

Diff for: src/codeflare_sdk/common/kueue/test_kueue.py

+5
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ def test_aw_creation_local_queue(mocker):
9898

9999
with open(f"{aw_dir}unit-test-aw-kueue.yaml", "r") as f:
100100
aw_kueue = yaml.load(f, Loader=yaml.FullLoader)
101+
print("generated yaml")
102+
print(yaml.dump(aw_kueue, default_flow_style=False))
103+
print("expected yaml")
104+
print(yaml.dump(expected_rc, default_flow_style=False)
105+
)
101106
assert aw_kueue == expected_rc
102107

103108
# With resources loaded in memory, no Local Queue specified.

Diff for: src/codeflare_sdk/common/utils/unit_test_support.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def create_cluster_config(num_workers=2, write_to_file=False):
4040
worker_memory_limits=6,
4141
appwrapper=True,
4242
write_to_file=write_to_file,
43+
annotations={"app.kubernetes.io/managed-by": "test-prefix", "key1": "value1", "key2": "value2"},
4344
)
4445
return config
4546

@@ -498,7 +499,7 @@ def create_cluster_all_config_params(mocker, cluster_name, is_appwrapper) -> Clu
498499
extended_resource_mapping={"example.com/gpu": "GPU", "intel.com/gpu": "TPU"},
499500
overwrite_default_resource_mapping=True,
500501
local_queue="local-queue-default",
501-
annotations={"key1": "value1", "key2": "value2"},
502+
annotations={"app.kubernetes.io/managed-by": "test-prefix", "key1": "value1", "key2": "value2"},
502503
volumes=volumes,
503504
volume_mounts=volume_mounts,
504505
)

Diff for: src/codeflare_sdk/ray/cluster/test_config.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_default_cluster_creation(mocker):
3535
mocker.patch("kubernetes.client.ApisApi.get_api_versions")
3636
mocker.patch("kubernetes.client.CustomObjectsApi.list_namespaced_custom_object")
3737

38-
cluster = Cluster(ClusterConfiguration(name="default-cluster", namespace="ns"))
38+
cluster = Cluster(ClusterConfiguration(name="default-cluster", namespace="ns", annotations={"app.kubernetes.io/managed-by": "test-prefix", "key1": "value1", "key2": "value2"}))
3939

4040
expected_rc = apply_template(
4141
f"{expected_clusters_dir}/ray/default-ray-cluster.yaml",
@@ -50,7 +50,7 @@ def test_default_appwrapper_creation(mocker):
5050
mocker.patch("kubernetes.client.CustomObjectsApi.list_namespaced_custom_object")
5151

5252
cluster = Cluster(
53-
ClusterConfiguration(name="default-appwrapper", namespace="ns", appwrapper=True)
53+
ClusterConfiguration(name="default-appwrapper", namespace="ns", appwrapper=True, annotations={"app.kubernetes.io/managed-by": "test-prefix", "key1": "value1", "key2": "value2"})
5454
)
5555

5656
expected_aw = apply_template(

Diff for: tests/test_cluster_yamls/appwrapper/unit-test-all-params.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ spec:
4242
resources: '"{\"TPU\": 2}"'
4343
serviceType: ClusterIP
4444
template:
45+
metadata:
46+
annotations:
47+
app.kubernetes.io/managed-by: test-prefix
48+
key1: value1
49+
key2: value2
4550
spec:
4651
containers:
4752
- env:
@@ -142,6 +147,11 @@ spec:
142147
resources: '"{}"'
143148
replicas: 10
144149
template:
150+
metadata:
151+
annotations:
152+
app.kubernetes.io/managed-by: test-prefix
153+
key1: value1
154+
key2: value2
145155
spec:
146156
containers:
147157
- env:

Diff for: tests/test_cluster_yamls/kueue/aw_kueue.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ spec:
1111
apiVersion: ray.io/v1
1212
kind: RayCluster
1313
metadata:
14+
annotations:
15+
app.kubernetes.io/managed-by: test-prefix
16+
key1: value1
17+
key2: value2
1418
labels:
1519
controller-tools.k8s.io: '1.0'
1620
name: unit-test-aw-kueue
@@ -36,6 +40,11 @@ spec:
3640
resources: '"{}"'
3741
serviceType: ClusterIP
3842
template:
43+
metadata:
44+
annotations:
45+
app.kubernetes.io/managed-by: test-prefix
46+
key1: value1
47+
key2: value2
3948
spec:
4049
containers:
4150
- image: "${image}"
@@ -101,6 +110,11 @@ spec:
101110
resources: '"{}"'
102111
replicas: 2
103112
template:
113+
metadata:
114+
annotations:
115+
app.kubernetes.io/managed-by: test-prefix
116+
key1: value1
117+
key2: value2
104118
spec:
105119
containers:
106120
- image: "${image}"

Diff for: tests/test_cluster_yamls/kueue/ray_cluster_kueue.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ spec:
1111
apiVersion: ray.io/v1
1212
kind: RayCluster
1313
metadata:
14+
annotations:
15+
app.kubernetes.io/managed-by: test-prefix
16+
key1: value1
17+
key2: value2
1418
labels:
1519
controller-tools.k8s.io: '1.0'
1620
name: unit-test-cluster-kueue
@@ -36,6 +40,11 @@ spec:
3640
resources: '"{}"'
3741
serviceType: ClusterIP
3842
template:
43+
metadata:
44+
annotations:
45+
app.kubernetes.io/managed-by: test-prefix
46+
key1: value1
47+
key2: value2
3948
spec:
4049
containers:
4150
- image: "${image}"
@@ -101,6 +110,11 @@ spec:
101110
resources: '"{}"'
102111
replicas: 2
103112
template:
113+
metadata:
114+
annotations:
115+
app.kubernetes.io/managed-by: test-prefix
116+
key1: value1
117+
key2: value2
104118
spec:
105119
containers:
106120
- image: "${image}"

Diff for: tests/test_cluster_yamls/ray/default-appwrapper.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ spec:
99
apiVersion: ray.io/v1
1010
kind: RayCluster
1111
metadata:
12+
annotations:
13+
app.kubernetes.io/managed-by: test-prefix
14+
key1: value1
15+
key2: value2
1216
labels:
1317
controller-tools.k8s.io: '1.0'
1418
name: default-appwrapper
@@ -34,6 +38,11 @@ spec:
3438
resources: '"{}"'
3539
serviceType: ClusterIP
3640
template:
41+
metadata:
42+
annotations:
43+
app.kubernetes.io/managed-by: test-prefix
44+
key1: value1
45+
key2: value2
3746
spec:
3847
containers:
3948
- image: "${image}"
@@ -99,6 +108,11 @@ spec:
99108
resources: '"{}"'
100109
replicas: 1
101110
template:
111+
metadata:
112+
annotations:
113+
app.kubernetes.io/managed-by: test-prefix
114+
key1: value1
115+
key2: value2
102116
spec:
103117
containers:
104118
- image: "${image}"

Diff for: tests/test_cluster_yamls/ray/default-ray-cluster.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
apiVersion: ray.io/v1
22
kind: RayCluster
33
metadata:
4+
annotations:
5+
app.kubernetes.io/managed-by: test-prefix
6+
key1: value1
7+
key2: value2
48
labels:
59
controller-tools.k8s.io: '1.0'
610
name: default-cluster
@@ -26,6 +30,11 @@ spec:
2630
resources: '"{}"'
2731
serviceType: ClusterIP
2832
template:
33+
metadata:
34+
annotations:
35+
app.kubernetes.io/managed-by: test-prefix
36+
key1: value1
37+
key2: value2
2938
spec:
3039
containers:
3140
- image: "${image}"
@@ -91,6 +100,11 @@ spec:
91100
resources: '"{}"'
92101
replicas: 1
93102
template:
103+
metadata:
104+
annotations:
105+
app.kubernetes.io/managed-by: test-prefix
106+
key1: value1
107+
key2: value2
94108
spec:
95109
containers:
96110
- image: "${image}"

Diff for: tests/test_cluster_yamls/ray/unit-test-all-params.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ spec:
3333
resources: '"{\"TPU\": 2}"'
3434
serviceType: ClusterIP
3535
template:
36+
metadata:
37+
annotations:
38+
app.kubernetes.io/managed-by: test-prefix
39+
key1: value1
40+
key2: value2
3641
spec:
3742
containers:
3843
- env:
@@ -133,6 +138,11 @@ spec:
133138
resources: '"{}"'
134139
replicas: 10
135140
template:
141+
metadata:
142+
annotations:
143+
app.kubernetes.io/managed-by: test-prefix
144+
key1: value1
145+
key2: value2
136146
spec:
137147
containers:
138148
- env:

0 commit comments

Comments
 (0)