From afe4d7f38d3b7169780d5f89a5536b5bdb39ea33 Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Fri, 20 Sep 2024 16:36:16 +0200 Subject: [PATCH] Create the autopilot client before applying the plan If it's done the other way round, it might happen that the k0s binary is being replaced by the autopilot update process, and cannot be executed. Signed-off-by: Tom Wieczorek --- inttest/ap-single/single_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/inttest/ap-single/single_test.go b/inttest/ap-single/single_test.go index 80092b391a07..932b953ff901 100644 --- a/inttest/ap-single/single_test.go +++ b/inttest/ap-single/single_test.go @@ -87,14 +87,14 @@ spec: manifestFile := "/tmp/happy.yaml" s.PutFileTemplate(s.ControllerNode(0), manifestFile, planTemplate, nil) - out, err := s.RunCommandController(0, fmt.Sprintf("/usr/local/bin/k0s kubectl apply -f %s", manifestFile)) - s.T().Logf("kubectl apply output: '%s'", out) - s.Require().NoError(err) - client, err := s.AutopilotClient(s.ControllerNode(0)) s.Require().NoError(err) s.NotEmpty(client) + out, err := s.RunCommandController(0, fmt.Sprintf("/usr/local/bin/k0s kubectl apply -f %s", manifestFile)) + s.T().Logf("kubectl apply output: '%s'", out) + s.Require().NoError(err) + // The plan has enough information to perform a successful update of k0s, so wait for it. plan, err := aptest.WaitForPlanState(s.Context(), client, apconst.AutopilotName, appc.PlanCompleted) s.Require().NoError(err, "While waiting for plan to complete")