Skip to content

Commit afdc3b2

Browse files
authored
CI: Notify slack channel on releases; Add test coverage for vlans and lke types (#665)
Co-authored-by: Youjung Kim <126618609+ykim-1@users.noreply.github.com>
1 parent 507b743 commit afdc3b2

File tree

4 files changed

+125
-10
lines changed

4 files changed

+125
-10
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Notify Dev DX Channel on Release
2+
on:
3+
release:
4+
types: [published]
5+
workflow_dispatch: null
6+
7+
jobs:
8+
notify:
9+
if: github.repository == 'linode/linode-cli'
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Notify Slack - Main Message
13+
id: main_message
14+
uses: slackapi/slack-github-action@v1.27.0
15+
with:
16+
channel-id: ${{ secrets.CLI_SLACK_CHANNEL_ID }}
17+
payload: |
18+
{
19+
"blocks": [
20+
{
21+
"type": "section",
22+
"text": {
23+
"type": "mrkdwn",
24+
"text": "*New Release Published: _linode-cli_ <${{ github.event.release.html_url }}|${{ github.event.release.tag_name }}> is now live!* :tada:"
25+
}
26+
}
27+
]
28+
}
29+
env:
30+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

tests/integration/linodes/test_power_status.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ def create_linode_in_running_state(linode_cloud_firewall):
2626
delete_target_id("linodes", linode_id)
2727

2828

29+
@pytest.fixture
30+
def create_linode_in_running_state_for_reboot(linode_cloud_firewall):
31+
linode_id = create_linode_and_wait(firewall_id=linode_cloud_firewall)
32+
33+
yield linode_id
34+
35+
delete_target_id("linodes", linode_id)
36+
37+
2938
@pytest.mark.smoke
3039
def test_create_linode_and_boot(test_linode_id):
3140
linode_id = test_linode_id
@@ -36,9 +45,9 @@ def test_create_linode_and_boot(test_linode_id):
3645
assert result, "Linode status has not changed to running from provisioning"
3746

3847

39-
def test_reboot_linode(create_linode_in_running_state):
48+
def test_reboot_linode(create_linode_in_running_state_for_reboot):
4049
# create linode and wait until it is in "running" state
41-
linode_id = create_linode_in_running_state
50+
linode_id = create_linode_in_running_state_for_reboot
4251

4352
# reboot linode from "running" status
4453
exec_test_command(

tests/integration/lke/test_clusters.py

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22

33
import pytest
44

5-
from tests.integration.helpers import (
6-
assert_headers_in_lines,
7-
exec_test_command,
8-
remove_lke_clusters,
9-
)
5+
from tests.integration.helpers import assert_headers_in_lines, exec_test_command
106

117
BASE_CMD = ["linode-cli", "lke"]
128

@@ -301,6 +297,24 @@ def test_version_view(test_version_id):
301297

302298
headers = ["id"]
303299
assert_headers_in_lines(headers, lines)
304-
# Sleep needed here for proper deletion of linodes that are related to lke cluster
305-
time.sleep(5)
306-
remove_lke_clusters()
300+
301+
302+
def test_list_lke_types():
303+
types = (
304+
exec_test_command(
305+
BASE_CMD
306+
+ [
307+
"types",
308+
"--text",
309+
]
310+
)
311+
.stdout.decode()
312+
.rstrip()
313+
)
314+
315+
headers = ["id", "label", "price.hourly", "price.monthly", "transfer"]
316+
lines = types.splitlines()
317+
318+
assert_headers_in_lines(headers, lines)
319+
assert "LKE Standard Availability" in types
320+
assert "LKE High Availability" in types

tests/integration/vlans/test_vlans.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
from tests.integration.helpers import assert_headers_in_lines, exec_test_command
2+
3+
BASE_CMD = ["linode-cli", "vlans"]
4+
5+
6+
def test_list_vlans():
7+
types = (
8+
exec_test_command(
9+
BASE_CMD
10+
+ [
11+
"ls",
12+
"--text",
13+
]
14+
)
15+
.stdout.decode()
16+
.rstrip()
17+
)
18+
19+
headers = ["region", "label", "linodes"]
20+
lines = types.splitlines()
21+
22+
assert_headers_in_lines(headers, lines)
23+
24+
25+
def test_list_vlans_help_menu():
26+
help_menu = (
27+
exec_test_command(
28+
BASE_CMD
29+
+ [
30+
"ls",
31+
"--h",
32+
]
33+
)
34+
.stdout.decode()
35+
.rstrip()
36+
)
37+
38+
assert "linode-cli vlans ls\nList VLANs\n" in help_menu
39+
assert (
40+
"https://techdocs.akamai.com/linode-api/reference/get-vlans"
41+
in help_menu
42+
)
43+
44+
45+
def test_delete_vlans_help_menu():
46+
help_menu = (
47+
exec_test_command(
48+
BASE_CMD
49+
+ [
50+
"delete",
51+
"--h",
52+
]
53+
)
54+
.stdout.decode()
55+
.rstrip()
56+
)
57+
58+
assert "linode-cli vlans delete [LABEL] [REGIONID]" in help_menu
59+
assert (
60+
"https://techdocs.akamai.com/linode-api/reference/delete-vlan"
61+
in help_menu
62+
)

0 commit comments

Comments
 (0)