Skip to content

Commit ab53375

Browse files
authored
test: Add LKE Enterprise cases (#687)
1 parent fd7ade9 commit ab53375

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
from pytest import MonkeyPatch
2+
3+
from tests.integration.helpers import (
4+
assert_headers_in_lines,
5+
delete_target_id,
6+
exec_test_command,
7+
get_cluster_id,
8+
get_random_region_with_caps,
9+
get_random_text,
10+
)
11+
12+
BASE_CMD = ["linode-cli", "lke"]
13+
14+
15+
def test_enterprise_tier_available_in_types(monkeypatch: MonkeyPatch):
16+
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
17+
lke_types = (
18+
exec_test_command(
19+
BASE_CMD
20+
+ [
21+
"types",
22+
"--text",
23+
]
24+
)
25+
.stdout.decode()
26+
.rstrip()
27+
)
28+
29+
assert "lke-e" in lke_types
30+
assert "LKE Enterprise" in lke_types
31+
assert "price.monthly" in lke_types
32+
33+
34+
def test_create_lke_enterprise(monkeypatch: MonkeyPatch):
35+
monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta")
36+
label = get_random_text(8)
37+
test_region = get_random_region_with_caps(
38+
required_capabilities=["Linodes", "Kubernetes Enterprise"]
39+
)
40+
41+
output = (
42+
exec_test_command(
43+
BASE_CMD
44+
+ [
45+
"cluster-create",
46+
"--label",
47+
label,
48+
"--tier",
49+
"enterprise",
50+
"--k8s_version",
51+
"v1.31.1+lke1",
52+
"--node_pools.type",
53+
"g6-standard-6",
54+
"--node_pools.count",
55+
"3",
56+
"--region",
57+
test_region,
58+
"--text",
59+
]
60+
)
61+
.stdout.decode()
62+
.rstrip()
63+
)
64+
65+
headers = [
66+
"id",
67+
"label",
68+
"region",
69+
"k8s_version",
70+
"control_plane.high_availability",
71+
"tier",
72+
]
73+
74+
assert_headers_in_lines(headers, output.splitlines())
75+
76+
assert label in output
77+
assert "v1.31.1+lke1" in output
78+
assert "enterprise" in output
79+
80+
delete_target_id(
81+
target="lke",
82+
id=get_cluster_id(label=label),
83+
delete_command="cluster-delete",
84+
)

0 commit comments

Comments
 (0)