Skip to content

Commit

Permalink
chore: add message to explain why tests are skipped in short mode
Browse files Browse the repository at this point in the history
  • Loading branch information
rquitales committed Mar 12, 2024
1 parent e2daf80 commit 32862c1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion tests/sdk/dotnet/dotnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestDotnet_Basic(t *testing.T) {
}

func TestDotnet_Guestbook(t *testing.T) {
tests.SkipIfShort(t) // An external load balancer is required.
tests.SkipIfShort(t, "test creates a load balancer and requires a Cloud cluster")
test := baseOptions.With(integration.ProgramTestOptions{
Dir: "guestbook",
Quick: true,
Expand Down
25 changes: 12 additions & 13 deletions tests/sdk/nodejs/examples/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestAccMinimal(t *testing.T) {
}

func TestAccGuestbook(t *testing.T) {
tests.SkipIfShort(t)
tests.SkipIfShort(t, "test provisions a load balancer and requires a cloud provider cluster to run")
test := getBaseOptions(t).
With(integration.ProgramTestOptions{
Dir: filepath.Join(getCwd(t), "guestbook"),
Expand Down Expand Up @@ -134,7 +134,7 @@ func TestAccGuestbook(t *testing.T) {
}

func TestAccIngress(t *testing.T) {
tests.SkipIfShort(t)
tests.SkipIfShort(t, "test provisions a load balancer and requires a cloud provider cluster to run")
testNetworkingV1 := getBaseOptions(t).
With(integration.ProgramTestOptions{
Dir: filepath.Join(getCwd(t), "ingress"),
Expand Down Expand Up @@ -164,7 +164,7 @@ func TestAccIngress(t *testing.T) {
}

func TestAccHelm(t *testing.T) {
tests.SkipIfShort(t)
tests.SkipIfShort(t, "test provisions a load balancer and requires a cloud provider cluster to run")
test := getBaseOptions(t).
With(integration.ProgramTestOptions{
Dir: filepath.Join(getCwd(t), "helm", "step1"),
Expand All @@ -190,7 +190,7 @@ func TestAccHelm(t *testing.T) {
}

func TestHelmNoDefaultProvider(t *testing.T) {
tests.SkipIfShort(t)
tests.SkipIfShort(t, "test provisions a load balancer and requires a cloud provider cluster to run")
test := getBaseOptions(t).
With(integration.ProgramTestOptions{
Dir: filepath.Join(getCwd(t), "helm-no-default-provider"),
Expand All @@ -204,7 +204,7 @@ func TestHelmNoDefaultProvider(t *testing.T) {
}

func TestAccHelmApiVersions(t *testing.T) {
tests.SkipIfShort(t)
tests.SkipIfShort(t, "test provisions a load balancer and requires a cloud provider cluster to run")
test := getBaseOptions(t).
With(integration.ProgramTestOptions{
Dir: filepath.Join(getCwd(t), "helm-api-versions", "step1"),
Expand All @@ -221,7 +221,7 @@ func TestAccHelmApiVersions(t *testing.T) {
}

func TestAccHelmKubeVersion(t *testing.T) {
tests.SkipIfShort(t)
tests.SkipIfShort(t, "test provisions a load balancer and requires a cloud provider cluster to run")
test := getBaseOptions(t).
With(integration.ProgramTestOptions{
Dir: filepath.Join(getCwd(t), "helm-kube-version", "step1"),
Expand Down Expand Up @@ -263,7 +263,7 @@ func TestAccHelmAllowCRDRendering(t *testing.T) {
}

func TestAccHelmLocal(t *testing.T) {
tests.SkipIfShort(t)
tests.SkipIfShort(t, "test provisions a load balancer and requires a cloud provider cluster to run")
test := getBaseOptions(t).
With(integration.ProgramTestOptions{
Dir: filepath.Join(getCwd(t), "helm-local", "step1"),
Expand Down Expand Up @@ -307,7 +307,7 @@ func TestAccHelmLocal(t *testing.T) {
}

func TestAccPrometheusOperator(t *testing.T) {
tests.SkipIfShort(t)
tests.SkipIfShort(t, "test provisions a load balancer and requires a cloud provider cluster to run")
test := getBaseOptions(t).
With(integration.ProgramTestOptions{
Dir: filepath.Join(getCwd(t), "prometheus-operator"),
Expand Down Expand Up @@ -354,7 +354,6 @@ func TestAccPrometheusOperator(t *testing.T) {
//}

func TestAccProvider(t *testing.T) {
tests.SkipIfShort(t)
test := getBaseOptions(t).
With(integration.ProgramTestOptions{
Dir: filepath.Join(getCwd(t), "provider"),
Expand All @@ -364,7 +363,7 @@ func TestAccProvider(t *testing.T) {
}

func TestHelmRelease(t *testing.T) {
tests.SkipIfShort(t)
tests.SkipIfShort(t, "test provisions a load balancer and requires a cloud provider cluster to run")
validationFunc := func(t *testing.T, stackInfo integration.RuntimeValidationStackInfo) {
assert.NotEmpty(t, stackInfo.Outputs["redisMasterClusterIP"].(string))
assert.Equal(t, stackInfo.Outputs["status"], "deployed")
Expand Down Expand Up @@ -427,7 +426,7 @@ func TestHelmRelease(t *testing.T) {
func TestHelmReleaseCRD(t *testing.T) {
// Validate that Helm charts with CRDs work across create/update/refresh/delete cycles.
// https://github.com/pulumi/pulumi-kubernetes/issues/1712
tests.SkipIfShort(t)
tests.SkipIfShort(t, "test provisions a load balancer and requires a cloud provider cluster to run")
test := getBaseOptions(t).
With(integration.ProgramTestOptions{
Dir: filepath.Join(getCwd(t), "helm-release-crd", "step1"),
Expand All @@ -447,7 +446,7 @@ func TestHelmReleaseCRD(t *testing.T) {

func TestHelmReleaseNamespace(t *testing.T) {
// Validate fix for https://github.com/pulumi/pulumi-kubernetes/issues/1710
tests.SkipIfShort(t)
tests.SkipIfShort(t, "test provisions a load balancer and requires a cloud provider cluster to run")
test := getBaseOptions(t).
With(integration.ProgramTestOptions{
Dir: filepath.Join(getCwd(t), "helm-release-namespace", "step1"),
Expand Down Expand Up @@ -517,7 +516,7 @@ func TestHelmReleaseRedis(t *testing.T) {
}

// Validate fix for https://github.com/pulumi/pulumi-kubernetes/issues/1933
tests.SkipIfShort(t)
tests.SkipIfShort(t, "test provisions a load balancer and requires a cloud provider cluster to run")
test := getBaseOptions(t).
With(integration.ProgramTestOptions{
Dir: filepath.Join(getCwd(t), "helm-release-redis", "step1"),
Expand Down
12 changes: 5 additions & 7 deletions tests/sdk/nodejs/nodejs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ func TestCRDs(t *testing.T) {
}

func TestPod(t *testing.T) {
tests.SkipIfShort(t) // statuses are different in Kind cluster
test := baseOptions.With(integration.ProgramTestOptions{
Dir: filepath.Join("delete-before-replace", "step1"),
Quick: true,
Expand Down Expand Up @@ -489,7 +488,7 @@ func TestPod(t *testing.T) {
conditions, _ := openapi.Pluck(pod.Outputs, "status", "conditions")
ready := conditions.([]any)[1].(map[string]any)
readyType := ready["type"]
assert.Equal(t, "Ready", readyType)
assert.Equal(t, "Ready", readyType, conditions)
readyStatus := ready["status"]
assert.Equal(t, "True", readyStatus)

Expand Down Expand Up @@ -795,7 +794,7 @@ func TestGet(t *testing.T) {
}

func TestIstio(t *testing.T) {
tests.SkipIfShort(t)
tests.SkipIfShort(t, "test provisions a load balancer and requires a cloud provider cluster to run")
test := baseOptions.With(integration.ProgramTestOptions{
Dir: filepath.Join("istio", "step1"),
Quick: true,
Expand Down Expand Up @@ -1957,7 +1956,7 @@ func TestClientSideDriftCorrectSSA(t *testing.T) {
// 5. Re-enable access to the unreachable cluster and run `pulumi up` again.
// 6. Validate that the resource in the unreachable cluster was updated.
func TestSkipUpdateUnreachableFlag(t *testing.T) {
tests.SkipIfShort(t)
tests.SkipIfShort(t, "tests need to be updated to work with Kind clusters")
var ns0, ns1, cm0, cm1 string

test := baseOptions.With(integration.ProgramTestOptions{
Expand Down Expand Up @@ -2203,8 +2202,7 @@ func ignoreChageTest(t *testing.T, testFolderName string) {
// and has a controller backing it. We create 2 pods to test egress between them, rather than hitting
// a live URL, to avoid flakiness.
func TestEmptyItemNormalization(t *testing.T) {
tests.SkipIfShort(t)

tests.SkipIfShort(t, "test requires a cluster with NetworkPolicy support")
validateProgram := func(networkingEnabled bool) func(*testing.T, integration.RuntimeValidationStackInfo) {
return func(t *testing.T, stackInfo integration.RuntimeValidationStackInfo) {
ns, ok := stackInfo.Outputs["podANamespace"].(string)
Expand Down Expand Up @@ -2268,7 +2266,7 @@ func TestEmptyItemNormalization(t *testing.T) {
// 3. Update the DeploymentPatch resource to further patch the deployment, setting the image to nginx:1.14.0,
// and verify that other fields managed by kubectl-client-side-apply remain unaffected (Step 2).
func TestFieldManagerPatchResources(t *testing.T) {
tests.SkipIfShort(t)
tests.SkipIfShort(t, "test needs to be reworked to work on Kind clusters")
testFolder := "field-manager-patch-resources"

createDeployment := func() string {
Expand Down
1 change: 1 addition & 0 deletions tests/sdk/nodejs/preview_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ func createSAKubeconfig(t *testing.T, saName string) (string, error) {
// TestPreviewWithApply tests the `pulumi preview` CUJ where the user Pulumi program contains an Apply call on status subresoruces.
// This is to ensure we don't fail preview, since status fields are only populated after the resource is created on cluster.
func TestPreviewWithApply(t *testing.T) {
tests.SkipIfShort(t, "test requires a load balancer and won't work on kind clusters")
var externalIP, nsName, svcName string
test := baseOptions.With(integration.ProgramTestOptions{
Dir: "preview-apply",
Expand Down
4 changes: 2 additions & 2 deletions tests/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
)

// SkipIfShort skips the test if the -short flag is passed to `go test`.
func SkipIfShort(t *testing.T) {
func SkipIfShort(t *testing.T, msg string) {
if testing.Short() {
t.Skip("skipping long-running test in short mode")
t.Skip("skipping", t.Name(), "in short mode:", msg)
}
}

Expand Down

0 comments on commit 32862c1

Please sign in to comment.