From 9a471d886cecb20b1f23173ff012ef8fd00e0a1f Mon Sep 17 00:00:00 2001 From: Jussi Nummelin Date: Thu, 2 May 2024 14:04:33 +0300 Subject: [PATCH] Fix timing issue in ap-removedapis inttest Signed-off-by: Jussi Nummelin --- inttest/ap-removedapis/removedapis_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/inttest/ap-removedapis/removedapis_test.go b/inttest/ap-removedapis/removedapis_test.go index e5fd2e6459f0..aa2dcff25b0b 100644 --- a/inttest/ap-removedapis/removedapis_test.go +++ b/inttest/ap-removedapis/removedapis_test.go @@ -15,6 +15,7 @@ package removedapis import ( + "context" "fmt" "testing" "time" @@ -50,6 +51,19 @@ func (s *plansRemovedAPIsSuite) SetupTest() { s.Require().NoError(aptest.WaitForCRDByName(ctx, client, "removedcrds")) s.PutFile(s.ControllerNode(0), "/var/lib/k0s/manifests/removedapis-test/resource.yaml", removedResource) + // Wait to see the CR created on API + kc, err := s.KubeClient(s.ControllerNode(0)) + s.Require().NoError(err) + apiPath := "/apis/autopilot.k0sproject.io/v1beta1/namespaces/default/removedcrds/removed-resource" + s.T().Log("Waiting for the removed resource CR to be created on the API...") + err = common.Poll(ctx, func(ctx context.Context) (done bool, err error) { + result := kc.RESTClient().Get().AbsPath(apiPath).Do(ctx) + if result.Error() != nil { + return false, nil + } + return true, nil + }) + s.Require().NoError(err) s.Require().NoError(aptest.WaitForCRDByName(ctx, client, "plans")) s.Require().NoError(aptest.WaitForCRDByName(ctx, client, "controlnodes")) @@ -103,6 +117,8 @@ spec: platforms: linux-amd64: url: http://localhost/dist/k0s + linux-arm64: + url: http://localhost/dist/k0s targets: controllers: discovery: