This repository comprises an example of using k6 to test TFE.
The test workflow is to create one workspace and one Terraform run based on the configuration in the terraform directory.
Install k6 based on the k6 installation document.
Deploy TFE and create an API token.
The following sections demonstrate how to perform different types of
testing. Each of the *-test.js
scripts use the logic defined in
test.js with different combinations of virtual users and
durations.
The --no-teardown
option can be used to preserve the test
organization for manual inspection.
k6 run \
--env TFE_URL="https://tfe.example.com/" \
--env TFE_API_TOKEN="abc123" \
--env TFE_EMAIL="[email protected]" \
--env TFE_ORG_NAME="smoke-test" \
./smoke-test.js
k6 run \
--env TFE_URL="https://tfe.example.com/" \
--env TFE_API_TOKEN="abc123" \
--env TFE_EMAIL="[email protected]" \
--env TFE_ORG_NAME="load-test" \
./load-test.js
k6 run \
--env TFE_URL="https://tfe.example.com/" \
--env TFE_API_TOKEN="abc123" \
--env TFE_EMAIL="[email protected]" \
--env TFE_ORG_NAME="stress-test" \
./stress-test.js
k6 run \
--env TFE_URL="https://tfe.example.com/" \
--env TFE_API_TOKEN="abc123" \
--env TFE_EMAIL="[email protected]" \
--env TFE_ORG_NAME="soak-test" \
./soak-test.js