-
Couldn't load subscription status.
- Fork 0
feat: Environments #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
f30e16e
feat: Environments
zacharyblasczyk b0e9236
feat: Environments
zacharyblasczyk 23941af
generate
zacharyblasczyk 51ef061
Environments and Resource Filters
zacharyblasczyk af801bc
WIP system tests
zacharyblasczyk 5e4975a
WIP system tests
zacharyblasczyk 3f63be1
a lot more working tests
zacharyblasczyk 020d0f5
fix the system tests
zacharyblasczyk f8d0ece
refactor
zacharyblasczyk 020d56d
adding one more test that will need to change when we have crud
zacharyblasczyk 8210ef4
fix lint
zacharyblasczyk 5053f45
fix the base_url
zacharyblasczyk 823016a
fix the url
zacharyblasczyk 0acf236
fix: makes the tests idempotent
zacharyblasczyk 35975fe
fix the last not idempotent test
zacharyblasczyk db1da25
more idepotent tests
zacharyblasczyk 69e024c
fix: Make more tests idempotent
zacharyblasczyk 6a5574a
Final test I think :corssing-fingers: let the idempotent tests pass p…
zacharyblasczyk 04d99b7
fix the last test ran 100 of them locally with this change
zacharyblasczyk 6dde48f
adding back terraform-registry-manifest.json
zacharyblasczyk a00aaca
test
zacharyblasczyk fda0760
only support versions that have sec support
zacharyblasczyk fda5dc4
only support versions that have sec support
zacharyblasczyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Required environment variables for running acceptance tests | ||
| CTRLPLANE_PROVIDER_TESTING_API_KEY=your_api_key_here | ||
| CTRLPLANE_PROVIDER_TESTING_WORKSPACE=your_workspace_here | ||
| CTRLPLANE_PROVIDER_TESTING_BASE_URL=https://app.ctrlplane.dev | ||
|
|
||
| # Test configuration | ||
| TF_ACC=1 # Required for running acceptance tests | ||
| TF_LOG=DEBUG # Optional: Set to DEBUG for verbose logging during tests | ||
| TF_LOG_PATH=./terraform.log # Optional: Log file path for test output | ||
|
|
||
| # Go test configuration | ||
| GO_TEST_TIMEOUT=120m # Test timeout duration | ||
| GO_TEST_PARALLEL=4 # Number of parallel tests to run | ||
|
|
||
| # Optional test configuration | ||
| TF_ACC=1 # Set to 1 to run acceptance tests | ||
| TF_LOG=INFO # Set to DEBUG for verbose logging during tests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,19 +12,81 @@ lint: | |
| generate: | ||
| cd tools; go generate ./... | ||
|
|
||
| generate-client: | ||
| cd client; go generate ./... | ||
|
|
||
| fmt: | ||
| gofmt -s -w -e . | ||
|
|
||
| update: | ||
| go get -u ./... | ||
|
|
||
| test: | ||
| go test -v -cover -timeout=120s -parallel=10 ./... | ||
| go test -v -cover -timeout=120s -parallel=10 ./... -skip TestIntegration TestAcc | ||
|
|
||
| testacc: | ||
| TF_ACC=1 go test -v -cover -timeout 120m ./... | ||
| @if [ ! -f .env ]; then \ | ||
| echo "Error: .env file not found. Copy .env.example to .env and configure it."; \ | ||
| exit 1; \ | ||
| fi | ||
| @echo "Running acceptance tests..." | ||
| source .env && \ | ||
| TF_ACC=1 \ | ||
| CTRLPLANE_TOKEN="$${CTRLPLANE_PROVIDER_TESTING_API_KEY}" \ | ||
| CTRLPLANE_WORKSPACE="$${CTRLPLANE_PROVIDER_TESTING_WORKSPACE}" \ | ||
| CTRLPLANE_BASE_URL="$${CTRLPLANE_PROVIDER_TESTING_BASE_URL}" \ | ||
| go test \ | ||
| -timeout=$${GO_TEST_TIMEOUT:-120m} \ | ||
| -parallel=$${GO_TEST_PARALLEL:-4} \ | ||
| -cover \ | ||
| $${TEST:-./internal/provider/...} $${TESTARGS} | ||
|
|
||
| test-acceptance: | ||
| testacc-quiet: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Useful for local testing because the tests are quite noisy. |
||
| @if [ ! -f .env ]; then \ | ||
| echo "Error: .env file not found. Copy .env.example to .env and configure it."; \ | ||
| exit 1; \ | ||
| fi | ||
| @echo "Running acceptance tests with reduced verbosity..." | ||
| source .env && \ | ||
| TF_ACC=1 \ | ||
| CTRLPLANE_TOKEN=$(CTRLPLANE_PROVIDER_TESTING_API_KEY) \ | ||
| CTRLPLANE_WORKSPACE=$(CTRLPLANE_PROVIDER_TESTING_WORKSPACE) \ | ||
| go test -v -cover -timeout 120m ./... | ||
| TF_LOG=ERROR \ | ||
| CTRLPLANE_TOKEN="$${CTRLPLANE_PROVIDER_TESTING_API_KEY}" \ | ||
| CTRLPLANE_WORKSPACE="$${CTRLPLANE_PROVIDER_TESTING_WORKSPACE}" \ | ||
| CTRLPLANE_BASE_URL="$${CTRLPLANE_PROVIDER_TESTING_BASE_URL}" \ | ||
| go test \ | ||
| -timeout=$${GO_TEST_TIMEOUT:-120m} \ | ||
| -parallel=$${GO_TEST_PARALLEL:-4} \ | ||
| -cover \ | ||
| -v=0 \ | ||
| $${TEST:-./internal/provider/...} $${TESTARGS} | ||
|
|
||
| testint: | ||
| @if [ ! -f .env ]; then \ | ||
| echo "Error: .env file not found. Copy .env.example to .env and configure it."; \ | ||
| exit 1; \ | ||
| fi | ||
| @echo "Running integration tests..." | ||
| source .env && \ | ||
| INTEGRATION_TEST_MODE="$${INTEGRATION_TEST_MODE:-autocleanup}" \ | ||
| CTRLPLANE_TOKEN="$${CTRLPLANE_PROVIDER_TESTING_API_KEY}" \ | ||
| CTRLPLANE_WORKSPACE="$${CTRLPLANE_PROVIDER_TESTING_WORKSPACE}" \ | ||
| CTRLPLANE_BASE_URL="$${CTRLPLANE_PROVIDER_TESTING_BASE_URL}" \ | ||
| go run github.com/onsi/ginkgo/v2/ginkgo run -v ./internal/integration | ||
|
|
||
| testexamples: build | ||
| for dir in examples/resources/*; do \ | ||
| cd $$dir && \ | ||
| terraform init && \ | ||
| terraform plan -out=plan.tfplan && \ | ||
| terraform apply plan.tfplan -auto-approve; \ | ||
| terraform destroy -auto-approve; \ | ||
| done | ||
|
|
||
zacharyblasczyk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # Clean test artifacts | ||
| clean: | ||
| rm -f terraform.log | ||
| rm -rf .terraform | ||
| rm -f .terraform.lock.hcl | ||
| rm -f terraform.tfstate* | ||
|
|
||
| .PHONY: fmt lint test testacc build install generate | ||
| .PHONY: fmt lint test testacc testint testexamples build install generate clean install-local | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are just deprecated now and I added one for tests.