mirror of https://github.com/hashicorp/consul
Backport of Fix panicky xDS test flakes into release/1.15.x (#16310)
* backport of commitpull/16306/head^201ca6e268b
* backport of commit485cb4d88d
--------- Co-authored-by: Andrew Stucki <andrew.stucki@hashicorp.com>
parent
94f4347ffe
commit
3cba165d78
|
@ -85,6 +85,8 @@ type TestEnvoy struct {
|
|||
EnvoyVersion string
|
||||
|
||||
deltaStream *TestADSDeltaStream // Incremental v3
|
||||
|
||||
closed bool
|
||||
}
|
||||
|
||||
// NewTestEnvoy creates a TestEnvoy instance.
|
||||
|
@ -225,9 +227,9 @@ func (e *TestEnvoy) Close() error {
|
|||
defer e.mu.Unlock()
|
||||
|
||||
// unblock the recv chans to simulate recv errors when client disconnects
|
||||
if e.deltaStream != nil && e.deltaStream.recvCh != nil {
|
||||
if !e.closed && e.deltaStream.recvCh != nil {
|
||||
close(e.deltaStream.recvCh)
|
||||
e.deltaStream = nil
|
||||
e.closed = true
|
||||
}
|
||||
if e.cancel != nil {
|
||||
e.cancel()
|
||||
|
|
Loading…
Reference in New Issue