-
Notifications
You must be signed in to change notification settings - Fork 6
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
Changes from 4 commits
d6bf39d
f8432ed
0c74c01
d4acd45
2871cac
7f932ce
4165748
4fe1c20
a80736b
58ab4fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,12 +119,18 @@ install_plugins: .pulumi/bin/pulumi | |
lint_provider: provider | ||
cd provider && golangci-lint run -c ../.golangci.yml | ||
|
||
provider: tfgen install_plugins | ||
provider: tfgen install_plugins test_provider | ||
(cd provider && go build $(PULUMI_PROVIDER_BUILD_PARALLELISM) -o $(WORKING_DIR)/bin/$(PROVIDER) -ldflags "-X $(PROJECT)/$(VERSION_PATH)=$(VERSION)#{{if .Config.providerVersion}}# -X #{{ .Config.providerVersion }}#=$(VERSION)#{{end}}#" $(PROJECT)/$(PROVIDER_PATH)/cmd/$(PROVIDER)) | ||
|
||
test: | ||
cd examples && go test -v -tags=all -parallel $(TESTPARALLELISM) -timeout 2h | ||
|
||
test_provider: tfgen | ||
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. I've tested this without tfgen dependency on pulumi-azuread, but it breaks because of go:embed files. That's really not great. I wonder if we could fix that up so that code compiles and is able to test itself even if generated files are not present yet. For now leaving this in. 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. Which 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. I think it was the bridge-metadata one. |
||
@echo "" | ||
@echo "== test_provider ===================================================================" | ||
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. 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) | ||
|
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.
This seems inverted. I generally expect that
test_provider: provider
but not vice versa.Instead of making
provider
depend ontest_provider
, can we just add a step inrun-acceptence-tests.yml
(probablyprerequisites
) that callsmake test_provider
?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.
The reasoning here is that
provider
builds a binary from go sources. Those sources better be tested first.Sad here that run-acceptance-tests.yml is duplicated N ways. I'd have to refactor it first to pull out the common bits. I can give this a look.