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

Separate test definitions from test execution so that providers can use the definitions in their tests #1583

Merged
merged 10 commits into from
Feb 26, 2024

Conversation

thomas11
Copy link
Contributor

@thomas11 thomas11 commented Feb 12, 2024

We'd like to test providers against the examples in this repository as part of their CI process, i.e., before they are released. In order to do that, this PR separates the test suite in misc/test into test definitions and test execution. The execution part then consists of a single test method instead of one per example, which looks like this:

	for _, examples := range definitions.GetTestsForTag("azure") {
		for _, example := range examples {
			run(t, example)
		}
	}

Due to the use of subtests (r.Run()) the results are still cleanly reported and individual tests can be run.

Providers can then "github.com/pulumi/examples/misc/test/definitions" and use a similar snippet to run the same tests, but with their own configuration to use local dependencies and SDKs. See pulumi/pulumi-azure-native#3065 for an example.

There is a tag-based API to retrieve desired test definitions by programming language, provider, or both.

This PR is limited to Azure and Azure Native so far. Other providers can be added as needed.

@thomas11 thomas11 requested review from a team February 12, 2024 20:02
Copy link
Member

@mjeffryes mjeffryes left a comment

Choose a reason for hiding this comment

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

This all seems reasonable to me assuming docs team agrees.

misc/test/azure_native_test.go Outdated Show resolved Hide resolved
misc/test/examples_test.go Outdated Show resolved Hide resolved
@thomas11 thomas11 force-pushed the tkappler/separate-tests-by-provider branch from c7f4a43 to 3d57974 Compare February 14, 2024 16:36
Copy link
Member

@cnunciato cnunciato left a comment

Choose a reason for hiding this comment

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

It looks like the PR tests are "passing", but I see this in the logs:

sorry, accidentally edited - thomas11

Is this expected?

@thomas11
Copy link
Contributor Author

It looks like the PR tests are "passing", but I see this in the logs:

sorry, accidentally edited - thomas11

Is this expected?

No, sorry for the breakage. Fixed now.

@cnunciato
Copy link
Member

Looking at the list of tests, it looks like this job (which runs the Azure TS tests) didn't find any tests to run:

https://github.com/pulumi/examples/actions/runs/7919098169/job/21619086583?pr=1583

Run make specific_test_set TestSet=AzureTs
echo "running AzureTs Acceptance Tests"
running AzureTs Acceptance Tests
cd misc/test && go test -json . --timeout 4h -v -count=1 -short -parallel 40 --tags=all --run=TestAccAzureTs | gotestfmt
📦 github.com/pulumi/examples/misc/test
testing: warning: no tests to run
ok  	github.com/pulumi/examples/misc/test	0.031s [no tests to run]

However we do have Azure TS tests, as this PR shows:

https://github.com/pulumi/examples/actions/runs/7626653760/job/20773536499?pr=1565


Run make specific_test_set TestSet=AzureTs
echo "running AzureTs Acceptance Tests"
running AzureTs Acceptance Tests
cd misc/test && go test -json . --timeout 4h -v -count=1 -short -parallel 40 --tags=all --run=TestAccAzureTs | gotestfmt
📦 github.com/pulumi/examples
✅ TestAccAzureTsAppService (7m6.22s)
✅ TestAccAzureTsAppServiceDocker (4m3.78s)
✅ TestAccAzureTsArmTemplate (4m1.79s)
✅ TestAccAzureTsCallAzureSdk (3m41.63s)
✅ TestAccAzureTsFunctions (5m1.89s)
✅ TestAccAzureTsStreamAnalytics (6m53.32s)
✅ TestAccAzureTsVmScaleset (7m56.72s)
✅ TestAccAzureTsWebserver (9m8.56s)

Is there something else that needs to be done to ensure this repo continues to run all of the tests it's currently running?

@thomas11 thomas11 force-pushed the tkappler/separate-tests-by-provider branch 3 times, most recently from 3aa6b54 to 0a3442d Compare February 20, 2024 18:33
@thomas11
Copy link
Contributor Author

Looking at the list of tests, it looks like this job (which runs the Azure TS tests) didn't find any tests to run:
Is there something else that needs to be done to ensure this repo continues to run all of the tests it's currently running?

That was another bug, apologies. Fixed. I've now gone over the PR again, re-organized and cleaned it up a bunch.

@thomas11 thomas11 force-pushed the tkappler/separate-tests-by-provider branch from 0a3442d to 2add92e Compare February 22, 2024 15:38
@thomas11 thomas11 force-pushed the tkappler/separate-tests-by-provider branch from 2add92e to 9f1d92c Compare February 24, 2024 09:29
@thomas11 thomas11 merged commit 9f097a6 into master Feb 26, 2024
51 checks passed
@thomas11 thomas11 deleted the tkappler/separate-tests-by-provider branch February 26, 2024 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants