TestLoadServerConfigExamples will run LoadLegacyServerConfig for configs found under the legacy examples directory.
(t *testing.T)
| 438 | |
| 439 | // TestLoadServerConfigExamples will run LoadLegacyServerConfig for configs found under the legacy examples directory. |
| 440 | func TestLoadServerConfigExamples(t *testing.T) { |
| 441 | const exampleLogDirectory = "../examples/legacy_config" |
| 442 | const configSuffix = ".json" |
| 443 | |
| 444 | const enterpriseConfigPrefix = "ee_" |
| 445 | |
| 446 | err := filepath.Walk(exampleLogDirectory, func(configPath string, file os.FileInfo, err error) error { |
| 447 | assert.NoError(t, err) |
| 448 | |
| 449 | // Skip directories or files that aren't configs |
| 450 | if file.IsDir() || !strings.HasSuffix(file.Name(), configSuffix) { |
| 451 | return nil |
| 452 | } |
| 453 | |
| 454 | // Skip EE configs in CE |
| 455 | if !base.IsEnterpriseEdition() && strings.HasPrefix(file.Name(), enterpriseConfigPrefix) { |
| 456 | return nil |
| 457 | } |
| 458 | |
| 459 | t.Run(configPath, func(tt *testing.T) { |
| 460 | _, err := LoadLegacyServerConfig(base.TestCtx(t), configPath) |
| 461 | assert.NoError(tt, err, "unexpected error validating example config") |
| 462 | }) |
| 463 | |
| 464 | return nil |
| 465 | }) |
| 466 | assert.NoError(t, err) |
| 467 | } |
| 468 | |
| 469 | func TestDeprecatedCacheConfig(t *testing.T) { |
| 470 | // Create new DbConfig |
nothing calls this directly
no test coverage detected