Skip to content

Commit

Permalink
Rename notStateless constant to stateful. (cnabio#684)
Browse files Browse the repository at this point in the history
Signed-off-by: Silvin Lubecki <[email protected]>
  • Loading branch information
silvin-lubecki authored and radu-matei committed Apr 4, 2019
1 parent ebd6715 commit e40ac08
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions pkg/action/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"github.com/deislabs/duffle/pkg/driver"
)

// notStateless is there just to make callers of opFromClaims more readable
const notStateless = false
// stateful is there just to make callers of opFromClaims more readable
const stateful = false

// Action describes one of the primary actions that can be executed in CNAB.
//
Expand Down
14 changes: 7 additions & 7 deletions pkg/action/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func TestOpFromClaim(t *testing.T) {
}
invocImage := c.Bundle.InvocationImages[0]

op, err := opFromClaim(claim.ActionInstall, notStateless, c, invocImage, mockSet, os.Stdout)
op, err := opFromClaim(claim.ActionInstall, stateful, c, invocImage, mockSet, os.Stdout)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -140,7 +140,7 @@ func TestOpFromClaim_UndefinedParams(t *testing.T) {
}
invocImage := c.Bundle.InvocationImages[0]

_, err := opFromClaim(claim.ActionInstall, notStateless, c, invocImage, mockSet, os.Stdout)
_, err := opFromClaim(claim.ActionInstall, stateful, c, invocImage, mockSet, os.Stdout)
assert.Error(t, err)
}

Expand All @@ -163,12 +163,12 @@ func TestOpFromClaim_MissingRequiredParameter(t *testing.T) {
invocImage := c.Bundle.InvocationImages[0]

// missing required parameter fails
_, err := opFromClaim(claim.ActionInstall, notStateless, c, invocImage, mockSet, os.Stdout)
_, err := opFromClaim(claim.ActionInstall, stateful, c, invocImage, mockSet, os.Stdout)
assert.EqualError(t, err, `missing required parameter "param_one" for action "install"`)

// fill the missing parameter
c.Parameters["param_one"] = "oneval"
_, err = opFromClaim(claim.ActionInstall, notStateless, c, invocImage, mockSet, os.Stdout)
_, err = opFromClaim(claim.ActionInstall, stateful, c, invocImage, mockSet, os.Stdout)
assert.Nil(t, err)
}

Expand All @@ -195,15 +195,15 @@ func TestOpFromClaim_MissingRequiredParamSpecificToAction(t *testing.T) {
invocImage := c.Bundle.InvocationImages[0]

// calling install action without the test required parameter for test action is ok
_, err := opFromClaim(claim.ActionInstall, notStateless, c, invocImage, mockSet, os.Stdout)
_, err := opFromClaim(claim.ActionInstall, stateful, c, invocImage, mockSet, os.Stdout)
assert.Nil(t, err)

// test action needs the required parameter
_, err = opFromClaim("test", notStateless, c, invocImage, mockSet, os.Stdout)
_, err = opFromClaim("test", stateful, c, invocImage, mockSet, os.Stdout)
assert.EqualError(t, err, `missing required parameter "param_test" for action "test"`)

c.Parameters["param_test"] = "only for test action"
_, err = opFromClaim("test", notStateless, c, invocImage, mockSet, os.Stdout)
_, err = opFromClaim("test", stateful, c, invocImage, mockSet, os.Stdout)
assert.Nil(t, err)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/action/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (i *Install) Run(c *claim.Claim, creds credentials.Set, w io.Writer) error
return err
}

op, err := opFromClaim(claim.ActionInstall, notStateless, c, invocImage, creds, w)
op, err := opFromClaim(claim.ActionInstall, stateful, c, invocImage, creds, w)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/action/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (i *Status) Run(c *claim.Claim, creds credentials.Set, w io.Writer) error {
return err
}

op, err := opFromClaim(claim.ActionStatus, notStateless, c, invocImage, creds, w)
op, err := opFromClaim(claim.ActionStatus, stateful, c, invocImage, creds, w)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/action/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (u *Uninstall) Run(c *claim.Claim, creds credentials.Set, w io.Writer) erro
return err
}

op, err := opFromClaim(claim.ActionUninstall, notStateless, c, invocImage, creds, w)
op, err := opFromClaim(claim.ActionUninstall, stateful, c, invocImage, creds, w)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/action/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (u *Upgrade) Run(c *claim.Claim, creds credentials.Set, w io.Writer) error
return err
}

op, err := opFromClaim(claim.ActionUpgrade, notStateless, c, invocImage, creds, w)
op, err := opFromClaim(claim.ActionUpgrade, stateful, c, invocImage, creds, w)
if err != nil {
return err
}
Expand Down

0 comments on commit e40ac08

Please sign in to comment.