11import pytest
22
3- from timeout_sampler import TimeoutExpiredError
3+ from kubernetes . dynamic . client import DynamicClient
44
55from ocp_resources .pod import Pod
6+ from ocp_resources .namespace import Namespace
7+ from ocp_resources .notebook import Notebook
8+ from ocp_resources .persistent_volume_claim import PersistentVolumeClaim
69
710
811class TestNotebook :
@@ -26,25 +29,18 @@ class TestNotebook:
2629 )
2730 def test_create_simple_notebook (
2831 self ,
29- unprivileged_client ,
30- unprivileged_model_namespace ,
31- users_persistent_volume_claim ,
32- default_notebook ,
32+ unprivileged_client : DynamicClient ,
33+ unprivileged_model_namespace : Namespace ,
34+ users_persistent_volume_claim : PersistentVolumeClaim ,
35+ default_notebook : Notebook ,
3336 ):
3437 """
3538 Create a simple Notebook CR with all necessary resources and see if the Notebook Operator creates it properly
3639 """
37- pods = Pod . get (
38- dyn_client = unprivileged_client ,
39- namespace = unprivileged_model_namespace . name ,
40- label_selector = f"app= { unprivileged_model_namespace .name } " ,
40+ notebook_pod = Pod (
41+ client = unprivileged_client ,
42+ namespace = default_notebook . namespace ,
43+ name = f"{ default_notebook .name } -0 " ,
4144 )
42- assert pods , "The expected notebook pods were not found"
43-
44- failed_pods = []
45- for pod in pods :
46- try :
47- pod .wait_for_condition (condition = pod .Condition .READY , status = pod .Condition .Status .TRUE )
48- except TimeoutExpiredError :
49- failed_pods .append (pod )
50- assert not failed_pods , f"The following pods failed to get READY when starting the notebook: { failed_pods } "
45+ notebook_pod .wait ()
46+ notebook_pod .wait_for_condition (condition = Pod .Condition .READY , status = Pod .Condition .Status .TRUE )
0 commit comments