File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -24,11 +24,15 @@ def cloud(request):
24
24
tag = "pycl-test" , timestamp_suffix = True
25
25
) as cloud_instance :
26
26
if isinstance (cloud_instance , pycloudlib .EC2 ):
27
- cloud_instance .upload_key (
28
- public_key_path = cloud_instance .config ["public_key_path" ],
29
- private_key_path = cloud_instance .config ["private_key_path" ],
30
- name = cloud_instance .tag ,
31
- )
27
+ # if key has already been uploaded, skip uploading it again.
28
+ # this is because the cloud instance is shared between tests and
29
+ # so the cloud does not clean up and remove the key between tests
30
+ if cloud_instance .tag not in cloud_instance .list_keys ():
31
+ cloud_instance .upload_key (
32
+ public_key_path = cloud_instance .config ["public_key_path" ],
33
+ private_key_path = cloud_instance .config ["private_key_path" ],
34
+ name = cloud_instance .tag ,
35
+ )
32
36
33
37
yield cloud_instance
34
38
You can’t perform that action at this time.
0 commit comments