From 9a386b205c44a17fbd76a4b9f729aa24849d7453 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Fri, 20 Jan 2023 14:19:05 -0800 Subject: [PATCH] Fix resource counts unit tests Increase the timeout slightly to avoid the occasional premature timeout. Fix error message typo. --- pkg/resources/counts/buffer_test.go | 4 ++-- pkg/resources/counts/counts_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/resources/counts/buffer_test.go b/pkg/resources/counts/buffer_test.go index 3219af4..381b70a 100644 --- a/pkg/resources/counts/buffer_test.go +++ b/pkg/resources/counts/buffer_test.go @@ -64,7 +64,7 @@ func Test_countsBuffer(t *testing.T) { } // due to complexities of cycle calculation, give a slight delay for the event to actually stream - output, err := receiveWithTimeout(outputChannel, debounceDuration+time.Millisecond*1) + output, err := receiveWithTimeout(outputChannel, debounceDuration+time.Millisecond*10) assert.NoError(t, err, "did not expect an error when receiving value from channel") outputCount := output.Object.Object.(Count) assert.Len(t, outputCount.Counts, test.numInputEvents) @@ -93,7 +93,7 @@ func receiveWithTimeout(input chan types.APIEvent, duration time.Duration) (*typ case value := <-input: return &value, nil case <-time.After(duration): - return nil, fmt.Errorf("timeout error, no value recieved after %f seconds", duration.Seconds()) + return nil, fmt.Errorf("timeout error, no value received after %f seconds", duration.Seconds()) } } diff --git a/pkg/resources/counts/counts_test.go b/pkg/resources/counts/counts_test.go index bf7567e..755706e 100644 --- a/pkg/resources/counts/counts_test.go +++ b/pkg/resources/counts/counts_test.go @@ -177,7 +177,7 @@ func receiveWithTimeout(input chan types.APIEvent, duration time.Duration) (*typ case value := <-input: return &value, nil case <-time.After(duration): - return nil, fmt.Errorf("timeout error, no value recieved after %f seconds", duration.Seconds()) + return nil, fmt.Errorf("timeout error, no value received after %f seconds", duration.Seconds()) } }