Skip to content

Commit 5d00a61

Browse files
authored
Fix cleanup of secrets in tests (#9254)
- Adds a missing finalizer to a test - Adds a workaround for #9251 bug
1 parent 7f6d10a commit 5d00a61

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

test/Base_Tests/src/Network/Enso_Cloud/Cloud_Tests_Setup.enso

+4-1
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,8 @@ with_retries ~action =
123123
if i % 10 == 0 then
124124
IO.println "Still failing after "+i.to_text+" retries. ("+loc.to_display_text+")"
125125
Thread.sleep (1000*sleep_time . floor)
126-
@Tail_Call go (i+1)
126+
## TODO This used to be
127+
@Tail_Call go (i+1)
128+
We should re-add the tail call once https://github.com/enso-org/enso/issues/9251 is fixed.
129+
go (i+1)
127130
go 1

test/Base_Tests/src/Network/Enso_Cloud/Secrets_Spec.enso

+8-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ add_specs suite_builder setup:Cloud_Tests_Setup = setup.with_prepared_environmen
3535
my_secret.name . should_equal "my_test_secret"
3636
my_secret.id.is_empty . should_be_false
3737

38-
with_retries <|
38+
delete_on_fail my_secret <| with_retries <|
3939
Enso_Secret.list . should_contain my_secret
4040

4141
my_secret.delete . should_succeed
@@ -155,10 +155,7 @@ add_specs suite_builder setup:Cloud_Tests_Setup = setup.with_prepared_environmen
155155
nested_secret = Enso_Secret.create "my-nested-secret-1" "NESTED_secret_value" parent=subdirectory
156156
nested_secret.should_succeed
157157

158-
delete_on_fail caught_panic =
159-
nested_secret.delete
160-
Panic.throw caught_panic
161-
Panic.catch Any handler=delete_on_fail <|
158+
delete_on_fail nested_secret <|
162159
with_retries <|
163160
Enso_Secret.list parent=subdirectory . should_contain nested_secret
164161
Enso_Secret.exists "my-nested-secret-1" parent=subdirectory . should_be_true
@@ -236,3 +233,9 @@ main filter=Nothing =
236233

237234
wait_until_secret_is_propagated secret =
238235
with_retries <| Enso_Secret.list . should_contain secret
236+
237+
delete_on_fail resource ~action =
238+
on_failure caught_panic =
239+
resource.delete
240+
Panic.throw caught_panic
241+
Panic.catch Any handler=on_failure action

0 commit comments

Comments
 (0)