Skip to content

Commit

Permalink
Fix failure due to ScaleWorkload replicas type (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
SupriyaKasten committed Aug 26, 2019
1 parent e36c022 commit 088ab18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/function/scale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func (s *ScaleSuite) TestGetArgs(c *C) {
},
},
args: map[string]interface{}{
ScaleWorkloadReplicas: "2",
ScaleWorkloadReplicas: int64(2),
},
wantKind: param.DeploymentKind,
wantName: "app",
Expand All @@ -285,7 +285,7 @@ func (s *ScaleSuite) TestGetArgs(c *C) {
},
},
args: map[string]interface{}{
ScaleWorkloadReplicas: 2,
ScaleWorkloadReplicas: int32(2),
ScaleWorkloadNamespaceArg: "notfoo",
ScaleWorkloadNameArg: "notapp",
ScaleWorkloadKindArg: param.DeploymentKind,
Expand Down
4 changes: 4 additions & 0 deletions pkg/function/scale_workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ func getArgs(tp param.TemplateParams, args map[string]interface{}) (namespace, k
switch rep.(type) {
case int:
val = rep.(int)
case int32:
val = int(rep.(int32))
case int64:
val = int(rep.(int64))
case string:
if val, err = strconv.Atoi(rep.(string)); err != nil {
err = errors.Wrapf(err, "Cannot convert %s to int ", rep.(string))
Expand Down

0 comments on commit 088ab18

Please sign in to comment.