MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / TestRunbookRun_PrintAdvancedSummary

Function TestRunbookRun_PrintAdvancedSummary

pkg/cmd/runbook/run/run_test.go:717–801  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

715}
716
717func TestRunbookRun_PrintAdvancedSummary(t *testing.T) {
718 tests := []struct {
719 name string
720 run func(t *testing.T, stdout *bytes.Buffer)
721 }{
722 {"default state", func(t *testing.T, stdout *bytes.Buffer) {
723 options := &executor.TaskOptionsRunbookRun{}
724 run.PrintAdvancedSummary(stdout, &options.TaskOptionsRunbookRunBase)
725
726 assert.Equal(t, heredoc.Doc(`
727 Additional Options:
728 Run At: Now
729 Skipped Steps: None
730 Guided Failure Mode: Use default setting from the target environment
731 Package Download: Use cached packages (if available)
732 Run Targets: All included
733 `), stdout.String())
734 }},
735
736 {"all the things different", func(t *testing.T, stdout *bytes.Buffer) {
737 options := &executor.TaskOptionsRunbookRun{
738 TaskOptionsRunbookRunBase: executor.TaskOptionsRunbookRunBase{
739 ScheduledStartTime: "2022-09-23",
740 GuidedFailureMode: "false",
741 ForcePackageDownload: true,
742 ExcludedSteps: []string{"Step 1", "Step 37"},
743 RunTargets: []string{"vm-1", "vm-2"},
744 ExcludeTargets: []string{"vm-3", "vm-4"},
745 },
746 }
747 run.PrintAdvancedSummary(stdout, &options.TaskOptionsRunbookRunBase)
748
749 assert.Equal(t, heredoc.Doc(`
750 Additional Options:
751 Run At: 2022-09-23
752 Skipped Steps: Step 1,Step 37
753 Guided Failure Mode: Do not use guided failure mode
754 Package Download: Re-download packages from feed
755 Run Targets: Include vm-1,vm-2; Exclude vm-3,vm-4
756 `), stdout.String())
757 }},
758
759 {"variation on include deployment targets only", func(t *testing.T, stdout *bytes.Buffer) {
760 options := &executor.TaskOptionsRunbookRun{
761 TaskOptionsRunbookRunBase: executor.TaskOptionsRunbookRunBase{
762 RunTargets: []string{"vm-2"},
763 },
764 }
765 run.PrintAdvancedSummary(stdout, &options.TaskOptionsRunbookRunBase)
766
767 assert.Equal(t, heredoc.Doc(`
768 Additional Options:
769 Run At: Now
770 Skipped Steps: None
771 Guided Failure Mode: Use default setting from the target environment
772 Package Download: Use cached packages (if available)
773 Run Targets: Include vm-2
774 `), stdout.String())

Callers

nothing calls this directly

Calls 1

PrintAdvancedSummaryFunction · 0.92

Tested by

no test coverage detected