Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
PYTHON ?= python3

INTEGRATION_TEST_PATH :=
TEST_CASE_COMMAND :=
MODEL_COMMAND :=
TEST_SUITE :=

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)
TEST_CASE_COMMAND = -k $(TEST_CASE)
endif

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

.PHONY: clean
Expand Down Expand Up @@ -67,7 +70,7 @@ lint: build

.PHONY: testint
testint:
$(PYTHON) -m pytest test/integration/${INTEGRATION_TEST_PATH}${MODEL_COMMAND} ${TEST_CASE_COMMAND}
$(PYTHON) -m pytest test/integration/${TEST_COMMAND} ${TEST_CASE_COMMAND}

.PHONY: testunit
testunit:
Expand Down
9 changes: 3 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,10 @@ Run the tests locally using the make command. Run the entire test suite using co

make testint

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

make INTEGRATION_TEST_PATH="linode_client" testint

To run a specific model test suite, set the environment variable `TEST_MODEL` using file name in `integration/models`::

make TEST_MODEL="test_account.py" testint
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

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

Expand Down
5 changes: 4 additions & 1 deletion test/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,11 @@ def test_firewall(test_linode_client):
"inbound_policy": "ACCEPT",
}

timestamp = str(time.time_ns())
label = "firewall_" + timestamp

firewall = client.networking.firewall_create(
"test-firewall", rules=rules, status="enabled"
label=label, rules=rules, status="enabled"
)

yield firewall
Expand Down