mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 02:28:09 +00:00 
			
		
		
		
	backport of commit d5f4243c9e (#23162)
				
					
				
			Co-authored-by: Hamid Ghaf <83242695+hghaf099@users.noreply.github.com>
This commit is contained in:
		 hc-github-team-secure-vault-core
					hc-github-team-secure-vault-core
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							6d3f5c3352
						
					
				
				
					commit
					31b83d7dac
				
			| @@ -376,14 +376,14 @@ listener "tcp" { | |||||||
| 	cmd.client = serverClient | 	cmd.client = serverClient | ||||||
| 	cmd.startedCh = make(chan struct{}) | 	cmd.startedCh = make(chan struct{}) | ||||||
|  |  | ||||||
|  | 	var output string | ||||||
|  | 	var code int | ||||||
| 	wg := &sync.WaitGroup{} | 	wg := &sync.WaitGroup{} | ||||||
| 	wg.Add(1) | 	wg.Add(1) | ||||||
| 	go func() { | 	go func() { | ||||||
| 		code := cmd.Run([]string{"-config", configPath}) | 		code = cmd.Run([]string{"-config", configPath}) | ||||||
| 		if code != 0 { | 		if code != 0 { | ||||||
| 			t.Errorf("non-zero return code when running agent: %d", code) | 			output = ui.ErrorWriter.String() + ui.OutputWriter.String() | ||||||
| 			t.Logf("STDOUT from agent:\n%s", ui.OutputWriter.String()) |  | ||||||
| 			t.Logf("STDERR from agent:\n%s", ui.ErrorWriter.String()) |  | ||||||
| 		} | 		} | ||||||
| 		wg.Done() | 		wg.Done() | ||||||
| 	}() | 	}() | ||||||
| @@ -398,6 +398,9 @@ listener "tcp" { | |||||||
| 	defer func() { | 	defer func() { | ||||||
| 		cmd.ShutdownCh <- struct{}{} | 		cmd.ShutdownCh <- struct{}{} | ||||||
| 		wg.Wait() | 		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.client = serverClient | ||||||
| 	cmd.startedCh = make(chan struct{}) | 	cmd.startedCh = make(chan struct{}) | ||||||
|  |  | ||||||
|  | 	var output string | ||||||
|  | 	var code int | ||||||
| 	wg := &sync.WaitGroup{} | 	wg := &sync.WaitGroup{} | ||||||
| 	wg.Add(1) | 	wg.Add(1) | ||||||
| 	go func() { | 	go func() { | ||||||
| 		code := cmd.Run([]string{"-config", configPath}) | 		code = cmd.Run([]string{"-config", configPath}) | ||||||
| 		if code != 0 { | 		if code != 0 { | ||||||
| 			t.Errorf("non-zero return code when running agent: %d", code) | 			output = ui.ErrorWriter.String() + ui.OutputWriter.String() | ||||||
| 			t.Logf("STDOUT from agent:\n%s", ui.OutputWriter.String()) |  | ||||||
| 			t.Logf("STDERR from agent:\n%s", ui.ErrorWriter.String()) |  | ||||||
| 		} | 		} | ||||||
| 		wg.Done() | 		wg.Done() | ||||||
| 	}() | 	}() | ||||||
| @@ -2646,6 +2649,9 @@ listener "tcp" { | |||||||
| 	defer func() { | 	defer func() { | ||||||
| 		cmd.ShutdownCh <- struct{}{} | 		cmd.ShutdownCh <- struct{}{} | ||||||
| 		wg.Wait() | 		wg.Wait() | ||||||
|  | 		if code != 0 { | ||||||
|  | 			t.Fatalf("got a non-zero exit status: %d, stdout/stderr: %s", code, output) | ||||||
|  | 		} | ||||||
| 	}() | 	}() | ||||||
|  |  | ||||||
| 	conf := api.DefaultConfig() | 	conf := api.DefaultConfig() | ||||||
| @@ -2939,12 +2945,13 @@ func TestAgent_Config_ReloadTls(t *testing.T) { | |||||||
| 	logger := logging.NewVaultLogger(hclog.Trace) | 	logger := logging.NewVaultLogger(hclog.Trace) | ||||||
| 	ui, cmd := testAgentCommand(t, logger) | 	ui, cmd := testAgentCommand(t, logger) | ||||||
|  |  | ||||||
|  | 	var output string | ||||||
|  | 	var code int | ||||||
| 	wg.Add(1) | 	wg.Add(1) | ||||||
| 	args := []string{"-config", configFile.Name()} | 	args := []string{"-config", configFile.Name()} | ||||||
| 	go func() { | 	go func() { | ||||||
| 		if code := cmd.Run(args); code != 0 { | 		if code = cmd.Run(args); code != 0 { | ||||||
| 			output := ui.ErrorWriter.String() + ui.OutputWriter.String() | 			output = ui.ErrorWriter.String() + ui.OutputWriter.String() | ||||||
| 			t.Errorf("got a non-zero exit status: %s", output) |  | ||||||
| 		} | 		} | ||||||
| 		wg.Done() | 		wg.Done() | ||||||
| 	}() | 	}() | ||||||
| @@ -3011,8 +3018,11 @@ func TestAgent_Config_ReloadTls(t *testing.T) { | |||||||
|  |  | ||||||
| 	// Shut down | 	// Shut down | ||||||
| 	cmd.ShutdownCh <- struct{}{} | 	cmd.ShutdownCh <- struct{}{} | ||||||
|  |  | ||||||
| 	wg.Wait() | 	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 | // TestAgent_NonTLSListener_SIGHUP tests giving a SIGHUP signal to a listener | ||||||
| @@ -3056,12 +3066,13 @@ vault { | |||||||
|  |  | ||||||
| 	cmd.startedCh = make(chan struct{}) | 	cmd.startedCh = make(chan struct{}) | ||||||
|  |  | ||||||
|  | 	var output string | ||||||
|  | 	var code int | ||||||
| 	wg := &sync.WaitGroup{} | 	wg := &sync.WaitGroup{} | ||||||
| 	wg.Add(1) | 	wg.Add(1) | ||||||
| 	go func() { | 	go func() { | ||||||
| 		if code := cmd.Run([]string{"-config", configPath}); code != 0 { | 		if code = cmd.Run([]string{"-config", configPath}); code != 0 { | ||||||
| 			output := ui.ErrorWriter.String() + ui.OutputWriter.String() | 			output = ui.ErrorWriter.String() + ui.OutputWriter.String() | ||||||
| 			t.Errorf("got a non-zero exit status: %s", output) |  | ||||||
| 		} | 		} | ||||||
| 		wg.Done() | 		wg.Done() | ||||||
| 	}() | 	}() | ||||||
| @@ -3082,6 +3093,10 @@ vault { | |||||||
|  |  | ||||||
| 	close(cmd.ShutdownCh) | 	close(cmd.ShutdownCh) | ||||||
| 	wg.Wait() | 	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. | // 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) | 	logger := logging.NewVaultLogger(hclog.Trace) | ||||||
| 	ui, cmd := testProxyCommand(t, logger) | 	ui, cmd := testProxyCommand(t, logger) | ||||||
|  |  | ||||||
|  | 	var output string | ||||||
|  | 	var code int | ||||||
| 	wg.Add(1) | 	wg.Add(1) | ||||||
| 	args := []string{"-config", configFile.Name()} | 	args := []string{"-config", configFile.Name()} | ||||||
| 	go func() { | 	go func() { | ||||||
| 		if code := cmd.Run(args); code != 0 { | 		if code = cmd.Run(args); code != 0 { | ||||||
| 			output := ui.ErrorWriter.String() + ui.OutputWriter.String() | 			output = ui.ErrorWriter.String() + ui.OutputWriter.String() | ||||||
| 			t.Errorf("got a non-zero exit status: %s", output) |  | ||||||
| 		} | 		} | ||||||
| 		wg.Done() | 		wg.Done() | ||||||
| 	}() | 	}() | ||||||
| @@ -1265,6 +1266,9 @@ func TestProxy_Config_ReloadTls(t *testing.T) { | |||||||
|  |  | ||||||
| 	// Shut down | 	// Shut down | ||||||
| 	cmd.ShutdownCh <- struct{}{} | 	cmd.ShutdownCh <- struct{}{} | ||||||
|  |  | ||||||
| 	wg.Wait() | 	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