Skip to content

Commit ab2030f

Browse files
authored
Test: Add smoke test suite and workflow (#306)
## πŸ“ 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 78adef0 commit ab2030f

17 files changed

Lines changed: 68 additions & 3 deletions

β€Ž.github/workflows/e2e-test-pr.ymlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
- run: make INTEGRATION_TEST_PATH="${{ inputs.test_path }}" testint
8282
if: ${{ steps.validate-tests.outputs.match == '' }}
8383
env:
84-
LINODE_CLI_TOKEN: ${{ secrets.LINODE_TOKEN }}
84+
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}
8585

8686
- uses: actions/github-script@v6
8787
id: update-check-run
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 Python SDK
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_TOKEN: ${{ secrets.LINODE_TOKEN }}

β€ŽMakefileβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,7 @@ lint: build
6161
@PHONEY: testint
6262
testint:
6363
python3 -m pytest test/integration/${INTEGRATION_TEST_PATH}${MODEL_COMMAND} ${TEST_CASE_COMMAND}
64+
65+
@PHONEY: smoketest
66+
smoketest:
67+
pytest -m smoke test/integration --disable-warnings

β€ŽREADME.rstβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Integration tests live in the ``test/integration`` directory.
140140

141141
Pre-requisite
142142
^^^^^^^^^^^^^^^^^
143-
Export Linode API token as `LINODE_CLI_TOKEN` before running integration tests::
143+
Export Linode API token as `LINODE_TOKEN` before running integration tests::
144144

145145
export LINODE_TOKEN = $(your_token)
146146

β€Žtest/integration/linode_client/test_linode_client.pyβ€Ž

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def test_get_account(setup_client_and_linode):
4646
assert re.search("^$|[0-9]+", account.tax_id)
4747

4848

49+
@pytest.mark.smoke
4950
def test_fails_to_create_domain_without_soa_email(setup_client_and_linode):
5051
client = setup_client_and_linode[0]
5152

@@ -57,6 +58,7 @@ def test_fails_to_create_domain_without_soa_email(setup_client_and_linode):
5758
assert e.status == 400
5859

5960

61+
@pytest.mark.smoke
6062
def test_get_domains(get_client, create_domain):
6163
client = get_client
6264
domain = create_domain
@@ -67,6 +69,7 @@ def test_get_domains(get_client, create_domain):
6769
assert domain.domain in dom_list
6870

6971

72+
@pytest.mark.smoke
7073
def test_image_create(setup_client_and_linode):
7174
client = setup_client_and_linode[0]
7275
linode = setup_client_and_linode[1]
@@ -165,6 +168,7 @@ def test_create_tag_with_id(
165168
assert label in tag_label_list
166169

167170

171+
@pytest.mark.smoke
168172
def test_create_tag_with_entities(
169173
setup_client_and_linode, create_nodebalancer, create_domain, create_volume
170174
):
@@ -223,6 +227,7 @@ def test_create_linode_instance_without_image(get_client):
223227
assert res
224228

225229

230+
@pytest.mark.smoke
226231
def test_create_linode_instance_with_image(setup_client_and_linode):
227232
linode = setup_client_and_linode[1]
228233

β€Žtest/integration/linode_client/test_retry.pyβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from test.integration.conftest import get_token
22

33
import httpretty
4+
import pytest
45

56
from linode_api4 import ApiError, LinodeClient
67

@@ -36,6 +37,7 @@ def get_retry_client():
3637
return client
3738

3839

40+
@pytest.mark.smoke
3941
@httpretty.activate
4042
def test_get_retry_statuses():
4143
"""
@@ -72,7 +74,7 @@ def test_post_retry_statuses():
7274
httpretty.POST, "https://localhost/test", responses=ERROR_RESPONSES
7375
)
7476

75-
get_retry_client.post("/test")
77+
get_retry_client().post("/test")
7678

7779
assert len(httpretty.latest_requests()) == 3
7880

β€Žtest/integration/models/test_account.pyβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import time
22
from test.integration.helpers import get_test_label
33

4+
import pytest
5+
46
from linode_api4.objects import (
57
Account,
68
AccountSettings,
@@ -11,6 +13,7 @@
1113
)
1214

1315

16+
@pytest.mark.smoke
1417
def test_get_account(get_client):
1518
client = get_client
1619
account = client.account()
@@ -56,6 +59,7 @@ def test_get_account_settings(get_client):
5659
assert "object_storage" in str(account_settings._raw_json)
5760

5861

62+
@pytest.mark.smoke
5963
def test_latest_get_event(get_client):
6064
client = get_client
6165

β€Žtest/integration/models/test_domain.pyβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from linode_api4.objects import Domain, DomainRecord
88

99

10+
@pytest.mark.smoke
1011
def test_get_domain_record(get_client, create_domain):
1112
dr = DomainRecord(
1213
get_client, create_domain.records.first().id, create_domain.id

β€Žtest/integration/models/test_firewall.pyβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def create_linode_fw(get_client):
2121
linode_instance.delete()
2222

2323

24+
@pytest.mark.smoke
2425
def test_get_firewall_rules(get_client, create_firewall):
2526
firewall = get_client.load(Firewall, create_firewall.id)
2627
rules = firewall.rules
@@ -29,6 +30,7 @@ def test_get_firewall_rules(get_client, create_firewall):
2930
assert rules.outbound_policy in ["ACCEPT", "DROP"]
3031

3132

33+
@pytest.mark.smoke
3234
def test_update_firewall_rules(get_client, create_firewall):
3335
firewall = get_client.load(Firewall, create_firewall.id)
3436
new_rules = {

β€Žtest/integration/models/test_image.pyβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def image_upload(get_client):
2626
delete_instance_with_test_kw(images)
2727

2828

29+
@pytest.mark.smoke
2930
def test_get_image(get_client, image_upload):
3031
image = get_client.load(Image, image_upload.id)
3132

0 commit comments

Comments
Β (0)