@@ -45,21 +45,58 @@ def test_create_blueprint_and_await_build(client: Runloop) -> None:
4545@pytest .mark .timeout (30 )
4646def test_start_devbox_from_base_blueprint_by_id (client : Runloop ) -> None :
4747 assert _blueprint_id
48- devbox = client .devboxes .create_and_await_running (
48+ devbox = None
49+ try :
50+ devbox = client .devboxes .create_and_await_running (
4951 blueprint_id = _blueprint_id ,
5052 polling_config = PollingConfig (max_attempts = 120 , interval_seconds = 5.0 , timeout_seconds = 20 * 60 ),
5153 )
52- assert devbox .blueprint_id == _blueprint_id
53- assert devbox .status == "running"
54- client .devboxes .shutdown (devbox .id )
54+ assert devbox .blueprint_id == _blueprint_id
55+ assert devbox .status == "running"
56+ finally :
57+ if devbox :
58+ client .devboxes .shutdown (devbox .id )
5559
5660
5761@pytest .mark .timeout (30 )
5862def test_start_devbox_from_base_blueprint_by_name (client : Runloop ) -> None :
59- devbox = client .devboxes .create_and_await_running (
60- blueprint_name = _blueprint_name ,
61- polling_config = PollingConfig (max_attempts = 120 , interval_seconds = 5.0 , timeout_seconds = 20 * 60 ),
62- )
63- assert devbox .blueprint_id
64- assert devbox .status == "running"
65- client .devboxes .shutdown (devbox .id )
63+ devbox = None
64+ try :
65+ devbox = client .devboxes .create_and_await_running (
66+ blueprint_name = _blueprint_name ,
67+ polling_config = PollingConfig (max_attempts = 120 , interval_seconds = 5.0 , timeout_seconds = 20 * 60 ),
68+ )
69+ assert devbox .blueprint_id
70+ assert devbox .status == "running"
71+ finally :
72+ if devbox :
73+ client .devboxes .shutdown (devbox .id )
74+
75+
76+ @pytest .mark .timeout (60 )
77+ def test_create_blueprint_with_secret_and_await_build (client : Runloop ) -> None :
78+ bpt = None
79+ try :
80+ bpt = client .blueprints .create (
81+ name = unique_name ("bp-secrets" ),
82+ dockerfile = (
83+ "FROM runloop:runloop/starter-arm64\n "
84+ "ARG GITHUB_TOKEN\n "
85+ "RUN git config --global credential.helper '!f() { echo \" username=x-access-token\" ; echo \" password=$GITHUB_TOKEN\" ; }; f' "
86+ "&& git clone https://github.com/runloopai/runloop-fe.git /workspace/runloop-fe "
87+ "&& git config --global --unset credential.helper\n "
88+ "WORKDIR /workspace/runloop-fe"
89+ ),
90+ secrets = {"GITHUB_TOKEN" : "GITHUB_TOKEN_FOR_SMOKETESTS" },
91+ )
92+ # Wait for build to complete
93+ completed = client .blueprints .await_build_complete (
94+ bpt .id ,
95+ polling_config = PollingConfig (max_attempts = 180 , interval_seconds = 5.0 , timeout_seconds = 30 * 60 ),
96+ )
97+ assert completed .status == "build_complete"
98+ assert completed .parameters .secrets is not None
99+ assert completed .parameters .secrets .get ("GITHUB_TOKEN" ) == "GITHUB_TOKEN_FOR_SMOKETESTS"
100+ finally :
101+ if bpt :
102+ client .blueprints .delete (bpt .id )
0 commit comments