diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2021-09-17 15:22:12 +0300 |
---|---|---|
committer | Pavlo Strokov <pstrokov@gitlab.com> | 2021-09-22 15:32:42 +0300 |
commit | 641cb8f9b6f86f4b51ce4316ce47655ef2213215 (patch) | |
tree | 89379d994f2029eb349d5516ae78189a7d3a5cfb /internal | |
parent | a47a975ef7d4ef51e0d68c5662d5cb3bb5b83b76 (diff) |
test: Close error channel to allow multiple call for cleanup
The cleanup returned by the runPraefectServer reads for an error
from the channel. If it is run multiple times it blocks on the
second run as it doesn't receive data from the channel. As
there is only a single send to the channel and no one sends anything
else into it we close the channel. With that we can call for
cleanup function multiple times without issues.
Diffstat (limited to 'internal')
-rw-r--r-- | internal/praefect/helper_test.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/praefect/helper_test.go b/internal/praefect/helper_test.go index 0c559047d..e6e8f53ee 100644 --- a/internal/praefect/helper_test.go +++ b/internal/praefect/helper_test.go @@ -200,7 +200,10 @@ func runPraefectServer(t testing.TB, ctx context.Context, conf config.Config, op errQ := make(chan error) ctx, cancel := context.WithCancel(ctx) - go func() { errQ <- prf.Serve(listener) }() + go func() { + errQ <- prf.Serve(listener) + close(errQ) + }() replMgrDone := startProcessBacklog(ctx, replmgr) // dial client to praefect |