MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestSetupAndValidateDatabases

Function TestSetupAndValidateDatabases

rest/config_test.go:745–762  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

743}
744
745func 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
764func TestParseCommandLine(t *testing.T) {
765 var (

Callers

nothing calls this directly

Calls 4

TestCtxFunction · 0.92
ContainsMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected