From eaaba7b7af0939e6def34570e2738db4d06d7cd1 Mon Sep 17 00:00:00 2001 From: Bryce Lampe Date: Tue, 26 Nov 2024 09:19:52 -0800 Subject: [PATCH] Test failures --- tests/sdk/java/await_test.go | 54 +++++++++++++++--------------- tests/sdk/java/chartv4_test.go | 8 ++--- tests/sdk/java/config_test.go | 8 ++--- tests/sdk/java/configmap_test.go | 12 +++---- tests/sdk/java/csa_to_ssa_test.go | 14 ++++---- tests/sdk/java/kustomizev2_test.go | 6 ++-- tests/sdk/java/patch_test.go | 24 ++++++------- tests/sdk/java/preview_test.go | 20 +++++------ tests/sdk/java/yamlv2_test.go | 14 ++++---- tests/sdk/nodejs/await_test.go | 22 ++++++------ tests/sdk/nodejs/helm_test.go | 10 +++--- 11 files changed, 96 insertions(+), 96 deletions(-) diff --git a/tests/sdk/java/await_test.go b/tests/sdk/java/await_test.go index fa9bd249ce..2aae07c161 100644 --- a/tests/sdk/java/await_test.go +++ b/tests/sdk/java/await_test.go @@ -58,23 +58,23 @@ func TestAwaitDaemonSet(t *testing.T) { opttest.SkipInstall(), ) t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) // Create a new DS that takes a few seconds to become ready. - up := test.Up() + up := test.Up(t) t.Log(up.Summary.Message) assertReady(t, up.Outputs) - test.Refresh() // Exercise read-await logic. + test.Refresh(t) // Exercise read-await logic. // Update the DS to use a different but valid image tag. - test.UpdateSource("testdata/await/daemonset/step2") - up = test.Up() + test.UpdateSource(t, "testdata/await/daemonset/step2") + up = test.Up(t) assertReady(t, up.Outputs) // Update the DS to use an invalid image tag. It should never become ready. - test.UpdateSource("testdata/await/daemonset/step3") + test.UpdateSource(t, "testdata/await/daemonset/step3") _, err := test.CurrentStack().Up(context.Background()) assert.ErrorContains(t, err, `the Kubernetes API server reported that "default/await-daemonset" failed to fully initialize or become live: timed out waiting for the condition`) } @@ -87,16 +87,16 @@ func TestAwaitPVC(t *testing.T) { opttest.SkipInstall(), ) t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) // WaitUntilFirstConsumer PVC should still be Pending. - up := test.Up() + up := test.Up(t) assert.Equal(t, "Pending", up.Outputs["status"].Value) // Adding a Deployment to consume the PVC should succeed. - test.UpdateSource("testdata/await/pvc/step2") - up = test.Up() + test.UpdateSource(t, "testdata/await/pvc/step2") + up = test.Up(t) } func TestAwaitService(t *testing.T) { @@ -107,19 +107,19 @@ func TestAwaitService(t *testing.T) { opttest.SkipInstall(), ) t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) - up := test.Up() + up := test.Up(t) assert.Equal(t, float64(1), up.Outputs["replicas"].Value.(float64)) assert.Nil(t, up.Outputs["selector"].Value) - test.Refresh() + test.Refresh(t) - test.UpdateSource("testdata/await/service/step2") - up = test.Up() + test.UpdateSource(t, "testdata/await/service/step2") + up = test.Up(t) assert.Equal(t, float64(0), up.Outputs["replicas"].Value.(float64)) assert.Equal(t, up.Outputs["selector"], up.Outputs["label"]) - test.Refresh() + test.Refresh(t) } func TestAwaitServiceAccount(t *testing.T) { @@ -130,13 +130,13 @@ func TestAwaitServiceAccount(t *testing.T) { opttest.SkipInstall(), ) t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) - test.Up() - test.UpdateSource("testdata/await/service-account/step2") - test.Up() - test.Refresh() + test.Up(t) + test.UpdateSource(t, "testdata/await/service-account/step2") + test.Up(t) + test.Refresh(t) } func TestAwaitSkip(t *testing.T) { @@ -147,27 +147,27 @@ func TestAwaitSkip(t *testing.T) { opttest.SkipInstall(), ) t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) start := time.Now() - _ = test.Up(optup.ProgressStreams(os.Stdout)) + _ = test.Up(t, optup.ProgressStreams(os.Stdout)) took := time.Since(start) assert.Less(t, took, 2*time.Minute, "didn't skip pod's slow startup") start = time.Now() - _ = test.Refresh(optrefresh.ProgressStreams(os.Stdout)) + _ = test.Refresh(t, optrefresh.ProgressStreams(os.Stdout)) took = time.Since(start) assert.Less(t, took, 2*time.Minute, "didn't skip pod's slow read") - test.UpdateSource("testdata/await/skipawait/step2") + test.UpdateSource(t, "testdata/await/skipawait/step2") start = time.Now() - _ = test.Refresh(optrefresh.ProgressStreams(os.Stdout)) + _ = test.Refresh(t, optrefresh.ProgressStreams(os.Stdout)) took = time.Since(start) assert.Less(t, took, 2*time.Minute, "didn't skip pod's slow update") start = time.Now() - _ = test.Destroy(optdestroy.ProgressStreams(os.Stdout)) + _ = test.Destroy(t, optdestroy.ProgressStreams(os.Stdout)) took = time.Since(start) assert.Less(t, took, 2*time.Minute, "didn't skip config map's stuck delete") } diff --git a/tests/sdk/java/chartv4_test.go b/tests/sdk/java/chartv4_test.go index b12685898d..2f630ea4ca 100644 --- a/tests/sdk/java/chartv4_test.go +++ b/tests/sdk/java/chartv4_test.go @@ -13,9 +13,9 @@ func TestChartv4(t *testing.T) { test := pulumitest.NewPulumiTest(t, "testdata/chartv4", opttest.SkipInstall()) t.Logf("into %s", test.Source()) t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) - test.Preview() - test.Up() - test.Up(optup.ExpectNoChanges()) + test.Preview(t) + test.Up(t) + test.Up(t, optup.ExpectNoChanges()) } diff --git a/tests/sdk/java/config_test.go b/tests/sdk/java/config_test.go index d4c8f307cb..f7b693a5ab 100644 --- a/tests/sdk/java/config_test.go +++ b/tests/sdk/java/config_test.go @@ -14,19 +14,19 @@ func TestClusterIdentifier(t *testing.T) { ctx := context.Background() test := pulumitest.NewPulumiTest(t, "config/cluster-identifier") t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) - test.Up() + test.Up(t) - test.UpdateSource("config/cluster-identifier/step2") + test.UpdateSource(t, "config/cluster-identifier/step2") up, err := test.CurrentStack().Up(ctx) require.NoError(t, err) assert.Contains(t, up.StdOut, "updated") assert.NotContains(t, up.StdOut, "replaced") - test.UpdateSource("config/cluster-identifier/step3") + test.UpdateSource(t, "config/cluster-identifier/step3") up, err = test.CurrentStack().Up(ctx) require.NoError(t, err) diff --git a/tests/sdk/java/configmap_test.go b/tests/sdk/java/configmap_test.go index bd8d88179d..7aa7b069e5 100644 --- a/tests/sdk/java/configmap_test.go +++ b/tests/sdk/java/configmap_test.go @@ -16,11 +16,11 @@ func TestConfigMapAndSecretImmutability(t *testing.T) { opttest.SkipInstall(), ) t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) // Create the secrets/configmaps. - up := test.Up() + up := test.Up(t) // We will detect update/replacement behavior by observing effects on our // downstream dependencies. @@ -32,8 +32,8 @@ func TestConfigMapAndSecretImmutability(t *testing.T) { mutableConfigmap := up.Outputs["mutableConfigmap"].Value.(string) // Update the data of all our secrets and configmaps. - test.UpdateSource("testdata/immutability/step2") - up = test.Up() + test.UpdateSource(t, "testdata/immutability/step2") + up = test.Up(t) // Only the mutable configmap and secret should have been updated -- so no // impact on those two downstreams. @@ -53,8 +53,8 @@ func TestConfigMapAndSecretImmutability(t *testing.T) { // The final step only touches annotations. All resources should have been // updated. - test.UpdateSource("testdata/immutability/step3") - up = test.Up() + test.UpdateSource(t, "testdata/immutability/step3") + up = test.Up(t) assert.Equal(t, secret, up.Outputs["secret"].Value.(string)) assert.Equal(t, configmap, up.Outputs["configmap"].Value.(string)) assert.Equal(t, autonamedSecret, up.Outputs["autonamedSecret"].Value.(string)) diff --git a/tests/sdk/java/csa_to_ssa_test.go b/tests/sdk/java/csa_to_ssa_test.go index a72659517c..c71098d831 100644 --- a/tests/sdk/java/csa_to_ssa_test.go +++ b/tests/sdk/java/csa_to_ssa_test.go @@ -40,10 +40,10 @@ func TestCSAToSSANoManagedFields(t *testing.T) { test := pulumitest.NewPulumiTest(t, "testdata/csa-to-ssa", opttest.SkipInstall()) t.Logf("into %s", test.Source()) t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) - test.Preview() - test.Up() + test.Preview(t) + test.Up(t) outputs, err := test.CurrentStack().Outputs(ctx) require.NoError(t, err, "Failed to get outputs from stack") @@ -85,8 +85,8 @@ func TestCSAToSSANoManagedFields(t *testing.T) { require.Empty(t, dep.GetManagedFields(), "Failed to remove managedFields from deployment object") // 3. Apply step 2 of testdata where SSA mode is enabled, with a change in the image spec field. - test.UpdateSource("testdata/csa-to-ssa/step2") - test.Preview() - test.Up() - test.Up(optup.ExpectNoChanges()) + test.UpdateSource(t, "testdata/csa-to-ssa/step2") + test.Preview(t) + test.Up(t) + test.Up(t, optup.ExpectNoChanges()) } diff --git a/tests/sdk/java/kustomizev2_test.go b/tests/sdk/java/kustomizev2_test.go index ed3f3e299f..9f1113bf74 100644 --- a/tests/sdk/java/kustomizev2_test.go +++ b/tests/sdk/java/kustomizev2_test.go @@ -24,8 +24,8 @@ func TestKustomizeV2(t *testing.T) { ) t.Logf("into %s", test.Source()) t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) - test.Preview() - test.Up() + test.Preview(t) + test.Up(t) } diff --git a/tests/sdk/java/patch_test.go b/tests/sdk/java/patch_test.go index e8ea390b03..13798103d4 100644 --- a/tests/sdk/java/patch_test.go +++ b/tests/sdk/java/patch_test.go @@ -85,15 +85,15 @@ func TestPatchResources(t *testing.T) { // 1. Create the resources. test := pulumitest.NewPulumiTest(t, filepath.Join(testFolder, language, "step1")) if language != "yaml" { - test.Install() + test.Install(t) } t.Logf("into %s", test.Source()) t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) - test.Preview() - outputs := test.Up().Outputs + test.Preview(t) + outputs := test.Up(t).Outputs // Validate the resources do not contain the patch fields. Get the program outputs for use with `kubectl`. namespace := outputs["nsName"].Value.(string) resources := []rsc{ @@ -135,12 +135,12 @@ func TestPatchResources(t *testing.T) { } // 2. Patch the resources. - test.UpdateSource(testFolder, language, "step2") + test.UpdateSource(t, testFolder, language, "step2") if language != "yaml" { - test.Install() + test.Install(t) } - test.Preview() - test.Up() + test.Preview(t) + test.Up(t) // Validate the resources contain the patch fields. for _, resource := range resources { @@ -166,13 +166,13 @@ func TestPatchResources(t *testing.T) { } // 3. Delete the Patch resources by reverting to the Pulumi program in step 1. - test.UpdateSource(testFolder, language, "step1") + test.UpdateSource(t, testFolder, language, "step1") if language != "yaml" { - test.Install() + test.Install(t) } - test.Preview() - test.Up() + test.Preview(t) + test.Up(t) // Validate the resources do not contain the patch fields, and the object has not been deleted from cluster. for _, resource := range resources { diff --git a/tests/sdk/java/preview_test.go b/tests/sdk/java/preview_test.go index 0ef572fe94..82d4876269 100644 --- a/tests/sdk/java/preview_test.go +++ b/tests/sdk/java/preview_test.go @@ -14,14 +14,14 @@ func TestPreviewReplacements(t *testing.T) { test := pulumitest.NewPulumiTest(t, "testdata/preview-replacements", opttest.SkipInstall()) t.Logf("into %s", test.Source()) t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) - test.Preview() - test.Up() + test.Preview(t) + test.Up(t) // Preview should not fail when there is a replacement due to immutable fields. - test.UpdateSource("testdata/preview-replacements", "step2") - test.Preview() + test.UpdateSource(t, "testdata/preview-replacements", "step2") + test.Preview(t) } // TestCRDPreviews ensures that CRDs are correctly previewed, and are not created or updated on the cluster. @@ -36,20 +36,20 @@ func TestCRDPreviews(t *testing.T) { test := pulumitest.NewPulumiTest(t, testFolder, opttest.SkipInstall()) t.Logf("into %s", test.Source()) t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) - test.Up() + test.Up(t) // 2. Preview should not actually update the CRD resource. Step 2 adds a new field ("testNewField") to the CRD. - test.UpdateSource(testFolder, "step2") - test.Preview() + test.UpdateSource(t, testFolder, "step2") + test.Preview(t) out, err := tests.Kubectl("get", "crd", crdName, "-o", "yaml") require.NoError(t, err, "unable to get CRD with kubectl") require.NotContains(t, string(out), "testNewField", "expected CRD to not have new field added in preview") // 3. Update should actually update the CRD resource. - test.Up() + test.Up(t) out, err = tests.Kubectl("get", "crd", crdName, "-o", "yaml") require.NoError(t, err, "unable to get CRD with kubectl") require.Contains(t, string(out), "testNewField", "expected CRD to have new field added in update operation") diff --git a/tests/sdk/java/yamlv2_test.go b/tests/sdk/java/yamlv2_test.go index 0984965c64..78add1c14c 100644 --- a/tests/sdk/java/yamlv2_test.go +++ b/tests/sdk/java/yamlv2_test.go @@ -18,10 +18,10 @@ func TestYamlV2(t *testing.T) { test := pulumitest.NewPulumiTest(t, "testdata/yamlv2", opttest.SkipInstall()) t.Logf("into %s", test.Source()) t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) - test.Preview() - test.Up() + test.Preview(t) + test.Up(t) } // TestJobUnreachable ensures that a panic does not occur when diffing Job resources against an unreachable API server. @@ -30,9 +30,9 @@ func TestJobUnreachable(t *testing.T) { test := pulumitest.NewPulumiTest(t, "testdata/job-unreachable", opttest.SkipInstall()) t.Logf("into %s", test.Source()) t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) - test.Preview() + test.Preview(t) // Create the job, but expect it to fail as the job is meant to fail. _, err := test.CurrentStack().Up(test.Context()) @@ -40,6 +40,6 @@ func TestJobUnreachable(t *testing.T) { // Re-run the Pulumi program with a malformed kubeconfig to simulate an unreachable API server. // This should not panic annd preview should succeed. - test.UpdateSource("testdata/job-unreachable/step2") - test.Preview() + test.UpdateSource(t, "testdata/job-unreachable/step2") + test.Preview(t) } diff --git a/tests/sdk/nodejs/await_test.go b/tests/sdk/nodejs/await_test.go index f80a2b4770..5e0a1798bf 100644 --- a/tests/sdk/nodejs/await_test.go +++ b/tests/sdk/nodejs/await_test.go @@ -179,7 +179,7 @@ func TestAwaitGeneric(t *testing.T) { ) dir := test.Source() t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) // Use kubectl to simulate an operator acting on our resources. @@ -190,14 +190,14 @@ func TestAwaitGeneric(t *testing.T) { }() // Create - up := test.Up(optup.EventStreams(ch), optup.ProgressStreams(os.Stdout), optup.ErrorProgressStreams(os.Stderr)) + up := test.Up(t, optup.EventStreams(ch), optup.ProgressStreams(os.Stdout), optup.ErrorProgressStreams(os.Stderr)) assertAllResourcesReady(t, up.Outputs) // Touch our resources and refresh in order to trigger an update later. touch(t, dir) // Read - refresh := test.Refresh(optrefresh.ProgressStreams(os.Stdout)) + refresh := test.Refresh(t, optrefresh.ProgressStreams(os.Stdout)) require.NotNil(t, refresh.Summary.ResourceChanges) assert.Equal(t, 5, (*refresh.Summary.ResourceChanges)["update"]) @@ -208,7 +208,7 @@ func TestAwaitGeneric(t *testing.T) { }() // Update - up = test.Up(optup.EventStreams(ch), optup.ProgressStreams(os.Stdout), optup.ErrorProgressStreams(os.Stderr)) + up = test.Up(t, optup.EventStreams(ch), optup.ProgressStreams(os.Stdout), optup.ErrorProgressStreams(os.Stderr)) assertAllResourcesReady(t, up.Outputs) }) @@ -222,7 +222,7 @@ func TestAwaitGeneric(t *testing.T) { ) dir := test.Source() t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) // Use kubectl to simulate an operator acting on our resources. @@ -233,7 +233,7 @@ func TestAwaitGeneric(t *testing.T) { }() // Create - up := test.Up(optup.EventStreams(ch), optup.ProgressStreams(os.Stdout), optup.ErrorProgressStreams(os.Stderr)) + up := test.Up(t, optup.EventStreams(ch), optup.ProgressStreams(os.Stdout), optup.ErrorProgressStreams(os.Stderr)) assertGenericResourceUntouched(t, up.Outputs) assertWaitForResourcesReady(t, up.Outputs) @@ -241,7 +241,7 @@ func TestAwaitGeneric(t *testing.T) { touch(t, dir) // Read - refresh := test.Refresh(optrefresh.ProgressStreams(os.Stdout)) + refresh := test.Refresh(t, optrefresh.ProgressStreams(os.Stdout)) require.NotNil(t, refresh.Summary.ResourceChanges) assert.Equal(t, 5, (*refresh.Summary.ResourceChanges)["update"]) @@ -252,7 +252,7 @@ func TestAwaitGeneric(t *testing.T) { }() // Update - up = test.Up(optup.EventStreams(ch), optup.ProgressStreams(os.Stdout), optup.ErrorProgressStreams(os.Stderr)) + up = test.Up(t, optup.EventStreams(ch), optup.ProgressStreams(os.Stdout), optup.ErrorProgressStreams(os.Stderr)) assertGenericResourceUntouched(t, up.Outputs) assertWaitForResourcesReady(t, up.Outputs) }) @@ -265,9 +265,9 @@ func TestAwaitCertManager(t *testing.T) { "testdata/await/cert-manager", ) t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) - test.Up(optup.ProgressStreams(os.Stdout)) - test.Destroy(optdestroy.ProgressStreams(os.Stdout)) + test.Up(t, optup.ProgressStreams(os.Stdout)) + test.Destroy(t, optdestroy.ProgressStreams(os.Stdout)) } diff --git a/tests/sdk/nodejs/helm_test.go b/tests/sdk/nodejs/helm_test.go index 0b79fdc683..3680828528 100644 --- a/tests/sdk/nodejs/helm_test.go +++ b/tests/sdk/nodejs/helm_test.go @@ -54,19 +54,19 @@ func TestHelmUnknowns(t *testing.T) { previewF := func(opts ...optpreview.Option) auto.PreviewResult { clearGrpcLog(t, test) - preview := test.Preview(opts...) + preview := test.Preview(t, opts...) t.Log(preview.StdOut) return preview } upF := func() auto.UpResult { clearGrpcLog(t, test) - up := test.Up() + up := test.Up(t) t.Log(up.StdOut) return up } lookup := func() grpclog.TypedEntry[rpc.CreateRequest, rpc.CreateResponse] { - creates, err := test.GrpcLog().Creates() + creates, err := test.GrpcLog(t).Creates() g.Expect(err).ToNot(HaveOccurred()) release := findByUrn(t, creates, urn("kubernetes:helm.sh/v3:Release", "release")) g.Expect(release).ToNot(BeNil()) @@ -190,8 +190,8 @@ func TestPreviewWithUnreachableCluster(t *testing.T) { test := pulumitest.NewPulumiTest(t, "helm-preview-unreachable") t.Cleanup(func() { - test.Destroy() + test.Destroy(t) }) - test.Preview() + test.Preview(t) }