backport of commit d5f4243c9efe3970ccf0c6227c27bb2c03f02a31 (#23162)
Co-authored-by: Hamid Ghaf <83242695+hghaf099@users.noreply.github.com>
This commit is contained in:
parent
9da2fc4b8b
commit
e5bee669e4
|
@ -376,14 +376,14 @@ listener "tcp" {
|
|||
cmd.client = serverClient
|
||||
cmd.startedCh = make(chan struct{})
|
||||
|
||||
var output string
|
||||
var code int
|
||||
wg := &sync.WaitGroup{}
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
code := cmd.Run([]string{"-config", configPath})
|
||||
code = cmd.Run([]string{"-config", configPath})
|
||||
if code != 0 {
|
||||
t.Errorf("non-zero return code when running agent: %d", code)
|
||||
t.Logf("STDOUT from agent:\n%s", ui.OutputWriter.String())
|
||||
t.Logf("STDERR from agent:\n%s", ui.ErrorWriter.String())
|
||||
output = ui.ErrorWriter.String() + ui.OutputWriter.String()
|
||||
}
|
||||
wg.Done()
|
||||
}()
|
||||
|
@ -398,6 +398,9 @@ listener "tcp" {
|
|||
defer func() {
|
||||
cmd.ShutdownCh <- struct{}{}
|
||||
wg.Wait()
|
||||
if code != 0 {
|
||||
t.Fatalf("got a non-zero exit status: %d, stdout/stderr: %s", code, output)
|
||||
}
|
||||
}()
|
||||
|
||||
//----------------------------------------------------
|
||||
|
@ -2624,14 +2627,14 @@ listener "tcp" {
|
|||
cmd.client = serverClient
|
||||
cmd.startedCh = make(chan struct{})
|
||||
|
||||
var output string
|
||||
var code int
|
||||
wg := &sync.WaitGroup{}
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
code := cmd.Run([]string{"-config", configPath})
|
||||
code = cmd.Run([]string{"-config", configPath})
|
||||
if code != 0 {
|
||||
t.Errorf("non-zero return code when running agent: %d", code)
|
||||
t.Logf("STDOUT from agent:\n%s", ui.OutputWriter.String())
|
||||
t.Logf("STDERR from agent:\n%s", ui.ErrorWriter.String())
|
||||
output = ui.ErrorWriter.String() + ui.OutputWriter.String()
|
||||
}
|
||||
wg.Done()
|
||||
}()
|
||||
|
@ -2646,6 +2649,9 @@ listener "tcp" {
|
|||
defer func() {
|
||||
cmd.ShutdownCh <- struct{}{}
|
||||
wg.Wait()
|
||||
if code != 0 {
|
||||
t.Fatalf("got a non-zero exit status: %d, stdout/stderr: %s", code, output)
|
||||
}
|
||||
}()
|
||||
|
||||
conf := api.DefaultConfig()
|
||||
|
@ -2939,12 +2945,13 @@ func TestAgent_Config_ReloadTls(t *testing.T) {
|
|||
logger := logging.NewVaultLogger(hclog.Trace)
|
||||
ui, cmd := testAgentCommand(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()
|
||||
}()
|
||||
|
@ -3011,8 +3018,11 @@ func TestAgent_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)
|
||||
}
|
||||
}
|
||||
|
||||
// TestAgent_NonTLSListener_SIGHUP tests giving a SIGHUP signal to a listener
|
||||
|
@ -3056,12 +3066,13 @@ vault {
|
|||
|
||||
cmd.startedCh = make(chan struct{})
|
||||
|
||||
var output string
|
||||
var code int
|
||||
wg := &sync.WaitGroup{}
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
if code := cmd.Run([]string{"-config", configPath}); code != 0 {
|
||||
output := ui.ErrorWriter.String() + ui.OutputWriter.String()
|
||||
t.Errorf("got a non-zero exit status: %s", output)
|
||||
if code = cmd.Run([]string{"-config", configPath}); code != 0 {
|
||||
output = ui.ErrorWriter.String() + ui.OutputWriter.String()
|
||||
}
|
||||
wg.Done()
|
||||
}()
|
||||
|
@ -3082,6 +3093,10 @@ vault {
|
|||
|
||||
close(cmd.ShutdownCh)
|
||||
wg.Wait()
|
||||
|
||||
if code != 0 {
|
||||
t.Fatalf("got a non-zero exit status: %d, stdout/stderr: %s", code, output)
|
||||
}
|
||||
}
|
||||
|
||||
// Get a randomly assigned port and then free it again before returning it.
|
||||
|
|
|
@ -1193,12 +1193,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()
|
||||
}()
|
||||
|
@ -1265,6 +1266,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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue