Skip to content

Commit

Permalink
Merge branch 'dev' into test/roll_back_boto3_for_report_upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ykim-akamai authored Jan 27, 2025
2 parents 8be1d5f + 0e1f0a3 commit 6d920d9
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
run: |
timestamp=$(date +'%Y%m%d%H%M')
report_filename="${timestamp}_sdk_test_report.xml"
make testint TEST_ARGS="--junitxml=${report_filename}" TEST_SUITE="${{ github.event.inputs.test_suite }}"
make test-int TEST_ARGS="--junitxml=${report_filename}" TEST_SUITE="${{ github.event.inputs.test_suite }}"
env:
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}

Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ on:
workflow_dispatch:
inputs:
use_minimal_test_account:
description: 'Use minimal test account'
description: 'Indicate whether to use a minimal test account with limited resources for testing. Defaults to "false"'
required: false
default: 'false'
sha:
description: 'The hash value of the commit'
required: false
description: 'Specify commit hash to test. This value is mandatory to ensure the tests run against a specific commit'
required: true
default: ''
python-version:
description: 'Specify Python version to use'
description: 'Specify the Python version to use for running tests. Leave empty to use the default Python version configured in the environment'
required: false
run-eol-python-version:
description: 'Run EOL python version?'
description: 'Indicates whether to run tests using an End-of-Life (EOL) Python version. Defaults to "false". Choose "true" to include tests for deprecated Python versions'
required: false
default: 'false'
type: choice
Expand All @@ -28,8 +28,8 @@ on:
- dev

env:
DEFAULT_PYTHON_VERSION: "3.9"
EOL_PYTHON_VERSION: "3.8"
DEFAULT_PYTHON_VERSION: "3.10"
EOL_PYTHON_VERSION: "3.9"
EXIT_STATUS: 0

jobs:
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
run: |
timestamp=$(date +'%Y%m%d%H%M')
report_filename="${timestamp}_sdk_test_report.xml"
make testint TEST_ARGS="--junitxml=${report_filename}"
make test-int TEST_ARGS="--junitxml=${report_filename}"
env:
LINODE_TOKEN: ${{ env.LINODE_TOKEN }}

Expand Down Expand Up @@ -197,7 +197,7 @@ jobs:
notify-slack:
runs-on: ubuntu-latest
needs: [integration-tests]
if: ${{ (success() || failure()) && github.repository == 'linode/linode_api4-python' }} # Run even if integration tests fail and only on main repository
if: ${{ (success() || failure()) }} # Run even if integration tests fail and only on main repository
steps:
- name: Notify Slack
uses: slackapi/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Run smoke tests
id: smoke_tests
run: |
make smoketest
make test-smoke
env:
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}

Expand Down
41 changes: 14 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,29 +1,9 @@
PYTHON ?= python3

TEST_CASE_COMMAND :=
TEST_SUITE :=
TEST_ARGS :=

LINODE_SDK_VERSION ?= "0.0.0.dev"
VERSION_MODULE_DOCSTRING ?= \"\"\"\nThe version of this linode_api4 package.\n\"\"\"\n\n
VERSION_FILE := ./linode_api4/version.py

ifdef TEST_CASE
TEST_CASE_COMMAND = -k $(TEST_CASE)
endif

ifdef TEST_SUITE
ifneq ($(TEST_SUITE),linode_client)
ifneq ($(TEST_SUITE),login_client)
TEST_COMMAND = models/$(TEST_SUITE)
else
TEST_COMMAND = login_client
endif
else
TEST_COMMAND = linode_client
endif
endif

.PHONY: clean
clean:
mkdir -p dist
Expand Down Expand Up @@ -73,14 +53,21 @@ lint: build
$(PYTHON) -m pylint linode_api4
$(PYTHON) -m twine check dist/*

.PHONY: testint
testint:
$(PYTHON) -m pytest test/integration/${TEST_COMMAND} ${TEST_CASE_COMMAND} ${TEST_ARGS}
# Integration Test Arguments
# TEST_SUITE: Optional, specify a test suite (e.g. domain), Default to run everything if not set
# TEST_CASE: Optional, specify a test case (e.g. 'test_image_replication')
# TEST_ARGS: Optional, additional arguments for pytest (e.g. '-v' for verbose mode)

TEST_COMMAND = $(if $(TEST_SUITE),$(if $(filter $(TEST_SUITE),linode_client login_client),$(TEST_SUITE),models/$(TEST_SUITE)))

.PHONY: test-int
test-int:
$(PYTHON) -m pytest test/integration/${TEST_COMMAND} $(if $(TEST_CASE),-k $(TEST_CASE)) ${TEST_ARGS}

.PHONY: testunit
testunit:
.PHONY: test-unit
test-unit:
$(PYTHON) -m pytest test/unit

.PHONY: smoketest
smoketest:
.PHONY: test-smoke
test-smoke:
$(PYTHON) -m pytest -m smoke test/integration
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,16 @@ Running the tests
^^^^^^^^^^^^^^^^^
Run the tests locally using the make command. Run the entire test suite using command below::

make testint
make test-int

To run a specific package/suite, use the environment variable `TEST_SUITE` using directory names in `integration/...` folder ::

make TEST_SUITE="account" testint // Runs tests in `integration/models/account` directory
make TEST_SUITE="linode_client" testint // Runs tests in `integration/linode_client` directory
make TEST_SUITE="account" test-int // Runs tests in `integration/models/account` directory
make TEST_SUITE="linode_client" test-int // Runs tests in `integration/linode_client` directory

Lastly to run a specific test case use environment variable `TEST_CASE` with `testint` command::
Lastly to run a specific test case use environment variable `TEST_CASE` with `test-int` command::

make TEST_CASE=test_get_domain_record testint
make TEST_CASE=test_get_domain_record test-int

Documentation
-------------
Expand Down
2 changes: 1 addition & 1 deletion e2e_scripts

0 comments on commit 6d920d9

Please sign in to comment.