Skip to content

Commit

Permalink
test: Add integration test
Browse files Browse the repository at this point in the history
Signed-off-by: Kim Christensen <kimworking@gmail.com>
  • Loading branch information
kichristensen committed Nov 1, 2024
1 parent 9b604ac commit 24b54fa
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/integration/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,39 @@ func TestUpgrade_failedInstallation(t *testing.T) {
err = p.UpgradeBundle(ctx, upgradeOpts)
require.Error(t, err, "Upgrade should fail, because the installation failed")
}

func TestUpgrade_DebugModeAppliesToSingleInvocation(t *testing.T) {
p := porter.NewTestPorter(t)
defer p.Close()
ctx := p.SetupIntegrationTest()

p.AddTestBundleDir("testdata/bundles/bundle-with-custom-action", false)

installOpts := porter.NewInstallOptions()
err := installOpts.Validate(ctx, []string{}, p.Porter)
require.NoError(t, err)

err = p.InstallBundle(ctx, installOpts)
require.NoError(t, err)

upgradeOpts := porter.NewUpgradeOptions()
upgradeOpts.DebugMode = true
err = upgradeOpts.Validate(ctx, []string{}, p.Porter)
require.NoError(t, err)

err = p.UpgradeBundle(ctx, upgradeOpts)
require.NoError(t, err)
output := p.TestConfig.TestContext.GetOutput()
require.Contains(t, output, "== Step Template ===")
p.TestConfig.TestContext.ClearOutputs()

upgradeOpts = porter.NewUpgradeOptions()
upgradeOpts.DebugMode = false
err = upgradeOpts.Validate(ctx, []string{}, p.Porter)
require.NoError(t, err)

err = p.UpgradeBundle(ctx, upgradeOpts)
require.NoError(t, err)
output = p.TestConfig.TestContext.GetOutput()
require.NotContains(t, output, "== Step Template ===")
}

0 comments on commit 24b54fa

Please sign in to comment.