TestGenerateClientConfig validates the client config generated for display by the HelpHandler.
(t *testing.T)
| 424 | // TestGenerateClientConfig validates the client config generated for display |
| 425 | // by the HelpHandler. |
| 426 | func TestGenerateClientConfig(t *testing.T) { |
| 427 | inName := filepath.Join("testdata", "gen_client_config.in") |
| 428 | wantName := strings.Replace(inName, ".in", ".out", 1) |
| 429 | |
| 430 | b, err := replaceRingPath(inName) |
| 431 | if err != nil { |
| 432 | t.Fatalf("Failed to read high-level server config file: %v", err) |
| 433 | } |
| 434 | b = backslashEscape(b) |
| 435 | var hiLevelConf serverconfig.Config |
| 436 | if err := json.Unmarshal(b, &hiLevelConf); err != nil { |
| 437 | t.Fatalf("Failed to unmarshal server config: %v", err) |
| 438 | } |
| 439 | lowLevelConf, err := serverinit.GenLowLevelConfig(&hiLevelConf) |
| 440 | if err != nil { |
| 441 | t.Fatalf("Failed to generate low-level config: %v", err) |
| 442 | } |
| 443 | generatedConf, err := clientconfig.GenerateClientConfig(lowLevelConf.Export_Obj()) |
| 444 | if err != nil { |
| 445 | t.Fatalf("Failed to generate client config: %v", err) |
| 446 | } |
| 447 | |
| 448 | wb, err := replaceRingPath(wantName) |
| 449 | if err != nil { |
| 450 | t.Fatalf("Failed to read want config file: %v", err) |
| 451 | } |
| 452 | wb = backslashEscape(wb) |
| 453 | var wantConf clientconfig.Config |
| 454 | if err := json.Unmarshal(wb, &wantConf); err != nil { |
| 455 | t.Fatalf("Failed to unmarshall want config: %v", err) |
| 456 | } |
| 457 | |
| 458 | compareConfigurations(t, inName, generatedConf, wantConf) |
| 459 | } |
| 460 | |
| 461 | // TestConfigHandlerRedaction validates that configHandler redacts sensitive |
| 462 | // values, still resulting in a valid JSON document. |
nothing calls this directly
no test coverage detected