Skip to content

Commit

Permalink
Fix count node pool update
Browse files Browse the repository at this point in the history
  • Loading branch information
fulviodenza committed Sep 4, 2024
1 parent 4fee779 commit bcd48e7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion fake_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1826,7 +1826,7 @@ func (c *FakeClient) UpdateKubernetesClusterPool(cid, pid string, config *Kubern
for _, p := range cs.Pools {
if p.ID == pid {
poolFound = true
p.Count = config.Count
p.Count = *config.Count
pool = p
}
}
Expand Down
2 changes: 1 addition & 1 deletion fake_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func TestKubernetesClustersPools(t *testing.T) {
g.Expect(string(result.Result)).To(Equal("success"))

pc := KubernetesClusterPoolUpdateConfig{
Count: 4,
Count: &[]int{4}[0],
}
pool, err = client.UpdateKubernetesClusterPool("9c89d8b9-463d-45f2-8928-455eb3f3726", "33de5de2-14fd-44ba-a621-f6efbeeb9639", &pc)
g.Expect(err).To(BeNil())
Expand Down
5 changes: 3 additions & 2 deletions pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import (
"bytes"
"encoding/json"
"fmt"
corev1 "k8s.io/api/core/v1"
"strings"

corev1 "k8s.io/api/core/v1"
)

// KubernetesClusterPoolUpdateConfig is used to create a new cluster pool
type KubernetesClusterPoolUpdateConfig struct {
ID string `json:"id,omitempty"`
Count int `json:"count,omitempty"`
Count *int `json:"count,omitempty"`
Size string `json:"size,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Taints []corev1.Taint `json:"taints"`
Expand Down
4 changes: 2 additions & 2 deletions pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func TestCreateKubernetesClusterPool(t *testing.T) {

newPool := &KubernetesClusterPoolUpdateConfig{
ID: "8a849cc5-bd51-45ce-814a-c378b09dcb06",
Count: 3,
Count: &[]int{3}[0],
Size: "g4s.kube.small",
Labels: map[string]string{},
Taints: []corev1.Taint{},
Expand Down Expand Up @@ -190,7 +190,7 @@ func TestUpdateKubernetesPool(t *testing.T) {
defer server.Close()

updatePool := &KubernetesClusterPoolUpdateConfig{
Count: 3,
Count: &[]int{3}[0],
Labels: map[string]string{
"label1": "label",
},
Expand Down

0 comments on commit bcd48e7

Please sign in to comment.