@@ -27,12 +27,11 @@ import (
2727 "k8s.io/klog/v2"
2828 cmdtesting "k8s.io/kubectl/pkg/cmd/testing"
2929 "k8s.io/kubectl/pkg/scheme"
30- "sigs.k8s.io/cli-utils/pkg/apply/poller"
3130 "sigs.k8s.io/cli-utils/pkg/common"
3231 "sigs.k8s.io/cli-utils/pkg/inventory"
3332 "sigs.k8s.io/cli-utils/pkg/jsonpath"
34- "sigs.k8s.io/cli-utils/pkg/kstatus/polling"
3533 pollevent "sigs.k8s.io/cli-utils/pkg/kstatus/polling/event"
34+ "sigs.k8s.io/cli-utils/pkg/kstatus/watcher"
3635 "sigs.k8s.io/cli-utils/pkg/object"
3736)
3837
@@ -74,7 +73,7 @@ func newTestApplier(
7473 invInfo inventoryInfo ,
7574 resources object.UnstructuredSet ,
7675 clusterObjs object.UnstructuredSet ,
77- statusPoller poller. Poller ,
76+ statusWatcher watcher. StatusWatcher ,
7877) * Applier {
7978 tf := newTestFactory (t , invInfo , resources , clusterObjs )
8079 defer tf .Cleanup ()
@@ -88,7 +87,7 @@ func newTestApplier(
8887 applier , err := NewApplierBuilder ().
8988 WithFactory (tf ).
9089 WithInventoryClient (invClient ).
91- WithStatusPoller ( statusPoller ).
90+ WithStatusWatcher ( statusWatcher ).
9291 Build ()
9392 require .NoError (t , err )
9493
@@ -103,7 +102,7 @@ func newTestDestroyer(
103102 t * testing.T ,
104103 invInfo inventoryInfo ,
105104 clusterObjs object.UnstructuredSet ,
106- statusPoller poller. Poller ,
105+ statusWatcher watcher. StatusWatcher ,
107106) * Destroyer {
108107 tf := newTestFactory (t , invInfo , object.UnstructuredSet {}, clusterObjs )
109108 defer tf .Cleanup ()
@@ -112,7 +111,7 @@ func newTestDestroyer(
112111
113112 destroyer , err := NewDestroyer (tf , invClient )
114113 require .NoError (t , err )
115- destroyer .StatusPoller = statusPoller
114+ destroyer .statusWatcher = statusWatcher
116115
117116 return destroyer
118117}
@@ -345,27 +344,29 @@ func (n *nsHandler) handle(t *testing.T, req *http.Request) (*http.Response, boo
345344 return nil , false , nil
346345}
347346
348- type fakePoller struct {
347+ type fakeWatcher struct {
349348 start chan struct {}
350349 events []pollevent.Event
351350}
352351
353- func newFakePoller (statusEvents []pollevent.Event ) * fakePoller {
354- return & fakePoller {
352+ func newFakeWatcher (statusEvents []pollevent.Event ) * fakeWatcher {
353+ return & fakeWatcher {
355354 events : statusEvents ,
356355 start : make (chan struct {}),
357356 }
358357}
359358
360359// Start events being sent on the status channel
361- func (f * fakePoller ) Start () {
360+ func (f * fakeWatcher ) Start () {
362361 close (f .start )
363362}
364363
365- func (f * fakePoller ) Poll (ctx context.Context , _ object.ObjMetadataSet , _ polling. PollOptions ) <- chan pollevent.Event {
364+ func (f * fakeWatcher ) Watch (ctx context.Context , _ object.ObjMetadataSet , _ watcher. Options ) <- chan pollevent.Event {
366365 eventChannel := make (chan pollevent.Event )
367366 go func () {
368367 defer close (eventChannel )
368+ // send sync event immediately
369+ eventChannel <- pollevent.Event {Type : pollevent .SyncEvent }
369370 // wait until started to send the events
370371 <- f .start
371372 for _ , f := range f .events {
0 commit comments