mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 18:48:08 +00:00 
			
		
		
		
	sys/config: config state endpoint (#7424)
* sys/config: initial work on adding config state endpoint * server/config: add tests, fix Sanitized method * thread config through NewTestCluster's config to avoid panic on dev modes * properly guard endpoint against request forwarding * add http tests, guard against panics on nil RawConfig * ensure non-nil rawConfig on NewTestCluster cores * update non-forwarding logic * fix imports; use no-forward handler * add missing config test fixture; update gitignore * return sanitized config as a map * fix test, use deep.Equal to check for equality * fix http test * minor comment fix * config: change Sanitized to return snake-cased keys, update tests * core: hold rlock when reading config; add docstring * update docstring
This commit is contained in:
		 Calvin Leung Huang
					Calvin Leung Huang
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							3415760425
						
					
				
				
					commit
					656b113dbd
				
			| @@ -582,3 +582,24 @@ func TestHTTP_Forwarding_HelpOperation(t *testing.T) { | ||||
| 	testHelp(cores[0].Client) | ||||
| 	testHelp(cores[1].Client) | ||||
| } | ||||
|  | ||||
| func TestHTTP_Forwarding_LocalOnly(t *testing.T) { | ||||
| 	cluster := vault.NewTestCluster(t, nil, &vault.TestClusterOptions{ | ||||
| 		HandlerFunc: Handler, | ||||
| 	}) | ||||
| 	cluster.Start() | ||||
| 	defer cluster.Cleanup() | ||||
| 	cores := cluster.Cores | ||||
|  | ||||
| 	vault.TestWaitActive(t, cores[0].Core) | ||||
|  | ||||
| 	testLocalOnly := func(client *api.Client) { | ||||
| 		_, err := client.Logical().Read("sys/config/state/sanitized") | ||||
| 		if err == nil { | ||||
| 			t.Fatal("expected error") | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	testLocalOnly(cores[1].Client) | ||||
| 	testLocalOnly(cores[2].Client) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user