Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
fix(ingress): increase timeout for TestHandleCertificateChange
Browse files Browse the repository at this point in the history
Adds a delay for subscription time and adds a delay after
publishing an event for `maxTimeForEventToBePublished`. The
original 2s delay for the secret to be created after publishing a
mesh config update event included the time to publish the event
and the time to issue a certificate. The max time alone for
publishing an event is 2s, so in some cases, this unit test may
have sexceeded the timeout.

Resolves #4366

Signed-off-by: jaellio <[email protected]>
  • Loading branch information
jaellio authored and nojnhuh committed Jan 7, 2022
1 parent 660a0c8 commit 52e596c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/ingress/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
)

const (
maxTimeToSubscribe = 500 * time.Millisecond
maxTimeForEventToBePublished = 2 * time.Second
maxSecretPollTime = 2 * time.Second
secretPollInterval = 25 * time.Millisecond
Expand Down Expand Up @@ -335,7 +336,7 @@ func TestHandleCertificateChange(t *testing.T) {

go c.handleCertificateChange(tc.previousCertSpec, tc.stopChan)
defer close(tc.stopChan)
time.Sleep(maxTimeForEventToBePublished)
time.Sleep(maxTimeToSubscribe)

// If a secret is supposed to exist, create it
if tc.previousCertSpec != nil {
Expand All @@ -349,6 +350,7 @@ func TestHandleCertificateChange(t *testing.T) {
NewObj: tc.updatedMeshConfig,
OldObj: tc.previousMeshConfig,
}, announcements.MeshConfigUpdated.String())
time.Sleep(maxTimeForEventToBePublished)
}

if !tc.expectSecretToExist {
Expand Down

0 comments on commit 52e596c

Please sign in to comment.