mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-21 22:00:19 +00:00
e2e: remove multiple labels to node
update the e2e code to remove multiple labels to the node at a time. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
a9e8a32a98
commit
55768007f4
10
e2e/node.go
10
e2e/node.go
@ -45,13 +45,19 @@ func addLabelsToNodes(f *framework.Framework, labels map[string]string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteNodeLabel(c kubernetes.Interface, labelKey string) error {
|
func deleteNodeLabels(c kubernetes.Interface, labelKeys []string) error {
|
||||||
nodes, err := c.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})
|
nodes, err := c.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to list node: %w", err)
|
return fmt.Errorf("failed to list node: %w", err)
|
||||||
}
|
}
|
||||||
for i := range nodes.Items {
|
for i := range nodes.Items {
|
||||||
e2enode.RemoveLabelOffNode(c, nodes.Items[i].Name, labelKey)
|
if err := testutils.RemoveLabelOffNode(c, nodes.Items[i].Name, labelKeys); err != nil {
|
||||||
|
return fmt.Errorf("failed to remove label off node: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := testutils.VerifyLabelsRemoved(c, nodes.Items[i].Name, labelKeys); err != nil {
|
||||||
|
return fmt.Errorf("failed to verify label removed from node: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
33
e2e/rbd.go
33
e2e/rbd.go
@ -401,31 +401,16 @@ var _ = Describe("RBD", func() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = deleteNodeLabel(c, nodeRegionLabel)
|
err = deleteNodeLabels(c, []string{
|
||||||
|
nodeRegionLabel,
|
||||||
|
nodeZoneLabel,
|
||||||
|
nodeCSIRegionLabel,
|
||||||
|
nodeCSIZoneLabel,
|
||||||
|
crushLocationRegionLabel,
|
||||||
|
crushLocationZoneLabel,
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
framework.Failf("failed to delete node label: %v", err)
|
framework.Failf("failed to delete node labels: %v", err)
|
||||||
}
|
|
||||||
err = deleteNodeLabel(c, nodeZoneLabel)
|
|
||||||
if err != nil {
|
|
||||||
framework.Failf("failed to delete node label: %v", err)
|
|
||||||
}
|
|
||||||
// Remove the CSI labels that get added
|
|
||||||
err = deleteNodeLabel(c, nodeCSIRegionLabel)
|
|
||||||
if err != nil {
|
|
||||||
framework.Failf("failed to delete node label: %v", err)
|
|
||||||
}
|
|
||||||
err = deleteNodeLabel(c, nodeCSIZoneLabel)
|
|
||||||
if err != nil {
|
|
||||||
framework.Failf("failed to delete node label: %v", err)
|
|
||||||
}
|
|
||||||
// Remove the CRUSH Location labels
|
|
||||||
err = deleteNodeLabel(c, crushLocationRegionLabel)
|
|
||||||
if err != nil {
|
|
||||||
framework.Failf("failed to delete node label: %v", err)
|
|
||||||
}
|
|
||||||
err = deleteNodeLabel(c, crushLocationZoneLabel)
|
|
||||||
if err != nil {
|
|
||||||
framework.Failf("failed to delete node label: %v", err)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -165,13 +165,12 @@ var _ = Describe("RBD Upgrade Testing", func() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = deleteNodeLabel(c, nodeRegionLabel)
|
err = deleteNodeLabels(c, []string{
|
||||||
|
nodeRegionLabel,
|
||||||
|
nodeZoneLabel,
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
framework.Failf("failed to delete node label: %v", err)
|
framework.Failf("failed to delete node labels: %v", err)
|
||||||
}
|
|
||||||
err = deleteNodeLabel(c, nodeZoneLabel)
|
|
||||||
if err != nil {
|
|
||||||
framework.Failf("failed to delete node label: %v", err)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user