Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add retry on flaky tests #458

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/integration/linode_client/test_linode_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def test_get_regions(test_linode_client):


@pytest.mark.smoke
@pytest.mark.flaky(reruns=3, reruns_delay=2)
def test_image_create(setup_client_and_linode):
client = setup_client_and_linode[0]
linode = setup_client_and_linode[1]
Expand Down
1 change: 1 addition & 0 deletions test/integration/models/image/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def test_image_create_upload(test_linode_client, test_uploaded_image):


@pytest.mark.smoke
@pytest.mark.flaky(reruns=3, reruns_delay=2)
def test_image_replication(test_linode_client, test_uploaded_image):
uploaded_image, regions = test_uploaded_image

Expand Down
3 changes: 3 additions & 0 deletions test/integration/models/linode/test_linode.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ def test_linode_boot(create_linode):
assert linode.status == "running"


@pytest.mark.flaky(reruns=3, reruns_delay=2)
def test_linode_resize(create_linode_for_long_running_tests):
linode = create_linode_for_long_running_tests

Expand Down Expand Up @@ -590,6 +591,7 @@ def test_get_linode_types_overrides(test_linode_client):
assert linode_type.region_prices[0].monthly >= 0


@pytest.mark.flaky(reruns=3, reruns_delay=2)
def test_save_linode_noforce(test_linode_client, create_linode):
linode = create_linode
old_label = linode.label
Expand All @@ -601,6 +603,7 @@ def test_save_linode_noforce(test_linode_client, create_linode):
assert old_label != linode.label


@pytest.mark.flaky(reruns=3, reruns_delay=2)
def test_save_linode_force(test_linode_client, create_linode):
linode = create_linode
old_label = linode.label
Expand Down
1 change: 1 addition & 0 deletions test/integration/models/lke/test_lke.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ def test_lke_cluster_acl(lke_cluster_with_acl):
assert not cluster.control_plane_acl.enabled


@pytest.mark.flaky(reruns=3, reruns_delay=2)
def test_lke_cluster_labels_and_taints(lke_cluster_with_labels_and_taints):
pool = lke_cluster_with_labels_and_taints.pools[0]

Expand Down
4 changes: 4 additions & 0 deletions test/integration/models/profile/test_profile.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import pytest

from linode_api4.objects import PersonalAccessToken, Profile, SSHKey


Expand All @@ -18,6 +20,7 @@ def test_get_personal_access_token_objects(test_linode_client):
assert isinstance(personal_access_tokens[0], PersonalAccessToken)


@pytest.mark.flaky(reruns=3, reruns_delay=2)
def test_get_sshkeys(test_linode_client, test_sshkey):
client = test_linode_client

Expand All @@ -29,6 +32,7 @@ def test_get_sshkeys(test_linode_client, test_sshkey):
assert test_sshkey.label in ssh_labels


@pytest.mark.flaky(reruns=3, reruns_delay=2)
def test_ssh_key_create(test_sshkey, ssh_key_gen):
pub_key = ssh_key_gen[0]
key = test_sshkey
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ deps =
mock
pylint
httpretty
pytest-rerunfailures
commands =
python -m pip install .
coverage run --source linode_api4 -m pytest test/unit
Expand Down