code.cloudfoundry.org/cli@v7.1.0+incompatible/actor/v7pushaction/setup_deployment_strategy_for_push_plan_test.go (about)

     1  package v7pushaction_test
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant"
     5  
     6  	. "code.cloudfoundry.org/cli/actor/v7pushaction"
     7  
     8  	. "github.com/onsi/ginkgo"
     9  	. "github.com/onsi/gomega"
    10  )
    11  
    12  var _ = Describe("SetupDeploymentStrategyForPushPlan", func() {
    13  	var (
    14  		pushPlan  PushPlan
    15  		overrides FlagOverrides
    16  
    17  		expectedPushPlan PushPlan
    18  		executeErr       error
    19  	)
    20  
    21  	BeforeEach(func() {
    22  		pushPlan = PushPlan{}
    23  		overrides = FlagOverrides{}
    24  	})
    25  
    26  	JustBeforeEach(func() {
    27  		expectedPushPlan, executeErr = SetupDeploymentStrategyForPushPlan(pushPlan, overrides)
    28  	})
    29  
    30  	When("flag overrides specifies strategy", func() {
    31  		BeforeEach(func() {
    32  			overrides.Strategy = "rolling"
    33  		})
    34  
    35  		It("sets the strategy on the push plan", func() {
    36  			Expect(executeErr).ToNot(HaveOccurred())
    37  			Expect(expectedPushPlan.Strategy).To(Equal(constant.DeploymentStrategyRolling))
    38  		})
    39  	})
    40  
    41  	When("flag overrides does not specify strategy", func() {
    42  		It("leaves the strategy as its default value on the push plan", func() {
    43  			Expect(executeErr).ToNot(HaveOccurred())
    44  			Expect(expectedPushPlan.Strategy).To(Equal(constant.DeploymentStrategyDefault))
    45  		})
    46  	})
    47  })