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
17 changes: 13 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CHAINSAW ?= chainsaw

TEST_DIR := tests
VALUES ?= infra/kind/values-basic-go.yaml
VALUES ?=
ASSERT_TIMEOUT ?= 15m
CHAINSAW_EXTRA_FLAGS ?=

Expand All @@ -23,7 +23,7 @@ help: ## Show available targets
@echo "test framework targets:"
@echo ""
@echo " tests:"
@echo " * values via VALUES (default infra/kind/values-basic-go.yaml)"
@echo " * values via VALUES (required; e.g. VALUES=../metal-lab/values-containerlab-node1.yaml)"
@echo " * assert timeout via ASSERT_TIMEOUT (default 15m; e.g. ASSERT_TIMEOUT=5m)"
@echo " * extra chainsaw flags via CHAINSAW_EXTRA_FLAGS (e.g. CHAINSAW_EXTRA_FLAGS=\"--skip-delete -v\")"
@echo ""
Expand All @@ -39,10 +39,19 @@ help: ## Show available targets
@echo " test/09-persistent-boot-order (persistent boot order)"
@echo ""

.PHONY: require-values
require-values:
@test -n "$(VALUES)" || { \
echo "VALUES is not set. Pass a chainsaw values file, e.g."; \
echo " make $(MAKECMDGOALS) VALUES=/path/to/values.yaml"; \
echo "See README.md for the expected contents."; \
exit 1; \
}

.PHONY: test $(addprefix test/,$(TESTS))

test: ## Run every test
test: require-values ## Run every test
$(CHAINSAW_RUN) $(addprefix $(TEST_DIR)/,$(TESTS))

$(addprefix test/,$(TESTS)): test/%: ## Run a single test
$(addprefix test/,$(TESTS)): test/%: require-values ## Run a single test
$(CHAINSAW_RUN) $(TEST_DIR)/$*
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ The `tests` directory contains a suite of tests based on [chainsaw](https://kyve
* A metal-operator installation and BMC to run tests against. This repository usually uses the locally virtualised [metal-lab](https://github.com/simontesar/metal-lab) to develop or verify functionality of the actual tests. You can use the lab setup as a reference.

### Usage
The server to run a test against is configured by passing a values file to chainsaw. The default file is `infra/kind/values-basic-go.yaml` which points to a Redfish mock setup in the [`kind` environment](environments.md) and should be overridden via `VALUES`.
The server to run a test against is configured by passing a values file to chainsaw via `VALUES`. There is no default, tests fail unless `VALUES` is set. To just see the suite run, use `infra/kind/values-basic-go.yaml`, which points to a Redfish mock setup in the [`kind` environment](environments.md).

```bash
# Examples
make test # Run all tests
make test/01-bmc-registration # Run a specific test
make test VALUES=infra/kind/values-basic-go.yaml # Run all tests
make test/01-bmc-registration VALUES=infra/kind/values-basic-go.yaml # Run a specific test
make test/03-power-annotation VALUES=/path/to/metal-lab/values-containerlab-node1.yaml # Run against a specific BMC
```

Expand Down
Loading