Skip to content

Commit

Permalink
fix: configmap check
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Tien committed Feb 17, 2025
1 parent f2ead9e commit 61f9054
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ func Add(ctx context.Context, cfg *appconfig.CompletedConfig, mgr manager.Manage
return ok
},
DeleteFunc: func(e event.DeleteEvent) bool {
_, ok := e.Object.(*appsv1beta2.NodePool)
return ok
return false

Check warning on line 85 in pkg/yurtmanager/controller/hubleaderconfig/hubleaderconfig_controller.go

View check run for this annotation

Codecov / codecov/patch

pkg/yurtmanager/controller/hubleaderconfig/hubleaderconfig_controller.go#L85

Added line #L85 was not covered by tests
},
UpdateFunc: func(e event.UpdateEvent) bool {
oldPool, ok := e.ObjectOld.(*appsv1beta2.NodePool)
Expand Down
10 changes: 7 additions & 3 deletions test/e2e/yurt/hubleader.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/client-go/util/retry"
Expand Down Expand Up @@ -304,12 +305,15 @@ var _ = Describe("Hub leader config owner cleanup", func() {
client.ObjectKey{Name: "leader-hub-" + npName, Namespace: metav1.NamespaceSystem},
&v1.ConfigMap{},
)
if err != nil && client.IgnoreNotFound(err) != nil {
if err != nil {
if errors.IsNotFound(err) {
return nil
}
return err
}
return nil
return fmt.Errorf("leader config map still exists")
},
time.Second*5, time.Millisecond*500).Should(BeNil())
time.Second*30, time.Millisecond*500).Should(BeNil())
})
})

Expand Down

0 comments on commit 61f9054

Please sign in to comment.