Skip to content

Commit

Permalink
test(ec2): prevent failing ssh key re-upload on ec2 integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
a-dubs committed Sep 25, 2024
1 parent 20f1ee0 commit 566ed4c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/integration_tests/test_public_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ def cloud(request):
tag="pycl-test", timestamp_suffix=True
) as cloud_instance:
if isinstance(cloud_instance, pycloudlib.EC2):
cloud_instance.upload_key(
public_key_path=cloud_instance.config["public_key_path"],
private_key_path=cloud_instance.config["private_key_path"],
name=cloud_instance.tag,
)
# if key has already been uploaded, skip uploading it again.
# this is because the cloud instance is shared between tests and
# so the cloud does not clean up and remove the key between tests
if cloud_instance.tag not in cloud_instance.list_keys():
cloud_instance.upload_key(
public_key_path=cloud_instance.config["public_key_path"],
private_key_path=cloud_instance.config["private_key_path"],
name=cloud_instance.tag,
)

yield cloud_instance

Expand Down

0 comments on commit 566ed4c

Please sign in to comment.