Skip to content

Commit 9d99566

Browse files
authored
test: Update smoke test coverage and improve nightly test workflow (#637)
1 parent e7efcea commit 9d99566

File tree

9 files changed

+160
-11
lines changed

9 files changed

+160
-11
lines changed

.github/workflows/e2e-suite.yml

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on:
2323
- dev
2424

2525
jobs:
26-
integration-tests:
26+
integration_tests:
2727
name: Run integration tests on Ubuntu
2828
runs-on: ubuntu-latest
2929
if: github.event_name == 'workflow_dispatch' && inputs.sha != '' || github.event_name == 'push' || github.event_name == 'pull_request'
@@ -167,3 +167,69 @@ jobs:
167167
conclusion: process.env.conclusion
168168
});
169169
return result;
170+
171+
notify-slack:
172+
runs-on: ubuntu-latest
173+
needs: [integration_tests]
174+
if: always() && github.repository == 'linode/linode-cli' # Run even if integration tests fail and only on main repository
175+
176+
steps:
177+
- name: Notify Slack
178+
uses: slackapi/slack-github-action@v1.27.0
179+
with:
180+
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
181+
payload: |
182+
{
183+
"blocks": [
184+
{
185+
"type": "section",
186+
"text": {
187+
"type": "mrkdwn",
188+
"text": ":rocket: *${{ github.workflow }} Completed in: ${{ github.repository }}* :white_check_mark:"
189+
}
190+
},
191+
{
192+
"type": "divider"
193+
},
194+
{
195+
"type": "section",
196+
"fields": [
197+
{
198+
"type": "mrkdwn",
199+
"text": "*Build Result:*\n${{ steps.integration_tests.outcome == 'success' && ':large_green_circle: Build Passed' || ':red_circle: Build Failed' }}"
200+
},
201+
{
202+
"type": "mrkdwn",
203+
"text": "*Branch:*\n`${{ github.ref_name }}`"
204+
}
205+
]
206+
},
207+
{
208+
"type": "section",
209+
"fields": [
210+
{
211+
"type": "mrkdwn",
212+
"text": "*Commit Hash:*\n<${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>"
213+
},
214+
{
215+
"type": "mrkdwn",
216+
"text": "*Run URL:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run Details>"
217+
}
218+
]
219+
},
220+
{
221+
"type": "divider"
222+
},
223+
{
224+
"type": "context",
225+
"elements": [
226+
{
227+
"type": "mrkdwn",
228+
"text": "Triggered by: :bust_in_silhouette: `${{ github.actor }}`"
229+
}
230+
]
231+
}
232+
]
233+
}
234+
env:
235+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

.github/workflows/nightly-smoke-tests.yml

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,25 @@ on:
44
schedule:
55
- cron: "0 0 * * *"
66
workflow_dispatch:
7+
inputs:
8+
sha:
9+
description: 'Commit SHA to test'
10+
required: false
11+
default: ''
12+
type: string
713

814
jobs:
915
smoke_tests:
16+
if: github.repository == 'linode/linode-cli' || github.event_name == 'workflow_dispatch'
1017
runs-on: ubuntu-latest
1118

1219
steps:
1320
- name: Checkout code
14-
uses: actions/checkout@v3
21+
uses: actions/checkout@v4
1522
with:
16-
ref: dev
23+
fetch-depth: 0
24+
submodules: 'recursive'
25+
ref: ${{ github.event.inputs.sha || github.ref }}
1726

1827
- name: Set up Python
1928
uses: actions/setup-python@v4
@@ -29,7 +38,69 @@ jobs:
2938
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3039

3140
- name: Run smoke tests
41+
id: smoke_tests
3242
run: |
3343
make smoketest
3444
env:
3545
LINODE_CLI_TOKEN: ${{ secrets.LINODE_TOKEN }}
46+
47+
- name: Notify Slack
48+
if: always() && github.repository == 'linode/linode-cli' # Run even if integration tests fail and only on main repository
49+
uses: slackapi/slack-github-action@v1.26.0
50+
with:
51+
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
52+
payload: |
53+
{
54+
"blocks": [
55+
{
56+
"type": "section",
57+
"text": {
58+
"type": "mrkdwn",
59+
"text": ":rocket: *${{ github.workflow }} Completed in: ${{ github.repository }}* :white_check_mark:"
60+
}
61+
},
62+
{
63+
"type": "divider"
64+
},
65+
{
66+
"type": "section",
67+
"fields": [
68+
{
69+
"type": "mrkdwn",
70+
"text": "*Build Result:*\n${{ steps.smoke_tests.outcome == 'success' && ':large_green_circle: Build Passed' || ':red_circle: Build Failed' }}"
71+
},
72+
{
73+
"type": "mrkdwn",
74+
"text": "*Branch:*\n`${{ github.ref_name }}`"
75+
}
76+
]
77+
},
78+
{
79+
"type": "section",
80+
"fields": [
81+
{
82+
"type": "mrkdwn",
83+
"text": "*Commit Hash:*\n<${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>"
84+
},
85+
{
86+
"type": "mrkdwn",
87+
"text": "*Run URL:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run Details>"
88+
}
89+
]
90+
},
91+
{
92+
"type": "divider"
93+
},
94+
{
95+
"type": "context",
96+
"elements": [
97+
{
98+
"type": "mrkdwn",
99+
"text": "Triggered by: :bust_in_silhouette: `${{ github.actor }}`"
100+
}
101+
]
102+
}
103+
]
104+
}
105+
env:
106+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

.pylintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,8 @@ disable=raw-checker-failed,
424424
duplicate-code,
425425
too-few-public-methods,
426426
too-many-instance-attributes,
427-
use-symbolic-message-instead
427+
use-symbolic-message-instead,
428+
too-many-positional-arguments
428429

429430
# Enable the message, report, category or checker with the given id(s). You can
430431
# either give multiple identifier separated by comma (,) or put this option

tests/integration/domains/test_slave_domains.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,4 @@ def test_update_slave_domain(slave_domain_setup):
102102
]
103103
)
104104

105-
assert (
106-
result.returncode == SUCCESS_STATUS_CODE,
107-
"Failed to update slave domain",
108-
)
105+
assert result.returncode == SUCCESS_STATUS_CODE

tests/integration/linodes/test_types.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import subprocess
33
from typing import List
44

5+
import pytest
6+
57
env = os.environ.copy()
68
env["COLUMNS"] = "200"
79

@@ -16,6 +18,7 @@ def exec_test_command(args: List[str]):
1618

1719

1820
# verifying the DC pricing changes along with types
21+
@pytest.mark.smoke
1922
def test_linode_type():
2023
process = exec_test_command(["linode-cli", "linodes", "types"])
2124
output = process.stdout.decode()

tests/integration/longview/test_longview.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,23 @@
1111
BASE_CMD = ["linode-cli", "longview"]
1212

1313

14+
@pytest.mark.smoke
1415
def test_create_longview_client():
1516
new_label = str(time.time_ns()) + "label"
16-
exec_test_command(
17+
result = exec_test_command(
1718
BASE_CMD
1819
+ [
1920
"create",
2021
"--label",
2122
new_label,
2223
"--text",
2324
"--no-headers",
25+
"--delimiter",
26+
",",
2427
]
25-
)
28+
).stdout.decode()
29+
30+
assert new_label in result
2631

2732

2833
def test_longview_client_list():

tests/integration/regions/test_plugin_region_table.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def test_regions_list():
4444
assert_headers_in_lines(headers, lines)
4545

4646

47+
@pytest.mark.smoke
4748
def test_regions_list_avail():
4849
res = (
4950
exec_test_command(BASE_CMD + ["list-avail", "--text", "--delimiter=,"])
@@ -78,6 +79,7 @@ def get_region_id():
7879
yield first_id
7980

8081

82+
@pytest.mark.smoke
8183
def test_regions_view(get_region_id):
8284
region_id = get_region_id
8385
res = (

tests/integration/vpc/test_vpc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import re
22
import time
33

4+
import pytest
5+
46
from linodecli.exit_codes import ExitCodes
57
from tests.integration.conftest import get_regions_with_capabilities
68
from tests.integration.helpers import (
@@ -35,6 +37,7 @@ def test_view_vpc(test_vpc_wo_subnet):
3537
assert vpc_id in res
3638

3739

40+
@pytest.mark.smoke
3841
def test_update_vpc(test_vpc_wo_subnet):
3942
vpc_id = test_vpc_wo_subnet
4043

@@ -120,6 +123,7 @@ def test_view_subnet(test_vpc_wo_subnet, test_subnet):
120123
assert vpc_subnet_id in output
121124

122125

126+
@pytest.mark.smoke
123127
def test_update_subnet(test_vpc_w_subnet):
124128
vpc_id = test_vpc_w_subnet
125129

0 commit comments

Comments
 (0)