Skip to content

Commit 0bc032b

Browse files
Resolve failings tests blocking release
1 parent 6431e68 commit 0bc032b

3 files changed

Lines changed: 15 additions & 14 deletions

File tree

test/integration/conftest.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import logging
33
import os
44
import random
5+
import subprocess
56
import time
67
from test.integration.helpers import (
78
get_test_label,
@@ -262,21 +263,19 @@ def create_linode_for_pass_reset(test_linode_client, e2e_test_firewall):
262263

263264

264265
@pytest.fixture(scope="session")
265-
def ssh_key_gen():
266-
output = os.popen("ssh-keygen -q -t rsa -f ./sdk-sshkey -q -N ''")
266+
def ssh_key_gen(tmp_path_factory):
267+
key_path = tmp_path_factory.mktemp("ssh-key-gen") / "sdk-sshkey"
267268

268-
time.sleep(1)
269-
270-
pub_file = open("./sdk-sshkey.pub", "r")
271-
pub_key = pub_file.read().rstrip()
269+
subprocess.run(
270+
["ssh-keygen", "-q", "-t", "rsa", "-f", str(key_path), "-N", ""],
271+
check=True,
272+
)
272273

273-
priv_file = open("./sdk-sshkey", "r")
274-
priv_key = priv_file.read().rstrip()
274+
pub_key = key_path.with_suffix(".pub").read_text().rstrip()
275+
priv_key = key_path.read_text().rstrip()
275276

276277
yield pub_key, priv_key
277278

278-
os.popen("rm ./sdk-sshkey*")
279-
280279

281280
@pytest.fixture(scope="session")
282281
def test_linode_client():

test/integration/models/linode/test_linode.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,18 +1247,19 @@ def test_create_linode_with_kernel_and_boot_size_then_add_disk_and_rebuild(
12471247

12481248

12491249
def test_update_linode_with_reserved_ip_in_address(
1250-
test_linode_client, e2e_test_firewall, create_reserved_ip
1250+
test_linode_client, e2e_test_firewall, create_reserved_ip, ssh_key_gen
12511251
):
12521252
label = get_test_label(length=8)
12531253
client = test_linode_client
12541254
reserved_ip = create_reserved_ip
12551255

1256-
linode, _ = client.linode.instance_create(
1256+
linode = client.linode.instance_create(
12571257
"g6-nanode-1",
12581258
reserved_ip.region,
12591259
image="linode/debian12",
12601260
label=label,
12611261
firewall=e2e_test_firewall,
1262+
authorized_keys=ssh_key_gen[0],
12621263
)
12631264

12641265
linode_ips = linode.ips.ipv4.public

test/integration/models/vpc/test_vpc.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ def test_get_all_vpcs(test_linode_client, create_multiple_vpcs):
6767
vpc_1, vpc_2 = create_multiple_vpcs
6868

6969
all_vpcs = test_linode_client.vpcs()
70+
all_vpc_ids = {vpc.id for vpc in all_vpcs}
7071

71-
assert str(vpc_1) in str(all_vpcs.lists)
72-
assert str(vpc_2) in str(all_vpcs.lists)
72+
assert vpc_1.id in all_vpc_ids
73+
assert vpc_2.id in all_vpc_ids
7374

7475

7576
def test_fails_update_vpc_invalid_data(create_vpc):

0 commit comments

Comments
 (0)