test/components/flatcar-linux-update-operator: make test idempotent
Right now if manual testing is done, one must annotate the node manually
after each run attempt, which is not very convinient.
@@ -56,9 +56,8 @@ func TestNodeCanReachIdleState(t *testing.T) {
// This annotation should be set on the node during the cluster creation, if it is not set then
// something changed in the cluster setup process in the CI.
- if _, ok := chosenNode.Annotations[annotation]; !ok {
- t.Fatalf("Annotation %q not found on the node.", annotation)
- }
+ if _, ok := chosenNode.Annotations[annotation]; ok {
+ t.Logf("Annotation %q found on the node, removing.", annotation)
// Remove the annotation that disables node reboot.
delete(chosenNode.Annotations, annotation)
@@ -66,6 +65,7 @@ func TestNodeCanReachIdleState(t *testing.T) {
if _, err := client.CoreV1().Nodes().Update(context.Background(), &chosenNode, metav1.UpdateOptions{}); err != nil {
t.Fatalf("Removing node annotation %q: %v", annotation, err)
}
+ }
// Wait for the FLUO to add following annotation key value pair to the chosen node. This may
// involve node reboot if the OS is outdated.
