65845c7531
* VAULT-1564 report in-flight requests * adding a changelog * Changing some variable names and fixing comments * minor style change * adding unauthenticated support for in-flight-req * adding documentation for the listener.profiling stanza * adding an atomic counter for the inflight requests addressing comments * addressing comments * logging completed requests * fixing a test * providing log_requests_info as a config option to determine at which level requests should be logged * removing a member and a method from the StatusHeaderResponseWriter struct * adding api docks * revert changes in NewHTTPResponseWriter * Fix logging invalid log_requests_info value * Addressing comments * Fixing a test * use an tomic value for logRequestsInfo, and moving the CreateClientID function to Core * fixing go.sum * minor refactoring * protecting InFlightRequests from data race * another try on fixing a data race * another try to fix a data race * addressing comments * fixing couple of tests * changing log_requests_info to log_requests_level * minor style change * fixing a test * removing the lock in InFlightRequests * use single-argument form for interface assertion * adding doc for the new configuration paramter * adding the new doc to the nav data file * minor fix
71 lines
2.2 KiB
Go
71 lines
2.2 KiB
Go
package http
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
"testing"
|
|
|
|
"github.com/go-test/deep"
|
|
"github.com/hashicorp/vault/vault"
|
|
)
|
|
|
|
func TestSysConfigState_Sanitized(t *testing.T) {
|
|
var resp *http.Response
|
|
|
|
core, _, token := vault.TestCoreUnsealed(t)
|
|
ln, addr := TestServer(t, core)
|
|
defer ln.Close()
|
|
TestServerAuth(t, addr, token)
|
|
|
|
resp = testHttpGet(t, token, addr+"/v1/sys/config/state/sanitized")
|
|
testResponseStatus(t, resp, 200)
|
|
|
|
var actual map[string]interface{}
|
|
var expected map[string]interface{}
|
|
|
|
configResp := map[string]interface{}{
|
|
"api_addr": "",
|
|
"cache_size": json.Number("0"),
|
|
"cluster_addr": "",
|
|
"cluster_cipher_suites": "",
|
|
"cluster_name": "",
|
|
"default_lease_ttl": json.Number("0"),
|
|
"default_max_request_duration": json.Number("0"),
|
|
"disable_cache": false,
|
|
"disable_clustering": false,
|
|
"disable_indexing": false,
|
|
"disable_mlock": false,
|
|
"disable_performance_standby": false,
|
|
"disable_printable_check": false,
|
|
"disable_sealwrap": false,
|
|
"raw_storage_endpoint": false,
|
|
"disable_sentinel_trace": false,
|
|
"enable_ui": false,
|
|
"log_format": "",
|
|
"log_level": "",
|
|
"max_lease_ttl": json.Number("0"),
|
|
"pid_file": "",
|
|
"plugin_directory": "",
|
|
"enable_response_header_hostname": false,
|
|
"enable_response_header_raft_node_id": false,
|
|
"log_requests_level": "",
|
|
}
|
|
|
|
expected = map[string]interface{}{
|
|
"lease_id": "",
|
|
"renewable": false,
|
|
"lease_duration": json.Number("0"),
|
|
"wrap_info": nil,
|
|
"warnings": nil,
|
|
"auth": nil,
|
|
"data": configResp,
|
|
}
|
|
|
|
testResponseBody(t, resp, &actual)
|
|
expected["request_id"] = actual["request_id"]
|
|
|
|
if diff := deep.Equal(actual, expected); len(diff) > 0 {
|
|
t.Fatalf("bad mismatch response body: diff: %v", diff)
|
|
}
|
|
}
|