Skip to content
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

Add unit testing to the provider #662

Merged
merged 10 commits into from
Oct 7, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ jobs:
repo: pulumi/schema-tools
- name: Build tfgen & provider binaries
run: make provider
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
name: Check Schema is Valid
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ jobs:
repo: pulumi/schema-tools
- name: Build tfgen & provider binaries
run: make provider
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
name: Check Schema is Valid
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ jobs:
#{{- end }}#
- name: Build tfgen & provider binaries
run: make provider
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
name: Check Schema is Valid
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ jobs:
repo: pulumi/schema-tools
- name: Build tfgen & provider binaries
run: make provider
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
name: Check Schema is Valid
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ jobs:
#{{- end }}#
- name: Build tfgen & provider binaries
run: make provider
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
name: Check Schema is Valid
run: |
Expand Down
8 changes: 7 additions & 1 deletion provider-ci/internal/pkg/templates/bridged-provider/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ provider: tfgen install_plugins
test:
cd examples && go test -v -tags=all -parallel $(TESTPARALLELISM) -timeout 2h

test_provider:
@echo ""
@echo "== test_provider ==================================================================="
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the visual marker really easy to get lost in the tfgen noise.

@echo ""
cd provider && go test -v -short ./... -parallel $(TESTPARALLELISM)

tfgen: install_plugins#{{ if eq .Config.team "ecosystem" }}# upstream#{{ end }}##{{ if .Config.docsCmd }}# docs#{{ end }}#
(cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(TFGEN) -ldflags "-X $(PROJECT)/$(VERSION_PATH)=$(VERSION)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(TFGEN))
PATH=${PWD}/.pulumi/bin:$$PATH PULUMI_CONVERT=$(PULUMI_CONVERT) $(WORKING_DIR)/bin/$(TFGEN) schema --out provider/cmd/$(PROVIDER)
Expand Down Expand Up @@ -180,4 +186,4 @@ ci-mgmt: .ci-mgmt.yaml
@mkdir -p .pulumi
@cd provider && go list -f "{{slice .Version 1}}" -m github.com/pulumi/pulumi/pkg/v3 | tee ../$@

.PHONY: development build build_sdks install_go_sdk install_java_sdk install_python_sdk install_sdks only_build build_dotnet build_go build_java build_nodejs build_python clean cleanup#{{ if .Config.docsCmd }}# docs#{{end}}# help install_dotnet_sdk install_nodejs_sdk install_plugins lint_provider provider test tfgen#{{ if eq .Config.team "ecosystem" }}# upstream upstream.finalize upstream.rebase#{{end}}# ci-mgmt
.PHONY: development build build_sdks install_go_sdk install_java_sdk install_python_sdk install_sdks only_build build_dotnet build_go build_java build_nodejs build_python clean cleanup#{{ if .Config.docsCmd }}# docs#{{end}}# help install_dotnet_sdk install_nodejs_sdk install_plugins lint_provider provider test tfgen#{{ if eq .Config.team "ecosystem" }}# upstream upstream.finalize upstream.rebase#{{end}}# ci-mgmt test_provider
2 changes: 2 additions & 0 deletions provider-ci/test-workflows/aws/.github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ jobs:
repo: pulumi/schema-tools
- name: Build tfgen & provider binaries
run: make provider
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
name: Check Schema is Valid
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ jobs:
repo: pulumi/schema-tools
- name: Build tfgen & provider binaries
run: make provider
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
name: Check Schema is Valid
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ jobs:
tool-cache: false
- name: Build tfgen & provider binaries
run: make provider
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
name: Check Schema is Valid
run: |
Expand Down
2 changes: 2 additions & 0 deletions provider-ci/test-workflows/aws/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ jobs:
repo: pulumi/schema-tools
- name: Build tfgen & provider binaries
run: make provider
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
name: Check Schema is Valid
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ jobs:
tool-cache: false
- name: Build tfgen & provider binaries
run: make provider
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
name: Check Schema is Valid
run: |
Expand Down
8 changes: 7 additions & 1 deletion provider-ci/test-workflows/aws/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ provider: tfgen install_plugins
test:
cd examples && go test -v -tags=all -parallel $(TESTPARALLELISM) -timeout 2h

test_provider:
@echo ""
@echo "== test_provider ==================================================================="
@echo ""
cd provider && go test -v -short ./... -parallel $(TESTPARALLELISM)

tfgen: install_plugins upstream
(cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(TFGEN) -ldflags "-X $(PROJECT)/$(VERSION_PATH)=$(VERSION)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(TFGEN))
PATH=${PWD}/.pulumi/bin:$$PATH PULUMI_CONVERT=$(PULUMI_CONVERT) $(WORKING_DIR)/bin/$(TFGEN) schema --out provider/cmd/$(PROVIDER)
Expand Down Expand Up @@ -160,4 +166,4 @@ ci-mgmt: .ci-mgmt.yaml
@mkdir -p .pulumi
@cd provider && go list -f "{{slice .Version 1}}" -m github.com/pulumi/pulumi/pkg/v3 | tee ../$@

.PHONY: development build build_sdks install_go_sdk install_java_sdk install_python_sdk install_sdks only_build build_dotnet build_go build_java build_nodejs build_python clean cleanup help install_dotnet_sdk install_nodejs_sdk install_plugins lint_provider provider test tfgen upstream upstream.finalize upstream.rebase ci-mgmt
.PHONY: development build build_sdks install_go_sdk install_java_sdk install_python_sdk install_sdks only_build build_dotnet build_go build_java build_nodejs build_python clean cleanup help install_dotnet_sdk install_nodejs_sdk install_plugins lint_provider provider test tfgen upstream upstream.finalize upstream.rebase ci-mgmt test_provider
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ jobs:
repo: pulumi/schema-tools
- name: Build tfgen & provider binaries
run: make provider
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
name: Check Schema is Valid
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ jobs:
repo: pulumi/schema-tools
- name: Build tfgen & provider binaries
run: make provider
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
name: Check Schema is Valid
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ jobs:
repo: pulumi/schema-tools
- name: Build tfgen & provider binaries
run: make provider
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
name: Check Schema is Valid
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ jobs:
repo: pulumi/schema-tools
- name: Build tfgen & provider binaries
run: make provider
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
name: Check Schema is Valid
run: |
Expand Down
8 changes: 7 additions & 1 deletion provider-ci/test-workflows/cloudflare/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ provider: tfgen install_plugins
test:
cd examples && go test -v -tags=all -parallel $(TESTPARALLELISM) -timeout 2h

test_provider:
@echo ""
@echo "== test_provider ==================================================================="
@echo ""
cd provider && go test -v -short ./... -parallel $(TESTPARALLELISM)

tfgen: install_plugins upstream
(cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(TFGEN) -ldflags "-X $(PROJECT)/$(VERSION_PATH)=$(VERSION)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(TFGEN))
PATH=${PWD}/.pulumi/bin:$$PATH PULUMI_CONVERT=$(PULUMI_CONVERT) $(WORKING_DIR)/bin/$(TFGEN) schema --out provider/cmd/$(PROVIDER)
Expand Down Expand Up @@ -148,4 +154,4 @@ ci-mgmt: .ci-mgmt.yaml
@mkdir -p .pulumi
@cd provider && go list -f "{{slice .Version 1}}" -m github.com/pulumi/pulumi/pkg/v3 | tee ../$@

.PHONY: development build build_sdks install_go_sdk install_java_sdk install_python_sdk install_sdks only_build build_dotnet build_go build_java build_nodejs build_python clean cleanup help install_dotnet_sdk install_nodejs_sdk install_plugins lint_provider provider test tfgen upstream upstream.finalize upstream.rebase ci-mgmt
.PHONY: development build build_sdks install_go_sdk install_java_sdk install_python_sdk install_sdks only_build build_dotnet build_go build_java build_nodejs build_python clean cleanup help install_dotnet_sdk install_nodejs_sdk install_plugins lint_provider provider test tfgen upstream upstream.finalize upstream.rebase ci-mgmt test_provider
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ jobs:
repo: pulumi/schema-tools
- name: Build tfgen & provider binaries
run: make provider
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
name: Check Schema is Valid
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ jobs:
repo: pulumi/schema-tools
- name: Build tfgen & provider binaries
run: make provider
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
name: Check Schema is Valid
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ jobs:
repo: pulumi/schema-tools
- name: Build tfgen & provider binaries
run: make provider
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
name: Check Schema is Valid
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ jobs:
repo: pulumi/schema-tools
- name: Build tfgen & provider binaries
run: make provider
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
name: Check Schema is Valid
run: |
Expand Down
8 changes: 7 additions & 1 deletion provider-ci/test-workflows/docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ provider: tfgen install_plugins
test:
cd examples && go test -v -tags=all -parallel $(TESTPARALLELISM) -timeout 2h

test_provider:
@echo ""
@echo "== test_provider ==================================================================="
@echo ""
cd provider && go test -v -short ./... -parallel $(TESTPARALLELISM)

tfgen: install_plugins upstream docs
(cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(TFGEN) -ldflags "-X $(PROJECT)/$(VERSION_PATH)=$(VERSION)" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(TFGEN))
PATH=${PWD}/.pulumi/bin:$$PATH PULUMI_CONVERT=$(PULUMI_CONVERT) $(WORKING_DIR)/bin/$(TFGEN) schema --out provider/cmd/$(PROVIDER)
Expand Down Expand Up @@ -150,4 +156,4 @@ ci-mgmt: .ci-mgmt.yaml
@mkdir -p .pulumi
@cd provider && go list -f "{{slice .Version 1}}" -m github.com/pulumi/pulumi/pkg/v3 | tee ../$@

.PHONY: development build build_sdks install_go_sdk install_java_sdk install_python_sdk install_sdks only_build build_dotnet build_go build_java build_nodejs build_python clean cleanup docs help install_dotnet_sdk install_nodejs_sdk install_plugins lint_provider provider test tfgen upstream upstream.finalize upstream.rebase ci-mgmt
.PHONY: development build build_sdks install_go_sdk install_java_sdk install_python_sdk install_sdks only_build build_dotnet build_go build_java build_nodejs build_python clean cleanup docs help install_dotnet_sdk install_nodejs_sdk install_plugins lint_provider provider test tfgen upstream upstream.finalize upstream.rebase ci-mgmt test_provider