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

Function TestDeployCreate_AskQuestions

pkg/cmd/release/deploy/deploy_test.go:50–1528  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

48var ctxWithFakeNow = context.WithValue(context.TODO(), constants.ContextKeyTimeNow, now)
49
50func TestDeployCreate_AskQuestions(t *testing.T) {
51 const spaceID = "Spaces-1"
52 const fireProjectID = "Projects-22"
53
54 space1 := fixtures.NewSpace(spaceID, "Default Space")
55
56 defaultChannel := fixtures.NewChannel(spaceID, "Channels-1", "Fire Project Default Channel", fireProjectID)
57 defaultChannel.Type = channels.ChannelTypeLifecycle
58 altChannel := fixtures.NewChannel(spaceID, "Channels-97", "Fire Project Alt Channel", fireProjectID)
59 altChannel.Type = channels.ChannelTypeLifecycle
60 ephemeralChannel := fixtures.NewEphemeralChannel(spaceID, "Channels-98", "Fire Project Ephemeral Channel", fireProjectID, "EphemeralEnvironment", false)
61
62 fireProject := fixtures.NewProject(spaceID, fireProjectID, "Fire Project", "Lifecycles-1", "ProjectGroups-1", "deploymentprocess-"+fireProjectID)
63
64 fireProjectTenanted := fixtures.NewProject(spaceID, fireProjectID, "Fire Project", "Lifecycles-1", "ProjectGroups-1", "deploymentprocess-"+fireProjectID)
65 fireProjectTenanted.TenantedDeploymentMode = core.TenantedDeploymentModeTenanted
66
67 fireProjectMaybeTenanted := fixtures.NewProject(spaceID, fireProjectID, "Fire Project", "Lifecycles-1", "ProjectGroups-1", "deploymentprocess-"+fireProjectID)
68 fireProjectMaybeTenanted.TenantedDeploymentMode = core.TenantedDeploymentModeTenantedOrUntenanted
69
70 depProcessSnapshot := fixtures.NewDeploymentProcessForProject(spaceID, fireProjectID)
71 depProcessSnapshot.ID = fmt.Sprintf("%s-s-0-2ZFWS", depProcessSnapshot.ID)
72 depProcessSnapshot.Steps = []*deployments.DeploymentStep{
73 {
74 Name: "Install",
75 Properties: map[string]core.PropertyValue{"Octopus.Action.TargetRoles": core.NewPropertyValue("deploy", false)},
76 Actions: []*deployments.DeploymentAction{
77 {ActionType: "Octopus.Script", Name: "Run a script"}, // technically scriptbody and other things are required but we don't touch them so it's fine
78 },
79 },
80 {
81 Name: "Cleanup",
82 Properties: map[string]core.PropertyValue{"Octopus.Action.TargetRoles": core.NewPropertyValue("deploy", false)},
83 Actions: []*deployments.DeploymentAction{
84 {ActionType: "Octopus.Script", Name: "Run a script"},
85 },
86 },
87 }
88
89 variableSnapshotNoVars := fixtures.NewVariableSetForProject(spaceID, fireProjectID)
90 variableSnapshotNoVars.ID = fmt.Sprintf("%s-s-0-2ZFWS", variableSnapshotNoVars.ID)
91
92 variableSnapshotWithPromptedVariables := fixtures.NewVariableSetForProject(spaceID, fireProjectID)
93 variableSnapshotWithPromptedVariables.ID = fmt.Sprintf("%s-s-0-9BZ22", variableSnapshotWithPromptedVariables.ID)
94 variableSnapshotWithPromptedVariables.Variables = []*variables.Variable{
95 {
96 Name: "Approver",
97 Prompt: &variables.VariablePromptOptions{
98 Description: "Who approved this deployment?",
99 IsRequired: true,
100 },
101 Type: "String",
102 Value: "",
103 },
104 }
105
106 release20 := fixtures.NewRelease(spaceID, "Releases-200", "2.0", fireProjectID, altChannel.ID)
107 release20.ProjectDeploymentProcessSnapshotID = depProcessSnapshot.ID

Callers

nothing calls this directly

Calls 15

NewSpaceFunction · 0.92
NewChannelFunction · 0.92
NewEphemeralChannelFunction · 0.92
NewProjectFunction · 0.92
NewVariableSetForProjectFunction · 0.92
NewReleaseFunction · 0.92
NewEnvironmentFunction · 0.92
NewEphemeralEnvironmentFunction · 0.92
NewTenantFunction · 0.92
EmptyDeploymentPreviewsFunction · 0.92
GoBeginFunction · 0.92

Tested by

no test coverage detected