Skip to content

Commit 33c928e

Browse files
authored
Test: Add smoke test suite and workflow (#481)
## πŸ“ Description https://jira.linode.com/browse/TPT-2054 https://jira.linode.com/browse/TPT-2135 ## βœ”οΈ How to Test make smoketest ## πŸ“· Preview **If applicable, include a screenshot or code snippet of this change. Otherwise, please remove this section.**
1 parent 4ab7b79 commit 33c928e

22 files changed

+72
-2
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Nightly Smoke Tests
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
smoke_tests:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
with:
16+
ref: dev
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.x'
22+
23+
- name: Install Python deps
24+
run: pip install -r requirements.txt -r requirements-dev.txt wheel boto3
25+
26+
- name: Install Linode CLI
27+
run: make install
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Run smoke tests
32+
run: |
33+
make smoketest
34+
env:
35+
LINODE_CLI_TOKEN: ${{ secrets.LINODE_TOKEN_2 }}

β€ŽMakefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ build: clean
2626

2727
.PHONY: requirements
2828
requirements:
29-
pip3 install -r requirements.txt
29+
pip3 install -r requirements.txt -r requirements-dev.txt
3030

3131
.PHONY: lint
3232
lint: build
@@ -79,3 +79,7 @@ autoflake:
7979

8080
.PHONY: format
8181
format: black isort autoflake
82+
83+
@PHONEY: smoketest
84+
smoketest:
85+
pytest -m smoke tests/integration --disable-warnings

β€Žtests/integration/cli/test_help.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import pytest
2+
13
from tests.integration.helpers import exec_test_command
24

35

6+
@pytest.mark.smoke
47
def test_help_page_for_non_aliased_actions():
58
process = exec_test_command(["linode-cli", "linodes", "list", "--help"])
69
output = process.stdout.decode()
@@ -14,6 +17,7 @@ def test_help_page_for_non_aliased_actions():
1417
assert "--tags" in output
1518

1619

20+
@pytest.mark.smoke
1721
def test_help_page_for_aliased_actions():
1822
process = exec_test_command(["linode-cli", "linodes", "ls", "--help"])
1923
output = process.stdout.decode()

β€Žtests/integration/domains/test_domain_records.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def domain_records_setup():
6464
delete_target_id(target="domains", id=domain_id)
6565

6666

67+
@pytest.mark.smoke
6768
def test_create_a_domain(create_master_domain):
6869
# Current domain list
6970
process = exec_test_command(
@@ -86,6 +87,7 @@ def test_create_a_domain(create_master_domain):
8687
)
8788

8889

90+
@pytest.mark.smoke
8991
def test_create_domain_srv_record(domain_records_setup):
9092
domain_id = domain_records_setup[0]
9193

@@ -135,6 +137,7 @@ def test_list_srv_record(domain_records_setup):
135137
)
136138

137139

140+
@pytest.mark.smoke
138141
def test_view_domain_record(domain_records_setup):
139142
domain_id = domain_records_setup[0]
140143
record_id = domain_records_setup[1]

β€Žtests/integration/domains/test_domains_tags.py

Lines changed: 3 additions & 1 deletion
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 tests.integration.helpers import (
57
delete_tag,
68
delete_target_id,
@@ -57,7 +59,7 @@ def test_fail_to_create_slave_domain_with_invalid_tags():
5759
)
5860

5961

60-
# @pytest.mark.skip(reason="BUG 943")
62+
@pytest.mark.smoke
6163
def test_create_master_domain_with_tags():
6264
timestamp = str(int(time.time()))
6365
tag = "foo"

β€Žtests/integration/domains/test_master_domains.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def test_create_master_domain_fails_without_soa_email():
8484
assert "soa_email soa_email required when type=master" in result
8585

8686

87+
@pytest.mark.smoke
8788
def test_create_master_domain(create_master_domain):
8889
domain_id = create_master_domain
8990
assert re.search("[0-9]+", domain_id)

β€Žtests/integration/domains/test_slave_domains.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def test_create_slave_domain_fails_without_master_dns_server():
6060
)
6161

6262

63+
@pytest.mark.smoke
6364
def test_create_slave_domain(create_slave_domain):
6465
domain_id = create_slave_domain
6566
assert re.search("[0-9]+", domain_id)

β€Žtests/integration/events/test_events.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def test_print_events_usage_information():
4949
assert re.search("view.*Event View", output)
5050

5151

52+
@pytest.mark.smoke
5253
def test_list_events():
5354
process = exec_test_command(
5455
BASE_CMD + ["list", "--text", "--no-headers", "--delimiter", ","]
@@ -115,6 +116,7 @@ def test_mark_event_seen():
115116
assert re.search("[0-9]+,.*,.*,[0-9]+-[0-9][0-9]-.*,.*,[a-z]+.*", result)
116117

117118

119+
@pytest.mark.smoke
118120
def test_mark_event_read():
119121
event_id = (
120122
exec_test_command(

β€Žtests/integration/firewalls/test_firewalls.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def firewalls_setup():
4242
delete_target_id(target="firewalls", id=firewall_id)
4343

4444

45+
@pytest.mark.smoke
4546
def test_view_firewall(firewalls_setup):
4647
firewall_id = firewalls_setup
4748

@@ -78,6 +79,7 @@ def test_list_firewall(firewalls_setup):
7879
assert re.search(firewall_id + "," + FIREWALL_LABEL + ",enabled", result)
7980

8081

82+
@pytest.mark.smoke
8183
def test_create_firewall_with_minimum_required_args():
8284
timestamp = str(int(time.time()))
8385
firewall_label = "label-fw-test" + timestamp

β€Žtests/integration/image/test_plugin_image_upload.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def test_invalid_file(
6161
assert f"No file at {file_path}" in output
6262

6363

64+
@pytest.mark.smoke
6465
@pytest.mark.skipif(platform == "win32", reason="Test N/A on Windows")
6566
def test_file_upload(
6667
fake_image_file,

0 commit comments

Comments
Β (0)