From 61473b0d85e06f54b4f837c19ecb25b94c8239a0 Mon Sep 17 00:00:00 2001 From: Carolyn Van Slyck Date: Wed, 12 Jan 2022 10:00:53 -0600 Subject: [PATCH] Pass context from integration tests The integration tests accidentally were passing nil for the context after I added context.Context as a parameter to some Porter commands in #1831. This passes in context.Background to fix the nil pointer exceptions that was causing. Signed-off-by: Carolyn Van Slyck --- tests/integration/dependencies_test.go | 8 ++++---- tests/integration/invoke_test.go | 2 +- tests/integration/outputs_test.go | 8 ++++---- tests/integration/rebuild_test.go | 2 +- tests/integration/suppress_output_test.go | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/integration/dependencies_test.go b/tests/integration/dependencies_test.go index 572165c01..535b878be 100644 --- a/tests/integration/dependencies_test.go +++ b/tests/integration/dependencies_test.go @@ -105,7 +105,7 @@ func cleanupWordpressBundle(p *porter.TestPorter, namespace string) { err := uninstallOptions.Validate([]string{}, p.Porter) require.NoError(p.T(), err, "validation of uninstall opts for root bundle failed") - err = p.UninstallBundle(nil, uninstallOptions) + err = p.UninstallBundle(context.Background(), uninstallOptions) require.NoError(p.T(), err, "uninstall of root bundle failed") // Verify that the dependency installation is deleted @@ -130,7 +130,7 @@ func upgradeWordpressBundle(p *porter.TestPorter, namespace string) { err := upgradeOpts.Validate([]string{}, p.Porter) require.NoError(p.T(), err, "validation of upgrade opts for root bundle failed") - err = p.UpgradeBundle(nil, upgradeOpts) + err = p.UpgradeBundle(context.Background(), upgradeOpts) require.NoError(p.T(), err, "upgrade of root bundle failed") // Verify that the dependency claim is upgraded @@ -161,7 +161,7 @@ func invokeWordpressBundle(p *porter.TestPorter, namespace string) { err := invokeOpts.Validate([]string{}, p.Porter) require.NoError(p.T(), err, "validation of invoke opts for root bundle failed") - err = p.InvokeBundle(nil, invokeOpts) + err = p.InvokeBundle(context.Background(), invokeOpts) require.NoError(p.T(), err, "invoke of root bundle failed") // Verify that the dependency claim is invoked @@ -191,7 +191,7 @@ func uninstallWordpressBundle(p *porter.TestPorter, namespace string) { err := uninstallOptions.Validate([]string{}, p.Porter) require.NoError(p.T(), err, "validation of uninstall opts for root bundle failed") - err = p.UninstallBundle(nil, uninstallOptions) + err = p.UninstallBundle(context.Background(), uninstallOptions) require.NoError(p.T(), err, "uninstall of root bundle failed") // Verify that the dependency claim is uninstalled diff --git a/tests/integration/invoke_test.go b/tests/integration/invoke_test.go index c5f312d5a..27979b221 100644 --- a/tests/integration/invoke_test.go +++ b/tests/integration/invoke_test.go @@ -37,7 +37,7 @@ func TestInvokeCustomAction(t *testing.T) { invokeOpts.Action = "zombies" err = invokeOpts.Validate([]string{}, p.Porter) require.NoError(t, err) - err = p.InvokeBundle(nil, invokeOpts) + err = p.InvokeBundle(context.Background(), invokeOpts) require.NoError(t, err, "invoke should have succeeded") gotOutput := p.TestConfig.TestContext.GetOutput() diff --git a/tests/integration/outputs_test.go b/tests/integration/outputs_test.go index 4b80778b9..d912d7473 100644 --- a/tests/integration/outputs_test.go +++ b/tests/integration/outputs_test.go @@ -75,7 +75,7 @@ func CleanupCurrentBundle(p *porter.TestPorter) { err := uninstallOpts.Validate([]string{}, p.Porter) assert.NoError(p.T(), err, "validation of uninstall opts failed for current bundle") - err = p.UninstallBundle(nil, uninstallOpts) + err = p.UninstallBundle(context.Background(), uninstallOpts) assert.NoError(p.T(), err, "uninstall failed for current bundle") } @@ -97,7 +97,7 @@ func invokeExecOutputsBundle(p *porter.TestPorter, action string) { statusOpts.Action = action err := statusOpts.Validate([]string{}, p.Porter) require.NoError(p.T(), err) - err = p.InvokeBundle(nil, statusOpts) + err = p.InvokeBundle(context.Background(), statusOpts) require.NoError(p.T(), err, "invoke %s should have succeeded", action) } @@ -124,7 +124,7 @@ func TestStepLevelAndBundleLevelOutputs(t *testing.T) { upgradeOpts := porter.NewUpgradeOptions() err = upgradeOpts.Validate([]string{}, p.Porter) require.NoError(t, err) - err = p.UpgradeBundle(nil, upgradeOpts) + err = p.UpgradeBundle(context.Background(), upgradeOpts) require.NoError(t, err, "upgrade should have succeeded") // Uninstall the bundle @@ -132,6 +132,6 @@ func TestStepLevelAndBundleLevelOutputs(t *testing.T) { uninstallOpts := porter.NewUninstallOptions() err = uninstallOpts.Validate([]string{}, p.Porter) require.NoError(t, err) - err = p.UninstallBundle(nil, uninstallOpts) + err = p.UninstallBundle(context.Background(), uninstallOpts) require.NoError(t, err, "uninstall should have succeeded") } diff --git a/tests/integration/rebuild_test.go b/tests/integration/rebuild_test.go index a08819d9c..f5a528c2c 100644 --- a/tests/integration/rebuild_test.go +++ b/tests/integration/rebuild_test.go @@ -66,7 +66,7 @@ func TestRebuild_UpgradeModifiedBundle(t *testing.T) { upgradeOpts := porter.NewUpgradeOptions() err = upgradeOpts.Validate([]string{}, p.Porter) require.NoError(t, err) - err = p.UpgradeBundle(nil, upgradeOpts) + err = p.UpgradeBundle(context.Background(), upgradeOpts) require.NoError(t, err, "upgrade should have succeeded") gotOutput := p.TestConfig.TestContext.GetOutput() diff --git a/tests/integration/suppress_output_test.go b/tests/integration/suppress_output_test.go index 05981886c..47622bc24 100644 --- a/tests/integration/suppress_output_test.go +++ b/tests/integration/suppress_output_test.go @@ -40,7 +40,7 @@ func TestSuppressOutput(t *testing.T) { err = invokeOpts.Validate([]string{}, p.Porter) require.NoError(t, err) - err = p.InvokeBundle(nil, invokeOpts) + err = p.InvokeBundle(context.Background(), invokeOpts) require.NoError(t, err) // Uninstall @@ -48,7 +48,7 @@ func TestSuppressOutput(t *testing.T) { err = uninstallOpts.Validate([]string{}, p.Porter) require.NoError(t, err) - err = p.UninstallBundle(nil, uninstallOpts) + err = p.UninstallBundle(context.Background(), uninstallOpts) require.NoError(t, err) gotCmdOutput := p.TestConfig.TestContext.GetOutput()