Skip to content

Commit

Permalink
fix flaky controller tests (kubeflow#899)
Browse files Browse the repository at this point in the history
  • Loading branch information
ifilonenko authored Jun 26, 2020
1 parent 4a4be13 commit d722459
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions pkg/controller/inferenceservice/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,20 +441,6 @@ type SimpleEventWithTime struct {
LastTimestamp metav1.Time
}

type timeSlice []SimpleEventWithTime

func (p timeSlice) Len() int {
return len(p)
}

func (p timeSlice) Less(i, j int) bool {
return p[i].LastTimestamp.Before(&p[j].LastTimestamp)
}

func (p timeSlice) Swap(i, j int) {
p[i], p[j] = p[j], p[i]
}

func getEvents() []SimpleEvent {
events := &v1.EventList{}
if err := c.List(context.TODO(), events); err != nil {
Expand All @@ -464,9 +450,9 @@ func getEvents() []SimpleEvent {
if numEvents == 0 {
return nil
}
sortedEvents := make(timeSlice, 0, numEvents)
sortedEvents := make([]SimpleEventWithTime, 0, numEvents)
for _, event := range events.Items {
if event.Reason != "Updated" { // Not checking for updates
if event.Reason != "Updated" && event.Reason != "InternalError" { // Not checking for updates or errors
sortedEvents = append(sortedEvents, SimpleEventWithTime{
event: SimpleEvent{
Reason: event.Reason,
Expand Down

0 comments on commit d722459

Please sign in to comment.