Skip to content

Commit

Permalink
test: Update smoke test coverage and improve nightly test workflow (#637
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ykim-akamai authored Sep 26, 2024
1 parent e7efcea commit 9d99566
Show file tree
Hide file tree
Showing 9 changed files with 160 additions and 11 deletions.
68 changes: 67 additions & 1 deletion .github/workflows/e2e-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
- dev

jobs:
integration-tests:
integration_tests:
name: Run integration tests on Ubuntu
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && inputs.sha != '' || github.event_name == 'push' || github.event_name == 'pull_request'
Expand Down Expand Up @@ -167,3 +167,69 @@ jobs:
conclusion: process.env.conclusion
});
return result;
notify-slack:
runs-on: ubuntu-latest
needs: [integration_tests]
if: always() && github.repository == 'linode/linode-cli' # Run even if integration tests fail and only on main repository

steps:
- name: Notify Slack
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.integration_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 }}
75 changes: 73 additions & 2 deletions .github/workflows/nightly-smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,25 @@ 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-cli' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: dev
fetch-depth: 0
submodules: 'recursive'
ref: ${{ github.event.inputs.sha || github.ref }}

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

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

- name: Notify Slack
if: always() && github.repository == 'linode/linode-cli' # Run even if integration tests fail and only on main repository
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 }}
3 changes: 2 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,8 @@ disable=raw-checker-failed,
duplicate-code,
too-few-public-methods,
too-many-instance-attributes,
use-symbolic-message-instead
use-symbolic-message-instead,
too-many-positional-arguments

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
5 changes: 1 addition & 4 deletions tests/integration/domains/test_slave_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,4 @@ def test_update_slave_domain(slave_domain_setup):
]
)

assert (
result.returncode == SUCCESS_STATUS_CODE,
"Failed to update slave domain",
)
assert result.returncode == SUCCESS_STATUS_CODE
3 changes: 3 additions & 0 deletions tests/integration/linodes/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import subprocess
from typing import List

import pytest

env = os.environ.copy()
env["COLUMNS"] = "200"

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


# verifying the DC pricing changes along with types
@pytest.mark.smoke
def test_linode_type():
process = exec_test_command(["linode-cli", "linodes", "types"])
output = process.stdout.decode()
Expand Down
9 changes: 7 additions & 2 deletions tests/integration/longview/test_longview.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,23 @@
BASE_CMD = ["linode-cli", "longview"]


@pytest.mark.smoke
def test_create_longview_client():
new_label = str(time.time_ns()) + "label"
exec_test_command(
result = exec_test_command(
BASE_CMD
+ [
"create",
"--label",
new_label,
"--text",
"--no-headers",
"--delimiter",
",",
]
)
).stdout.decode()

assert new_label in result


def test_longview_client_list():
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/regions/test_plugin_region_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def test_regions_list():
assert_headers_in_lines(headers, lines)


@pytest.mark.smoke
def test_regions_list_avail():
res = (
exec_test_command(BASE_CMD + ["list-avail", "--text", "--delimiter=,"])
Expand Down Expand Up @@ -78,6 +79,7 @@ def get_region_id():
yield first_id


@pytest.mark.smoke
def test_regions_view(get_region_id):
region_id = get_region_id
res = (
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/vpc/test_vpc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import re
import time

import pytest

from linodecli.exit_codes import ExitCodes
from tests.integration.conftest import get_regions_with_capabilities
from tests.integration.helpers import (
Expand Down Expand Up @@ -35,6 +37,7 @@ def test_view_vpc(test_vpc_wo_subnet):
assert vpc_id in res


@pytest.mark.smoke
def test_update_vpc(test_vpc_wo_subnet):
vpc_id = test_vpc_wo_subnet

Expand Down Expand Up @@ -120,6 +123,7 @@ def test_view_subnet(test_vpc_wo_subnet, test_subnet):
assert vpc_subnet_id in output


@pytest.mark.smoke
def test_update_subnet(test_vpc_w_subnet):
vpc_id = test_vpc_w_subnet

Expand Down

0 comments on commit 9d99566

Please sign in to comment.