mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
fix: Fail in goroutine after tests have completed (#23158)
* fix panic: Fail in goroutine after TestProxy_Config_ReloadTls has completed * fix proxy test * feedback * track the command output code and stdout/err
This commit is contained in:
@@ -1171,12 +1171,13 @@ func TestProxy_Config_ReloadTls(t *testing.T) {
|
||||
logger := logging.NewVaultLogger(hclog.Trace)
|
||||
ui, cmd := testProxyCommand(t, logger)
|
||||
|
||||
var output string
|
||||
var code int
|
||||
wg.Add(1)
|
||||
args := []string{"-config", configFile.Name()}
|
||||
go func() {
|
||||
if code := cmd.Run(args); code != 0 {
|
||||
output := ui.ErrorWriter.String() + ui.OutputWriter.String()
|
||||
t.Errorf("got a non-zero exit status: %s", output)
|
||||
if code = cmd.Run(args); code != 0 {
|
||||
output = ui.ErrorWriter.String() + ui.OutputWriter.String()
|
||||
}
|
||||
wg.Done()
|
||||
}()
|
||||
@@ -1243,6 +1244,9 @@ func TestProxy_Config_ReloadTls(t *testing.T) {
|
||||
|
||||
// Shut down
|
||||
cmd.ShutdownCh <- struct{}{}
|
||||
|
||||
wg.Wait()
|
||||
|
||||
if code != 0 {
|
||||
t.Fatalf("got a non-zero exit status: %d, stdout/stderr: %s", code, output)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user