Skip to content

Commit 9d4de82

Browse files
committed
fix(workbenche): use notebook_pod fixture to better show fail reason
1 parent 393eb7c commit 9d4de82

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

tests/workbenches/notebook-controller/test_spawning.py

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import pytest
2-
from kubernetes.dynamic.client import DynamicClient
32
from ocp_resources.namespace import Namespace
43
from ocp_resources.notebook import Notebook
54
from ocp_resources.persistent_volume_claim import PersistentVolumeClaim
65
from ocp_resources.pod import Pod
76

7+
from utilities.constants import Timeout
8+
89

910
class TestNotebook:
1011
@pytest.mark.smoke
1112
@pytest.mark.parametrize(
12-
"unprivileged_model_namespace,users_persistent_volume_claim,default_notebook",
13+
"unprivileged_model_namespace,users_persistent_volume_claim,default_notebook,notebook_pod",
1314
[
1415
pytest.param(
1516
{
@@ -21,31 +22,26 @@ class TestNotebook:
2122
"namespace": "test-odh-notebook",
2223
"name": "test-odh-notebook",
2324
},
25+
{"timeout": Timeout.TIMEOUT_5MIN},
2426
)
2527
],
2628
indirect=True,
2729
)
2830
def test_create_simple_notebook(
2931
self,
30-
unprivileged_client: DynamicClient,
32+
notebook_pod: Pod,
3133
unprivileged_model_namespace: Namespace,
3234
users_persistent_volume_claim: PersistentVolumeClaim,
3335
default_notebook: Notebook,
3436
):
3537
"""
3638
Create a simple Notebook CR with all necessary resources and see if the Notebook Operator creates it properly
3739
"""
38-
notebook_pod = Pod(
39-
client=unprivileged_client,
40-
namespace=default_notebook.namespace,
41-
name=f"{default_notebook.name}-0",
42-
)
43-
notebook_pod.wait()
44-
notebook_pod.wait_for_condition(condition=Pod.Condition.READY, status=Pod.Condition.Status.TRUE)
40+
assert notebook_pod.exists
4541

4642
@pytest.mark.smoke
4743
@pytest.mark.parametrize(
48-
"unprivileged_model_namespace,users_persistent_volume_claim,default_notebook",
44+
"unprivileged_model_namespace,users_persistent_volume_claim,default_notebook,notebook_pod",
4945
[
5046
pytest.param(
5147
{
@@ -63,13 +59,14 @@ def test_create_simple_notebook(
6359
"notebooks.opendatahub.io/auth-sidecar-memory-limit": "256Mi",
6460
},
6561
},
62+
{"timeout": Timeout.TIMEOUT_5MIN},
6663
)
6764
],
6865
indirect=True,
6966
)
7067
def test_auth_container_resource_customization(
7168
self,
72-
unprivileged_client: DynamicClient,
69+
notebook_pod: Pod,
7370
unprivileged_model_namespace: Namespace,
7471
users_persistent_volume_claim: PersistentVolumeClaim,
7572
default_notebook: Notebook,
@@ -80,14 +77,6 @@ def test_auth_container_resource_customization(
8077
This test verifies that when a Notebook CR is created with custom Auth container resource
8178
annotations, the spawned pod has the Auth container with the specified resource values.
8279
"""
83-
notebook_pod = Pod(
84-
client=unprivileged_client,
85-
namespace=default_notebook.namespace,
86-
name=f"{default_notebook.name}-0",
87-
)
88-
notebook_pod.wait()
89-
notebook_pod.wait_for_condition(condition=Pod.Condition.READY, status=Pod.Condition.Status.TRUE)
90-
9180
# Verify Auth container has the expected resource values
9281
auth_container = self._get_auth_container(pod=notebook_pod)
9382
assert auth_container, "Auth proxy container not found in the pod"

0 commit comments

Comments
 (0)