Skip to content

feat: Migrate to Terratest #109

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

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d5f53b3
Run terratest instead
mitch-hamm Mar 19, 2025
58767a6
Update acctest.yml
mitch-hamm Mar 19, 2025
c2728ea
Update acctest.yml
mitch-hamm Mar 19, 2025
72e576a
Update acctest.yml
mitch-hamm Mar 19, 2025
8b10c86
Update acctest.yml
mitch-hamm Mar 19, 2025
7137ef3
Update acctest.yml
mitch-hamm Mar 19, 2025
ad64e60
Update acctest.yml
mitch-hamm Mar 19, 2025
f64ae23
Update acctest.yml
mitch-hamm Mar 19, 2025
397f9f9
Update acctest.yml
mitch-hamm Mar 19, 2025
e654bc3
Update acctest.yml
mitch-hamm Mar 19, 2025
2e8967a
Update acctest.yml
mitch-hamm Mar 19, 2025
9ed9245
Update acctest.yml
mitch-hamm Mar 19, 2025
6cb522f
Update acctest.yml
mitch-hamm Mar 19, 2025
c44bcb7
Update acctest.yml
mitch-hamm Mar 19, 2025
d3756f8
Update acctest.yml
mitch-hamm Mar 19, 2025
dcfe1a4
Fix test
mitch-hamm Mar 19, 2025
d29cba8
Update instance type
mitch-hamm Mar 19, 2025
dd63c77
Update acctest.yml
mitch-hamm Mar 19, 2025
c988f1f
Merge branch 'main' into mh/terratest
mitch-hamm Mar 19, 2025
60e5a22
Update contributing
mitch-hamm Mar 19, 2025
44e9149
Streamline output validation
mitch-hamm Mar 20, 2025
47b43f5
Update tests
mitch-hamm Mar 20, 2025
2a6f538
Add remainder of tests and remove old ones
mitch-hamm Mar 21, 2025
a26d3e9
Update main.tf
mitch-hamm Mar 21, 2025
f14f731
update
mitch-hamm Mar 21, 2025
2553b1c
Update test, add sleep to PC read loop
mitch-hamm Mar 21, 2025
e76407a
Fix apikey data
mitch-hamm Mar 24, 2025
833c220
Merge branch 'main' into mh/terratest
mitch-hamm Mar 31, 2025
61c805b
Merge branch 'main' into mh/terratest
mitch-hamm May 7, 2025
8027c33
Update go mod
mitch-hamm May 7, 2025
d936d45
Update gomod
mitch-hamm May 7, 2025
5205eb6
update test
mitch-hamm May 7, 2025
c3aaed5
Run PC tests in sequence
mitch-hamm May 7, 2025
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: 7 additions & 8 deletions .github/workflows/acctest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,14 @@ jobs:
terraform_version: 1.5.7
terraform_wrapper: false

- name: Build the terraform-provider-streamnative
run: |
make build
mkdir -p $HOME/.terraform.d/plugins/linux_amd64
sudo mv terraform-provider-streamnative $HOME/.terraform.d/plugins/linux_amd64/
echo "The terraform-provider-streamnative location:" `readlink -f $HOME/.terraform.d/plugins/linux_amd64/`

- name: Run Acceptance Tests for the Provider
run: |
touch $HOME/.terraformrc
echo "provider_installation {
dev_overrides {
\"terraform.local/local/streamnative\" = \"$HOME/go/bin\"
}
}" > $HOME/.terraformrc
echo $ACC_TEST_SERVICE_ACCOUNT > $HOME/service_account.json
export KEY_FILE_PATH=$HOME/service_account.json
make testacc
make terratest
6 changes: 0 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,9 @@ If you would like to contribute code to this project, fork the repository and se
- Add the following into the file
```
provider_installation {

dev_overrides {
"terraform.local/local/streamnative" = "/Users/<Username>/go/bin" #Or your GOBIN if it's defined as a different path
}

# For all other providers, install them directly from their origin provider
# registries as normal. If you omit this, Terraform will _only_ use
# the dev_overrides block, and so no other providers will be available.
direct {}
}
```
- Run `go install .` in the provider root
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ build-dev: build
testacc: fmtcheck
TF_ACC=1 go test $(TEST) -v -count 1 $(TESTARGS) -timeout 120m

terratest: fmtcheck
go install .
go test -v ./tests/... -v -count 1 -timeout 120m -failfast

fmt:
@echo "==> Fixing source code with gofmt..."
@gofmt -s -w cloud
Expand Down
174 changes: 0 additions & 174 deletions cloud/apikey_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion cloud/data_source_apikey.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func DataSourceApiKeyRead(ctx context.Context, d *schema.ResourceData, meta inte
return diag.FromErr(fmt.Errorf("ERROR_SET_READY: %w", err))
}
privateKey := d.Get("private_key")
if apiKey.Status.EncryptedToken.JWE != nil && privateKey != nil {
if apiKey.Status.EncryptedToken.JWE != nil && privateKey != nil && privateKey != "" {
data, err := base64.StdEncoding.DecodeString(d.Get("private_key").(string))
if err != nil {
return diag.FromErr(fmt.Errorf("ERROR_DECODE_PRIVATE_KEY: %w", err))
Expand Down
3 changes: 2 additions & 1 deletion cloud/data_source_pulsar_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ package cloud
import (
"context"
"fmt"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"strings"

apierrors "k8s.io/apimachinery/pkg/api/errors"

"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
56 changes: 0 additions & 56 deletions cloud/provider_test.go

This file was deleted.

Loading
Loading