Skip to content

Commit 3752add

Browse files
a-dubsblackboxsw
authored andcommitted
test(ec2): prevent failing ssh key re-upload on ec2 integration tests
1 parent 0ffd035 commit 3752add

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tests/integration_tests/test_public_api.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@ def cloud(request):
2424
tag="pycl-test", timestamp_suffix=True
2525
) as cloud_instance:
2626
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+
)
3236

3337
yield cloud_instance
3438

0 commit comments

Comments
 (0)