diff --git a/Makefile b/Makefile index aefc77971..1e77cebdb 100644 --- a/Makefile +++ b/Makefile @@ -169,7 +169,7 @@ test_provider:: PATH := $(WORKING_DIR)/bin:$(PATH) test_provider:: awsx/node_modules bin/${PROVIDER} cd awsx && yarn test @export PATH - cd provider && go test -v -json -count=1 -cover -timeout 3h -parallel ${TESTPARALLELISM} . 2>&1 | tee /tmp/gotest.log | gotestfmt + cd provider && go test -tags=yaml -v -json -count=1 -cover -timeout 3h -parallel ${TESTPARALLELISM} . 2>&1 | tee /tmp/gotest.log | gotestfmt istanbul_tests:: cd awsx-classic/tests && \ @@ -178,26 +178,31 @@ istanbul_tests:: test_nodejs:: PATH := $(WORKING_DIR)/bin:$(PATH) test_nodejs:: bin/${PROVIDER} install_nodejs_sdk @export PATH + cd provider && go test -tags=nodejs -v -json -count=1 -cover -timeout 3h -parallel ${TESTPARALLELISM} . 2>&1 | tee /tmp/gotest.log | gotestfmt cd examples && go test -tags=nodejs -v -json -count=1 -cover -timeout 3h -parallel ${TESTPARALLELISM} . 2>&1 | tee /tmp/gotest.log | gotestfmt test_python:: PATH := $(WORKING_DIR)/bin:$(PATH) test_python:: bin/${PROVIDER} @export PATH + cd provider && go test -tags=python -v -json -count=1 -cover -timeout 3h -parallel ${TESTPARALLELISM} . 2>&1 | tee /tmp/gotest.log | gotestfmt cd examples && go test -tags=python -v -json -count=1 -cover -timeout 3h -parallel ${TESTPARALLELISM} . 2>&1 | tee /tmp/gotest.log | gotestfmt test_java:: PATH := $(WORKING_DIR)/bin:$(PATH) test_java:: bin/${PROVIDER} @export PATH + cd provider && go test -tags=java -v -json -count=1 -cover -timeout 3h -parallel ${TESTPARALLELISM} . 2>&1 | tee /tmp/gotest.log | gotestfmt cd examples && go test -tags=java -v -json -count=1 -cover -timeout 3h -parallel ${TESTPARALLELISM} . 2>&1 | tee /tmp/gotest.log | gotestfmt test_go:: PATH := $(WORKING_DIR)/bin:$(PATH) test_go:: bin/${PROVIDER} @export PATH + cd provider && go test -tags=go -v -json -count=1 -cover -timeout 3h -parallel ${TESTPARALLELISM} . 2>&1 | tee /tmp/gotest.log | gotestfmt cd examples && go test -tags=go -v -json -count=1 -cover -timeout 3h -parallel ${TESTPARALLELISM} . 2>&1 | tee /tmp/gotest.log | gotestfmt test_dotnet:: PATH := $(WORKING_DIR)/bin:$(PATH) test_dotnet:: bin/${PROVIDER} install_dotnet_sdk @export PATH + cd provider && go test -tags=dotnet -v -json -count=1 -cover -timeout 3h -parallel ${TESTPARALLELISM} . 2>&1 | tee /tmp/gotest.log | gotestfmt cd examples && go test -tags=dotnet -v -json -count=1 -cover -timeout 3h -parallel ${TESTPARALLELISM} . 2>&1 | tee /tmp/gotest.log | gotestfmt test:: PATH := $(WORKING_DIR)/bin:$(PATH) diff --git a/provider/provider_nodejs_test.go b/provider/provider_nodejs_test.go new file mode 100644 index 000000000..45940813a --- /dev/null +++ b/provider/provider_nodejs_test.go @@ -0,0 +1,87 @@ +//go:build !go && !yaml && !python && !java && !dotnet +// +build !go,!yaml,!python,!java,!dotnet + +// Copyright 2016-2023, Pulumi Corporation. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package provider + +import ( + "path/filepath" + "testing" + + "github.com/pulumi/providertest" +) + +// Quick tests to validate the provider behavior against the example programs. +// +// Of specific interest are upgrade tests that check for lack of replacements when upgrading stacks +// from a baseline to the current version of the provider. +func TestExamples(t *testing.T) { + t.Skipf("Skip temporarily") + + examples := []string{ + "ts-nlb-simple", + + // Skipping because recording locally keeps timing out after 20 min; should be possible though? + // "ts-lb-simple", + + // Skipping because it does not work on pre-2.x versions, so upgrade tests cannot run. + // "ts-vpc-getDefaultVpc", // Property 'vpc' does not exist + // "ts-ecr-simple", + + // Still need to try recording these: + // + // "ts-lb-with-subnets", + // "ts-lb-attach-lambda", + // "ts-lb-attach-ec2", + + // NOTE: the automatically picked recording example will be "nodejs" which conflicts + // with "cloudtrail/nodejs", this needs to be fixed in providertests. + "ecs/nodejs", + + "cloudtrail/nodejs", + + // "vpc/nodejs/custom-provider", + // "vpc/nodejs/specific-vpc-layout", + // "vpc/nodejs/vpc-with-service-endpoint", + "vpc/nodejs/default-args", + // "vpc/nodejs/vpc-multiple-similar-subnet-types", + // "vpc/nodejs/vpc-subnets-with-tags", + } + + for _, ex := range examples { + dir := filepath.Join("..", "examples", ex) + t.Run(ex, test(dir).Run) + } + +} + +func test(dir string, opts ...providertest.Option) *providertest.ProviderTest { + opts = append(opts, + providertest.WithProviderName("awsx"), + + providertest.WithSkippedUpgradeTestMode( + providertest.UpgradeTestMode_Quick, + "Quick mode is only supported for providers written in Go at the moment"), + + providertest.WithBaselineVersion("1.0.6"), + + providertest.WithExtraBaselineDependencies(map[string]string{ + "aws": "5.42.0", + }), + ) + + return providertest.NewProviderTest(dir, opts...) +} diff --git a/provider/provider_test.go b/provider/provider_test.go index d20ceaaf0..161a01ae3 100644 --- a/provider/provider_test.go +++ b/provider/provider_test.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -15,72 +15,11 @@ package provider import ( - "path/filepath" "testing" "github.com/pulumi/providertest" ) -// Quick tests to validate the provider behavior against the example programs. -// -// Of specific interest are upgrade tests that check for lack of replacements when upgrading stacks -// from a baseline to the current version of the provider. -func TestExamples(t *testing.T) { - examples := []string{ - "ts-nlb-simple", - - // Skipping because recording locally keeps timing out after 20 min; should be possible though? - // "ts-lb-simple", - - // Skipping because it does not work on pre-2.x versions, so upgrade tests cannot run. - // "ts-vpc-getDefaultVpc", // Property 'vpc' does not exist - // "ts-ecr-simple", - - // Still need to try recording these: - // - // "ts-lb-with-subnets", - // "ts-lb-attach-lambda", - // "ts-lb-attach-ec2", - - // NOTE: the automatically picked recording example will be "nodejs" which conflicts - // with "cloudtrail/nodejs", this needs to be fixed in providertests. - "ecs/nodejs", - - "cloudtrail/nodejs", - - // "vpc/nodejs/custom-provider", - // "vpc/nodejs/specific-vpc-layout", - // "vpc/nodejs/vpc-with-service-endpoint", - "vpc/nodejs/default-args", - // "vpc/nodejs/vpc-multiple-similar-subnet-types", - // "vpc/nodejs/vpc-subnets-with-tags", - } - - for _, ex := range examples { - dir := filepath.Join("..", "examples", ex) - t.Run(ex, test(dir).Run) - } - -} - -func test(dir string, opts ...providertest.Option) *providertest.ProviderTest { - opts = append(opts, - providertest.WithProviderName("awsx"), - - providertest.WithSkippedUpgradeTestMode( - providertest.UpgradeTestMode_Quick, - "Quick mode is only supported for providers written in Go at the moment"), - - providertest.WithBaselineVersion("1.0.6"), - - providertest.WithExtraBaselineDependencies(map[string]string{ - "aws": "5.42.0", - }), - ) - - return providertest.NewProviderTest(dir, opts...) -} - func TestReportUpgradeCoverage(t *testing.T) { providertest.ReportUpgradeCoverage(t) }