Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Autoscale api model (#3586)
Browse files Browse the repository at this point in the history
* adding fields to specify that we should autoscale a cluster. These will be user

admin override due to these changes not being used in acs-engine and thus the tests don't test it.
  • Loading branch information
JackQuincy authored Jul 31, 2018
1 parent d6f61e0 commit 9876b05
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,9 @@ type AgentPoolProfile struct {
Extensions []Extension `json:"extensions"`
KubernetesConfig *KubernetesConfig `json:"kubernetesConfig,omitempty"`
ImageRef *ImageReference `json:"imageReference,omitempty"`
MaxCount *int `json:"maxCount,omitempty"`
MinCount *int `json:"minCount,omitempty"`
EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"`
}

// AgentPoolProfileRole represents an agent role
Expand Down
6 changes: 6 additions & 0 deletions pkg/helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ func PointerToBool(b bool) *bool {
return &p
}

// PointerToInt returns a pointer to a int
func PointerToInt(i int) *int {
p := i
return &p
}

// EqualError is a ni;-safe method which reports whether errors a and b are considered equal.
// They're equal if both are nil, or both are not nil and a.Error() == b.Error().
func EqualError(a, b error) bool {
Expand Down
17 changes: 17 additions & 0 deletions pkg/helpers/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ func TestPointerToBool(t *testing.T) {
}
}

func TestPointerToInt(t *testing.T) {
int1 := 1
int2 := 2
ret1 := PointerToInt(int1)
if *ret1 != int1 {
t.Fatalf("expected PointerToInt(1) to return *1, instead returned %#v", ret1)
}
ret2 := PointerToInt(int2)
if *ret2 != int2 {
t.Fatalf("expected PointerToInt(2) to return *2, instead returned %#v", ret2)
}

if *ret2 <= *ret1 {
t.Fatalf("Pointers to ints messed up their values and made 2 <= 1")
}
}

func TestCreateSSH(t *testing.T) {
rg := rand.New(rand.NewSource(42))

Expand Down

0 comments on commit 9876b05

Please sign in to comment.