-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OCM-5186 | fix: align nodepool actions with machinepools
Signed-off-by: Maggie Chen <[email protected]> refactor Signed-off-by: Maggie Chen <[email protected]> change for machinepool Signed-off-by: Maggie Chen <[email protected]> add test coverage Signed-off-by: Maggie Chen <[email protected]> refactor Signed-off-by: Maggie Chen <[email protected]>
- Loading branch information
Showing
6 changed files
with
217 additions
and
115 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package machinepool | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
cmv1 "github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1" | ||
) | ||
|
||
var _ = Describe("Machinepool", func() { | ||
Context("editMachinePoolAutoscaling", func() { | ||
It("editMachinePoolAutoscaling should equal nil if nothing is changed", func() { | ||
machinepool, err := cmv1.NewMachinePool(). | ||
Autoscaling(cmv1.NewMachinePoolAutoscaling().MaxReplicas(2).MinReplicas(1)). | ||
Build() | ||
Expect(err).ToNot(HaveOccurred()) | ||
builder := editMachinePoolAutoscaling(machinepool, 1, 2) | ||
Expect(builder).To(BeNil()) | ||
}) | ||
|
||
It("editMachinePoolAutoscaling should equal the exepcted output", func() { | ||
machinePool, err := cmv1.NewMachinePool(). | ||
Autoscaling(cmv1.NewMachinePoolAutoscaling().MaxReplicas(2).MinReplicas(1)). | ||
Build() | ||
Expect(err).ToNot(HaveOccurred()) | ||
builder := editMachinePoolAutoscaling(machinePool, 2, 3) | ||
asBuilder := cmv1.NewMachinePoolAutoscaling().MaxReplicas(3).MinReplicas(2) | ||
Expect(builder).To(Equal(asBuilder)) | ||
}) | ||
}) | ||
|
||
Context("isMultiAZMachinePool", func() { | ||
It("isMultiAZMachinePool should return true", func() { | ||
machinePool, err := cmv1.NewMachinePool().Build() | ||
Expect(err).ToNot(HaveOccurred()) | ||
boolean := isMultiAZMachinePool(machinePool) | ||
Expect(boolean).To(Equal(true)) | ||
}) | ||
|
||
It("isMultiAZMachinePool should return false", func() { | ||
machinePool, err := cmv1.NewMachinePool().AvailabilityZones("test").Build() | ||
Expect(err).ToNot(HaveOccurred()) | ||
boolean := isMultiAZMachinePool(machinePool) | ||
Expect(boolean).To(Equal(false)) | ||
}) | ||
}) | ||
}) |
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,13 @@ | ||
package machinepool | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestEditMachinePool(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "Edit machinepool suite") | ||
} |
Oops, something went wrong.