(t *testing.T)
| 743 | } |
| 744 | |
| 745 | func TestSetupAndValidateDatabases(t *testing.T) { |
| 746 | ctx := base.TestCtx(t) |
| 747 | // No error will be returned if the server config itself is nil |
| 748 | var sc *LegacyServerConfig |
| 749 | errs := sc.setupAndValidateDatabases(ctx) |
| 750 | assert.Nil(t, errs) |
| 751 | |
| 752 | // Simulate invalid control character in URL while validating and setting up databases; |
| 753 | server := "walrus:\n\r" |
| 754 | bc := &BucketConfig{Server: &server} |
| 755 | databases := make(DbConfigMap, 2) |
| 756 | databases["db1"] = &DbConfig{Name: "db1", BucketConfig: *bc} |
| 757 | |
| 758 | sc = &LegacyServerConfig{Databases: databases} |
| 759 | validationError := sc.setupAndValidateDatabases(ctx) |
| 760 | require.NotNil(t, validationError) |
| 761 | assert.Contains(t, validationError.Error(), "invalid control character in URL") |
| 762 | } |
| 763 | |
| 764 | func TestParseCommandLine(t *testing.T) { |
| 765 | var ( |
nothing calls this directly
no test coverage detected