Fix test
This starts watching for events prior to the start of the controller. This smells like a bug in the fakeclient bits, but it seems to fix the problem. Signed-off-by: Sargun Dhillon <sargun@sargun.me>
This commit is contained in:
@@ -390,10 +390,7 @@ func testDanglingPodScenarioWithDeletionTimestamp(ctx context.Context, t *testin
|
|||||||
_, e := s.client.CoreV1().Pods(testNamespace).Create(ctx, podCopyWithDeletionTimestamp, metav1.CreateOptions{})
|
_, e := s.client.CoreV1().Pods(testNamespace).Create(ctx, podCopyWithDeletionTimestamp, metav1.CreateOptions{})
|
||||||
assert.NilError(t, e)
|
assert.NilError(t, e)
|
||||||
|
|
||||||
// Start the pod controller
|
|
||||||
assert.NilError(t, s.start(ctx))
|
|
||||||
watchErrCh := make(chan error)
|
watchErrCh := make(chan error)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
_, watchErr := watchutils.UntilWithoutRetry(ctx, watcher,
|
_, watchErr := watchutils.UntilWithoutRetry(ctx, watcher,
|
||||||
func(ev watch.Event) (bool, error) {
|
func(ev watch.Event) (bool, error) {
|
||||||
@@ -402,6 +399,9 @@ func testDanglingPodScenarioWithDeletionTimestamp(ctx context.Context, t *testin
|
|||||||
watchErrCh <- watchErr
|
watchErrCh <- watchErr
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
// Start the pod controller
|
||||||
|
assert.NilError(t, s.start(ctx))
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
t.Fatalf("Context ended early: %s", ctx.Err().Error())
|
t.Fatalf("Context ended early: %s", ctx.Err().Error())
|
||||||
|
|||||||
Reference in New Issue
Block a user