Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cherrypick https://github.com/kubernetes-sigs/cli-utils/pull/582 #3059

Merged
merged 1 commit into from
Apr 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 7 additions & 33 deletions thirdparty/cli-utils/apply/applier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -809,38 +809,12 @@ func TestApplier(t *testing.T) {
InventoryPolicy: inventory.PolicyMustMatch,
EmitStatusEvents: true,
},
statusEvents: []pollevent.Event{
{
Type: pollevent.ResourceUpdateEvent,
Resource: &pollevent.ResourceStatus{
Identifier: testutil.ToIdentifier(t, resources["deployment"]),
Status: status.InProgressStatus,
},
},
{
Type: pollevent.ResourceUpdateEvent,
Resource: &pollevent.ResourceStatus{
Identifier: testutil.ToIdentifier(t, resources["deployment"]),
Status: status.CurrentStatus,
},
},
},
expectedStatusEvents: []testutil.ExpEvent{
{
EventType: event.StatusType,
StatusEvent: &testutil.ExpStatusEvent{
Identifier: testutil.ToIdentifier(t, resources["deployment"]),
Status: status.InProgressStatus,
},
},
{
EventType: event.StatusType,
StatusEvent: &testutil.ExpStatusEvent{
Identifier: testutil.ToIdentifier(t, resources["deployment"]),
Status: status.CurrentStatus,
},
},
},
// There could be some status events for the existing Deployment,
// but we can't always expect to receive them before the applier
// exits, because the WaitTask is skipped when the ApplyTask errors.
// So don't bother sending or expecting them.
statusEvents: []pollevent.Event{},
expectedStatusEvents: []testutil.ExpEvent{},
expectedEvents: []testutil.ExpEvent{
{
EventType: event.InitType,
Expand Down Expand Up @@ -1933,7 +1907,7 @@ func TestApplierCancel(t *testing.T) {
var removed int
receivedEvents, removed = testutil.RemoveEqualEvents(receivedEvents, e)
if removed < 1 {
t.Fatalf("Expected status event not received: %#v", e.StatusEvent)
t.Errorf("Expected status event not received: %#v", e.StatusEvent)
}
}

Expand Down