Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions pkg/cmd/release/deploy/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import (
"testing"
"time"

"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/configuration"
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/environments/v2/ephemeralenvironments"

"github.com/AlecAivazis/survey/v2"
surveyCore "github.com/AlecAivazis/survey/v2/core"
"github.com/MakeNowJust/heredoc/v2"
Expand All @@ -25,9 +22,11 @@ import (
"github.com/OctopusDeploy/cli/test/testutil"
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/channels"
octopusApiClient "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/client"
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/configuration"
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core"
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/deployments"
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/environments"
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/environments/v2/ephemeralenvironments"
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/projects"
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/releases"
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources"
Expand Down Expand Up @@ -570,12 +569,11 @@ func TestDeployCreate_AskQuestions(t *testing.T) {
validationErr = q.AnswerWith("John")
assert.Nil(t, validationErr)

assert.Equal(t, heredoc.Doc(`
assert.Contains(t, stdout.String(), heredoc.Doc(`
Project Fire Project
Release 2.0
Environments dev
`), stdout.String())
stdout.Reset()

q = qa.ExpectQuestion(t, &survey.Select{
Message: "Change additional options?",
Expand All @@ -584,6 +582,8 @@ func TestDeployCreate_AskQuestions(t *testing.T) {
assert.Regexp(t, "Additional Options", stdout.String()) // actual options tested in PrintAdvancedSummary
_ = q.AnswerWith("Proceed to deploy")

stdout.Reset()

err := <-errReceiver
assert.Nil(t, err)

Expand Down Expand Up @@ -758,11 +758,10 @@ func TestDeployCreate_AskQuestions(t *testing.T) {
emptyDeploymentPreviews := fixtures.EmptyDeploymentPreviews()
api.ExpectRequest(t, "POST", "/api/Spaces-1/releases/"+release19.ID+"/deployments/previews").RespondWith(&emptyDeploymentPreviews)

assert.Equal(t, heredoc.Doc(`
assert.Contains(t, heredoc.Doc(`
Project Fire Project
Release 1.9
`), stdout.String())
stdout.Reset()

q = qa.ExpectQuestion(t, &survey.Select{
Message: "Change additional options?",
Expand All @@ -771,6 +770,8 @@ func TestDeployCreate_AskQuestions(t *testing.T) {
assert.Regexp(t, "Additional Options", stdout.String()) // actual options tested in PrintAdvancedSummary
_ = q.AnswerWith("Proceed to deploy")

stdout.Reset()

err := <-errReceiver
assert.Nil(t, err)

Expand Down Expand Up @@ -868,11 +869,10 @@ func TestDeployCreate_AskQuestions(t *testing.T) {
emptyDeploymentPreviews := fixtures.EmptyDeploymentPreviews()
api.ExpectRequest(t, "POST", "/api/Spaces-1/releases/"+release19.ID+"/deployments/previews").RespondWith(&emptyDeploymentPreviews)

assert.Equal(t, heredoc.Doc(`
assert.Contains(t, stdout.String(), heredoc.Doc(`
Project Fire Project
Release 1.9
`), stdout.String())
stdout.Reset()
`))

q = qa.ExpectQuestion(t, &survey.Select{
Message: "Change additional options?",
Expand All @@ -881,6 +881,7 @@ func TestDeployCreate_AskQuestions(t *testing.T) {
assert.Regexp(t, "Additional Options", stdout.String()) // actual options tested in PrintAdvancedSummary
_ = q.AnswerWith("Proceed to deploy")

stdout.Reset()
err := <-errReceiver
assert.Nil(t, err)

Expand Down Expand Up @@ -1061,16 +1062,15 @@ func TestDeployCreate_AskQuestions(t *testing.T) {
emptyDeploymentPreviews := fixtures.EmptyDeploymentPreviews()
api.ExpectRequest(t, "POST", "/api/Spaces-1/releases/"+release19.ID+"/deployments/previews").RespondWith(&emptyDeploymentPreviews)

assert.Equal(t, heredoc.Doc(`
assert.Contains(t, stdout.String(), heredoc.Doc(`
Project Fire Project
Release 1.9
Warning: The following packages are missing from the built-in feed for this release:
- apples (Version: 1.0.0)
- bananas (Version: 2.0.0)

This might cause the deployment to fail.
`), stdout.String())
stdout.Reset()
`))

q := qa.ExpectQuestion(t, &survey.Select{
Message: "Change additional options?",
Expand All @@ -1079,6 +1079,8 @@ func TestDeployCreate_AskQuestions(t *testing.T) {
assert.Regexp(t, "Additional Options", stdout.String()) // actual options tested in PrintAdvancedSummary
_ = q.AnswerWith("Proceed to deploy")

stdout.Reset()

err := <-errReceiver
assert.Nil(t, err)

Expand Down