Skip to content

Commit 699525b

Browse files
authored
Fixes of another failing integration tests (#730)
* Increase timeout for get_domain_status * Mark test_latest_get_event as flaky and increase latest_events list Decided mark test as flaky and increase latest_event list to 50 items because when it is run with TPT test user there is a high possibility that other tests may be run in the same time and produce many other events * Add condition to get different region for migration * Add skip for test_get_login due to ongoing issue for TPT user * Increase timeouts in test_create_and_delete_vlan * Add try-except clause to create_image_id fixture * Modify condition to get different region for migration * Update skip reason content in test_get_login * Fix hardcoded labels
1 parent f16d5e8 commit 699525b

6 files changed

Lines changed: 32 additions & 13 deletions

File tree

test/integration/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def get_domain_status():
317317
domain.invalidate()
318318
return domain.status == "active"
319319

320-
wait_for_condition(3, 30, get_domain_status)
320+
wait_for_condition(3, 45, get_domain_status)
321321

322322
# Create a SRV record
323323
domain.record_create(

test/integration/models/account/test_account.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ def test_get_account(test_linode_client):
3939
assert account_get.tax_id == account.tax_id
4040

4141

42+
@pytest.mark.skip(
43+
reason="Test fails for E2E test user with [504] Server Timeout due to enormous amount of logins. More details: ARB-7420"
44+
)
4245
def test_get_login(test_linode_client):
4346
client = test_linode_client
4447
login = retry_sending_request(3, client.load, Login(client, "", {}), "")
@@ -91,6 +94,8 @@ def test_update_maintenance_policy(test_linode_client):
9194
assert updated.maintenance_policy == original_policy
9295

9396

97+
# May fail due to multiple events occurring on the test user in the same time
98+
@pytest.mark.flaky(reruns=2, reruns_delay=5)
9499
@pytest.mark.smoke
95100
def test_latest_get_event(test_linode_client, e2e_test_firewall):
96101
client = test_linode_client
@@ -115,15 +120,15 @@ def get_linode_status():
115120
wait_for_condition(5, 150, get_linode_status)
116121

117122
events = client.load(Event, "")
118-
latest_events = events._raw_json.get("data")[:15]
123+
latest_events = events._raw_json.get("data")[:50]
119124

120125
linode.delete()
121126

122127
for event in latest_events:
123128
if label == event["entity"]["label"]:
124129
break
125130
else:
126-
assert False, f"Linode '{label}' not found in the last 15 events"
131+
assert False, f"Linode '{label}' not found in the last 50 events"
127132

128133

129134
def test_get_user(test_linode_client):

test/integration/models/image/test_image.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,10 @@ def image_upload_url(test_linode_client):
4343

4444
region = get_image_upload_regions(test_linode_client)[0]
4545

46-
test_linode_client.image_create_upload(
46+
image, _ = test_linode_client.image_create_upload(
4747
label, region.id, "integration test image upload"
4848
)
4949

50-
image = test_linode_client.images()[0]
51-
5250
yield image
5351

5452
image.delete()

test/integration/models/linode/test_linode.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,8 +641,22 @@ def test_linode_ips(create_linode):
641641

642642
def test_linode_initate_migration(test_linode_client, e2e_test_firewall):
643643
client = test_linode_client
644-
region = get_region(client, {"Linodes", "Cloud Firewall"}, site_type="core")
645644
label = get_test_label() + "_migration"
645+
region = get_region(client, {"Linodes", "Cloud Firewall"}, site_type="core")
646+
region_migrate = get_region(
647+
client, {"Linodes", "Cloud Firewall"}, site_type="core"
648+
)
649+
650+
# Cannot migrate linode to the same region
651+
for _ in range(5):
652+
if region_migrate.id != region.id:
653+
break
654+
655+
region_migrate = get_region(
656+
client, {"Linodes", "Cloud Firewall"}, site_type="core"
657+
)
658+
else:
659+
pytest.skip("No alternative region to be used for linode migration")
646660

647661
linode = client.linode.instance_create(
648662
"g6-nanode-1",
@@ -657,7 +671,7 @@ def test_linode_initate_migration(test_linode_client, e2e_test_firewall):
657671
send_request_when_resource_available(
658672
300,
659673
linode.initiate_migration,
660-
region="us-central",
674+
region=region_migrate,
661675
migration_type=MigrationType.COLD,
662676
)
663677

test/integration/models/networking/test_networking.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,14 +304,14 @@ def test_create_and_delete_vlan(test_linode_client, linode_for_vlan_tests):
304304
config.interfaces = []
305305
config.save()
306306

307-
wait_for_condition(3, 100, get_status, linode, "running")
307+
wait_for_condition(3, 150, get_status, linode, "running")
308308

309309
retry_sending_request(3, linode.reboot)
310310

311311
wait_for_condition(3, 100, get_status, linode, "rebooting")
312312
assert linode.status == "rebooting"
313313

314-
wait_for_condition(3, 100, get_status, linode, "running")
314+
wait_for_condition(3, 150, get_status, linode, "running")
315315

316316
# Delete the VLAN
317317
is_deleted = test_linode_client.networking.delete_vlan(

test/integration/models/sharegroups/test_sharegroups.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def wait_for_image_status(
3333
)
3434

3535

36-
@pytest.fixture(scope="class")
36+
@pytest.fixture(scope="module")
3737
def sample_linode(test_linode_client, e2e_test_firewall):
3838
client = test_linode_client
3939
region = get_region(client, {"Linodes", "Cloud Firewall"}, site_type="core")
@@ -50,14 +50,16 @@ def sample_linode(test_linode_client, e2e_test_firewall):
5050
linode_instance.delete()
5151

5252

53-
@pytest.fixture(scope="class")
53+
@pytest.fixture(scope="module")
5454
def create_image_id(test_linode_client, sample_linode):
5555
create_image = test_linode_client.images.create(
5656
sample_linode.disks[0],
57-
label="linode-api4python-test-image-sharing-image",
57+
label=get_test_label(8) + "_sharing-image",
5858
)
5959
wait_for_image_status(test_linode_client, create_image.id, "available")
60+
6061
yield create_image.id
62+
6163
create_image.delete()
6264

6365

0 commit comments

Comments
 (0)