-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into tom/fix-kanx-error-test
- Loading branch information
Showing
5 changed files
with
74 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package function | ||
|
||
import ( | ||
"gopkg.in/check.v1" | ||
|
||
"github.com/kanisterio/kanister/pkg/param" | ||
) | ||
|
||
type ScaleWorkloadSuite struct{} | ||
|
||
var _ = check.Suite(&ScaleWorkloadSuite{}) | ||
|
||
func (s *ScaleWorkloadSuite) TestSetArgs(c *check.C) { | ||
stsParams := ¶m.StatefulSetParams{} | ||
for _, tc := range []struct { | ||
replicas interface{} | ||
expectedReplicas int32 | ||
}{ | ||
{ | ||
replicas: 4, | ||
expectedReplicas: 4, | ||
}, | ||
{ | ||
replicas: 234324, | ||
expectedReplicas: 234324, | ||
}, | ||
{ | ||
replicas: 234324, | ||
expectedReplicas: 234324, | ||
}, | ||
{ | ||
replicas: 2147483647, | ||
expectedReplicas: 2147483647, // 2147483647 is the maximum value int32 can hold | ||
}, | ||
} { | ||
s := scaleWorkloadFunc{} | ||
err := s.setArgs(param.TemplateParams{ | ||
StatefulSet: stsParams, | ||
}, map[string]interface{}{ | ||
"replicas": tc.replicas, | ||
}) | ||
|
||
c.Assert(err, check.IsNil) | ||
c.Assert(s.replicas, check.Equals, tc.expectedReplicas) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters