1111 exec_failing_test_command ,
1212 exec_test_command ,
1313 get_random_region_with_caps ,
14+ get_random_text ,
15+ retry_exec_test_command_with_delay ,
1416)
1517from tests .integration .linodes .fixtures import ( # noqa: F401
1618 linode_min_req ,
19+ linode_with_authorization_key ,
1720 linode_with_label ,
1821 linode_wo_image ,
1922 test_linode_instance ,
2326 DEFAULT_TEST_IMAGE ,
2427 create_linode ,
2528 get_disk_id ,
29+ wait_for_disk_status ,
2630 wait_until ,
2731)
2832
@@ -42,6 +46,110 @@ def test_create_linodes_with_a_label(linode_with_label):
4246 )
4347
4448
49+ def test_expected_error_if_fields_authorized_users_authorized_keys_root_pass_are_not_set ():
50+ test_region = get_random_region_with_caps (
51+ required_capabilities = ["Linodes" , "Disk Encryption" ]
52+ )
53+ result = exec_failing_test_command (
54+ BASE_CMDS ["linodes" ]
55+ + [
56+ "create" ,
57+ "--type" ,
58+ "g6-nanode-1" ,
59+ "--region" ,
60+ test_region ,
61+ "--image" ,
62+ DEFAULT_TEST_IMAGE ,
63+ "--label" ,
64+ "cli-negative-test-case" ,
65+ "--kernel" ,
66+ "linode/latest-64bit" ,
67+ "--boot_size" ,
68+ "9000" ,
69+ "--text" ,
70+ "--delimiter" ,
71+ "," ,
72+ "--no-headers" ,
73+ "--format" ,
74+ "label,region,type,image,id" ,
75+ "--no-defaults" ,
76+ ],
77+ expected_code = ExitCodes .REQUEST_FAILED ,
78+ )
79+ assert "Request failed: 400" in result
80+ assert (
81+ "Must provide valid root_pass, authorized_keys, or authorized_users"
82+ in result
83+ )
84+
85+
86+ def test_create_linode_with_kernel_and_boot_size_then_add_disk_and_rebuild (
87+ linode_with_authorization_key ,
88+ ):
89+ result_create = linode_with_authorization_key
90+ assert result_create [1 ] == "g6-nanode-1"
91+ assert wait_until (
92+ linode_id = result_create [0 ], timeout = 180 , status = "running"
93+ ), "linode failed to change status to running from creating.."
94+
95+ response_create_disk = (
96+ retry_exec_test_command_with_delay (
97+ BASE_CMDS ["linodes" ]
98+ + [
99+ "disk-create" ,
100+ result_create [0 ],
101+ "--size" ,
102+ "2000" ,
103+ "--label" ,
104+ "cli" + get_random_text (5 ),
105+ "--image" ,
106+ "linode/debian12" ,
107+ "--root_pass" ,
108+ "aComplex@Password123" ,
109+ "--text" ,
110+ "--no-headers" ,
111+ "--delimiter" ,
112+ "," ,
113+ ],
114+ retries = 3 ,
115+ delay = 10 ,
116+ )
117+ .splitlines ()[0 ]
118+ .split ("," )
119+ )
120+ assert "not ready" in response_create_disk
121+ assert wait_for_disk_status (
122+ linode_id = result_create [0 ],
123+ disk_id = response_create_disk [0 ],
124+ timeout = 90 ,
125+ status = "ready" ,
126+ ), "linode failed to change disk status to ready after disk creation.."
127+
128+ result_rebuild = (
129+ exec_test_command (
130+ BASE_CMDS ["linodes" ]
131+ + [
132+ "rebuild" ,
133+ "--image" ,
134+ DEFAULT_TEST_IMAGE ,
135+ "--authorized_keys" ,
136+ "ssh-rsa-sha2-512" ,
137+ "--text" ,
138+ "--no-headers" ,
139+ "--delimiter" ,
140+ "," ,
141+ result_create [0 ],
142+ ]
143+ )
144+ .splitlines ()[0 ]
145+ .split ("," )
146+ )
147+ assert DEFAULT_TEST_IMAGE in result_rebuild
148+ assert wait_until (
149+ linode_id = result_create [0 ], timeout = 180 , status = "running"
150+ ), "linode failed to change status to running from rebuilding.."
151+
152+
45153@pytest .mark .smoke
46154def test_view_linode_configuration (test_linode_instance ):
47155 linode_id = test_linode_instance
@@ -75,26 +183,6 @@ def test_create_linode_with_min_required_props(linode_min_req):
75183 assert re .search ("[0-9]+,us-ord,g6-nanode-1" , result )
76184
77185
78- def test_create_linodes_fails_without_a_root_pass ():
79- result = exec_failing_test_command (
80- BASE_CMDS ["linodes" ]
81- + [
82- "create" ,
83- "--type" ,
84- "g6-nanode-1" ,
85- "--region" ,
86- "us-ord" ,
87- "--image" ,
88- DEFAULT_TEST_IMAGE ,
89- "--text" ,
90- "--no-headers" ,
91- ],
92- ExitCodes .REQUEST_FAILED ,
93- )
94- assert "Request failed: 400" in result
95- assert "root_pass root_pass is required" in result
96-
97-
98186def test_create_linode_without_image_and_not_boot (linode_wo_image ):
99187 linode_id = linode_wo_image
100188
0 commit comments