Skip to content

Commit

Permalink
added machinepool TC for reconciliation feature
Browse files Browse the repository at this point in the history
  • Loading branch information
amalykhi authored and openshift-merge-bot[bot] committed Jan 7, 2024
1 parent 6889f9b commit 121ab9a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
47 changes: 46 additions & 1 deletion tests/e2e/machine_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ var _ = Describe("TF Test", func() {
})
})
Context("Author:amalykhi-High-OCP-64904 @ocp-64904 @amalykhi", func() {
It("Author:amalykhi-High-OCP-64905 Edit second machinepool taints", ci.Day2, ci.High, ci.FeatureMachinepool, func() {
It("Author:amalykhi-High-OCP-64904 Edit second machinepool taints", ci.Day2, ci.High, ci.FeatureMachinepool, func() {
By("Create additional machinepool with labels")
replicas := 3
machineType := "r5.xlarge"
Expand Down Expand Up @@ -614,6 +614,51 @@ var _ = Describe("TF Test", func() {

})
})
Context("Author:amalykhi-Medium-OCP-65645 @ocp-65645 @amalykhi", func() {
It("Author:amalykhi-Medium-OCP-65645 MP reconciliation basic flow", ci.Day2, ci.Medium, ci.FeatureMachinepool, func() {
By("Create additional machinepool with taints")
replicas := 3
machineType := "r5.xlarge"
mpName := "ocp-65645"
taint0 := map[string]string{"key": "k1", "value": "val", "schedule_type": con.NoExecute}
taints := []map[string]string{taint0}
MachinePoolArgs := &exe.MachinePoolArgs{
Cluster: clusterID,
Replicas: &replicas,
MachineType: machineType,
Name: mpName,
Taints: taints,
}

_, err := mpService.Apply(MachinePoolArgs, false)
Expect(err).ToNot(HaveOccurred())

By("Verify the parameters of the created machinepool")
_, err = cms.RetrieveClusterMachinePool(ci.RHCSConnection, clusterID, mpName)
Expect(err).ToNot(HaveOccurred())

By("Delete machinepool by OCM API")
cms.DeleteMachinePool(ci.RHCSConnection, clusterID, mpName)
_, err = cms.RetrieveClusterMachinePool(ci.RHCSConnection, clusterID, mpName)
Expect(err).To(HaveOccurred())
Expect(err.Error()).Should(ContainSubstring("Machine pool with id '%s' not found", mpName))

By("ReApply the machinepool manifest")
_, err = mpService.Apply(MachinePoolArgs, false)
Expect(err).ToNot(HaveOccurred())

By("Verify the parameters of the machinepool")
mpResponseBody, err := cms.RetrieveClusterMachinePool(ci.RHCSConnection, clusterID, mpName)
Expect(err).ToNot(HaveOccurred())
respTaints := mpResponseBody.Taints()
for index, taint := range respTaints {
Expect(taint.Effect()).To(Equal(taints[index]["schedule_type"]))
Expect(taint.Key()).To(Equal(taints[index]["key"]))
Expect(taint.Value()).To(Equal(taints[index]["value"]))
}

})
})
})

Describe("Validate terraform Import operations", func() {
Expand Down
4 changes: 4 additions & 0 deletions tests/utils/cms/cms.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ func ListMachineTypes(connection *client.Connection, params ...map[string]interf
return request.Send()
}

func DeleteMachinePool(connection *client.Connection, clusterID string, mpID string) (*cmv1.MachinePoolDeleteResponse, error) {
return connection.ClustersMgmt().V1().Clusters().Cluster(clusterID).MachinePools().MachinePool(mpID).Delete().Send()
}

// RetrieveMachineTypeDetail will return the retrieve result of machine type detailed information
func RetrieveMachineTypeDetail(connection *client.Connection, machineTypeID string) (*client.Response, error) {
return connection.Get().Path(fmt.Sprintf(machineTypeIDURL, machineTypeID)).Send()
Expand Down

0 comments on commit 121ab9a

Please sign in to comment.