Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Update smoke test coverage and improve nightly test workflow #452

Merged
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/nightly-smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
inputs:
sha:
description: 'Commit SHA to test'
required: false
default: ''
type: string


jobs:
smoke_tests:
if: github.repository == 'linode/linode_api4-python' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest

steps:
Expand All @@ -29,7 +37,70 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run smoke tests
id: smoke_tests
run: |
make smoketest
env:
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}

- name: Notify Slack
if: always()
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":rocket: *${{ github.workflow }} Completed in: ${{ github.repository }}* :white_check_mark:"
}
},
{
"type": "divider"
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Build Result:*\n${{ steps.smoke_tests.outcome == 'success' && ':large_green_circle: Build Passed' || ':red_circle: Build Failed' }}"
},
{
"type": "mrkdwn",
"text": "*Branch:*\n`${{ github.ref_name }}`"
}
]
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Commit Hash:*\n<${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>"
},
{
"type": "mrkdwn",
"text": "*Run URL:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run Details>"
}
]
},
{
"type": "divider"
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Triggered by: :bust_in_silhouette: `${{ github.actor }}`"
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

1 change: 1 addition & 0 deletions test/integration/login_client/test_login_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def test_oauth_client_two(test_linode_client):
oauth_client.delete()


@pytest.mark.smoke
def test_get_oathclient(test_linode_client, test_oauth_client):
client = test_linode_client

Expand Down
1 change: 1 addition & 0 deletions test/integration/models/lke/test_lke.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def test_get_lke_clusters(test_linode_client, lke_cluster):
assert cluster._raw_json == lke_cluster._raw_json


@pytest.mark.smoke
def test_get_lke_pool(test_linode_client, lke_cluster):
cluster = lke_cluster

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def test_create_nb_node(
assert "node_test" == node.label


@pytest.mark.smoke
def test_get_nb_node(test_linode_client, create_nb_config):
node = test_linode_client.load(
NodeBalancerNode,
Expand Down
1 change: 1 addition & 0 deletions test/integration/models/object_storage/test_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def test_bucket(
assert any(b.label == bucket.label for b in buckets)


@pytest.mark.smoke
def test_list_obj_storage_bucket(
test_linode_client: LinodeClient,
bucket: ObjectStorageBucket,
Expand Down
4 changes: 4 additions & 0 deletions test/integration/models/placement/test_placement.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import pytest

from linode_api4 import PlacementGroup


@pytest.mark.smoke
def test_get_pg(test_linode_client, create_placement_group):
"""
Tests that a Placement Group can be loaded.
Expand All @@ -9,6 +12,7 @@ def test_get_pg(test_linode_client, create_placement_group):
assert pg.id == create_placement_group.id


@pytest.mark.smoke
def test_update_pg(test_linode_client, create_placement_group):
"""
Tests that a Placement Group can be updated successfully.
Expand Down
4 changes: 4 additions & 0 deletions test/integration/models/profile/test_profile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import pytest

from linode_api4.objects import PersonalAccessToken, Profile, SSHKey


@pytest.mark.smoke
def test_user_profile(test_linode_client):
client = test_linode_client

Expand All @@ -18,6 +21,7 @@ def test_get_personal_access_token_objects(test_linode_client):
assert isinstance(personal_access_tokens[0], PersonalAccessToken)


@pytest.mark.smoke
def test_get_sshkeys(test_linode_client, test_sshkey):
client = test_linode_client

Expand Down
3 changes: 3 additions & 0 deletions test/integration/models/vpc/test_vpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
from linode_api4 import VPC, ApiError, VPCSubnet


@pytest.mark.smoke
def test_get_vpc(test_linode_client, create_vpc):
vpc = test_linode_client.load(VPC, create_vpc.id)
test_linode_client.vpcs()
assert vpc.id == create_vpc.id


@pytest.mark.smoke
def test_update_vpc(test_linode_client, create_vpc):
vpc = create_vpc
new_label = create_vpc.label + "-updated"
Expand All @@ -33,6 +35,7 @@ def test_get_subnet(test_linode_client, create_vpc_with_subnet):
assert loaded_subnet.id == subnet.id


@pytest.mark.smoke
def test_update_subnet(test_linode_client, create_vpc_with_subnet):
vpc, subnet = create_vpc_with_subnet
new_label = subnet.label + "-updated"
Expand Down