Skip to content

Commit 88e489e

Browse files
authored
Update README and workflow_dispatch (#295)
## 📝 Description updating README and workflow_dispatch remove /acctest command ## ✔️ How to Test Refer to Testing section in README **How do I run the relevant unit/integration tests?** ## 📷 Preview **If applicable, include a screenshot or code snippet of this change. Otherwise, please remove this section.**
1 parent bb0482c commit 88e489e

4 files changed

Lines changed: 58 additions & 32 deletions

File tree

.github/workflows/e2e-test-pr-command.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/e2e-test-pr.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
on:
22
pull_request:
3-
repository_dispatch:
4-
types: [acctest-command]
3+
workflow_dispatch:
4+
inputs:
5+
test_path:
6+
description: 'Enter specific test path. E.g. linode_client/test_linode_client.py, models/test_account.py'
7+
required: false
8+
sha:
9+
description: 'The hash value of the commit.'
10+
required: true
11+
pull_request_number:
12+
description: 'The number of the PR.'
13+
required: false
514

615
name: PR E2E Tests
716

817
jobs:
9-
# Maintainer has commented /acctest on a pull request
1018
integration-fork-ubuntu:
1119
runs-on: ubuntu-latest
1220
if:
13-
github.event_name == 'repository_dispatch' &&
14-
github.event.client_payload.slash_command.sha != '' &&
15-
github.event.client_payload.pull_request.head.sha == github.event.client_payload.slash_command.sha
21+
github.event_name == 'workflow_dispatch' && inputs.sha != ''
1622

1723
steps:
1824
- uses: actions-ecosystem/action-regex-match@v2
@@ -26,7 +32,7 @@ jobs:
2632
- name: Checkout PR
2733
uses: actions/checkout@v3
2834
with:
29-
ref: ${{ github.event.client_payload.slash_command.sha }}
35+
ref: ${{ inputs.sha }}
3036

3137
- name: Update system packages
3238
run: sudo apt-get update -y
@@ -47,16 +53,16 @@ jobs:
4753
env:
4854
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4955

50-
- run: make testint
56+
- run: make INTEGRATION_TEST_PATH="${{ inputs.test_path }}" testint
5157
if: ${{ steps.validate-tests.outputs.match == '' }}
5258
env:
5359
LINODE_CLI_TOKEN: ${{ secrets.LINODE_TOKEN }}
5460

55-
- uses: actions/github-script@v5
61+
- uses: actions/github-script@v6
5662
id: update-check-run
57-
if: ${{ always() }}
63+
if: ${{ inputs.pull_request_number != '' }}
5864
env:
59-
number: ${{ github.event.client_payload.pull_request.number }}
65+
number: ${{ inputs.pull_request_number }}
6066
job: ${{ github.job }}
6167
conclusion: ${{ job.status }}
6268
with:

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
PYTHON ?= python3
22

33
INTEGRATION_TEST_PATH :=
4+
TEST_CASE_COMMAND :=
5+
MODEL_COMMAND :=
6+
7+
ifdef TEST_CASE
8+
TEST_CASE_COMMAND = -k $(TEST_CASE)
9+
endif
10+
11+
ifdef TEST_MODEL
12+
MODEL_COMMAND = models/$(TEST_MODEL)
13+
endif
414

515
@PHONEY: clean
616
clean:
@@ -50,4 +60,4 @@ lint:
5060

5161
@PHONEY: testint
5262
testint:
53-
python3 -m pytest test/integration/
63+
python3 -m pytest test/integration/${INTEGRATION_TEST_PATH}${MODEL_COMMAND} ${TEST_CASE_COMMAND}

README.rst

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Contributing
101101
Tests
102102
-----
103103

104-
Tests live in the ``tests`` directory. When invoking tests, make sure you are
104+
Tests live in the ``test`` directory. When invoking tests, make sure you are
105105
in the root directory of this project. To run the full suite across all
106106
supported python versions, use tox_:
107107

@@ -133,6 +133,35 @@ from the api base url that should be returned, for example::
133133

134134
.. _tox: http://tox.readthedocs.io
135135

136+
137+
Integration Tests
138+
-----------
139+
Integration tests live in the ``test/integration`` directory.
140+
141+
Pre-requisite
142+
^^^^^^^^^^^^^^^^^
143+
Export Linode API token as `LINODE_CLI_TOKEN` before running integration tests::
144+
145+
export LINODE_TOKEN = $(your_token)
146+
147+
Running the tests
148+
^^^^^^^^^^^^^^^^^
149+
Run the tests locally using the make command. Run the entire test suite using command below::
150+
151+
make testint
152+
153+
To run a specific package, use environment variable `INTEGRATION_TEST_PATH` with `testint` command::
154+
155+
make INTEGRATION_TEST_PATH="linode_client" testint
156+
157+
To run a specific model test suite, set the environment variable `TEST_MODEL` using file name in `integration/models`::
158+
159+
make TEST_MODEL="test_account.py" testint
160+
161+
Lastly to run a specific test case use environment variable `TEST_CASE` with `testint` command::
162+
163+
make TEST_CASE=test_get_domain_record testint
164+
136165
Documentation
137166
-------------
138167

0 commit comments

Comments
 (0)