Skip to content

Commit

Permalink
Merge pull request #4358 from jnummelin/fix/removed-apis-test-timign-…
Browse files Browse the repository at this point in the history
…issue

Fix timing issue in ap-removedapis inttest
  • Loading branch information
jnummelin authored May 3, 2024
2 parents d0d9d62 + 9a471d8 commit ca40556
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions inttest/ap-removedapis/removedapis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package removedapis

import (
"context"
"fmt"
"testing"
"time"
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -103,6 +117,8 @@ spec:
platforms:
linux-amd64:
url: http://localhost/dist/k0s
linux-arm64:
url: http://localhost/dist/k0s
targets:
controllers:
discovery:
Expand Down

0 comments on commit ca40556

Please sign in to comment.