BootstrapStartupConfigForTest returns a default config for use to start a Sync Gateway server. It will run APIs on randomly chosen ports.
(t *testing.T)
| 22 | |
| 23 | // BootstrapStartupConfigForTest returns a default config for use to start a Sync Gateway server. It will run APIs on randomly chosen ports. |
| 24 | func BootstrapStartupConfigForTest(t *testing.T) StartupConfig { |
| 25 | config := DefaultStartupConfig("") |
| 26 | |
| 27 | config.Logging.Console = &base.ConsoleLoggerConfig{ |
| 28 | LogLevel: base.ConsoleLogLevel(), |
| 29 | LogKeys: base.ConsoleLogKey().EnabledLogKeys(), |
| 30 | } |
| 31 | |
| 32 | config.API.AdminInterfaceAuthentication = base.Ptr(false) |
| 33 | |
| 34 | randomPort := "127.0.0.1:0" |
| 35 | |
| 36 | config.API.PublicInterface = randomPort |
| 37 | config.API.AdminInterface = randomPort |
| 38 | config.API.MetricsInterface = randomPort |
| 39 | config.Unsupported.DiagnosticInterface = randomPort |
| 40 | |
| 41 | config.Bootstrap.Server = base.UnitTestUrl() |
| 42 | config.Bootstrap.Username = base.TestClusterUsername() |
| 43 | config.Bootstrap.Password = base.TestClusterPassword() |
| 44 | config.Bootstrap.ServerTLSSkipVerify = base.Ptr(base.TestTLSSkipVerify()) |
| 45 | config.Bootstrap.UseTLSServer = base.Ptr(base.ServerIsTLS(base.UnitTestUrl())) |
| 46 | |
| 47 | uniqueUUID, err := uuid.NewRandom() |
| 48 | require.NoError(t, err) |
| 49 | |
| 50 | if base.IsEnterpriseEdition() { |
| 51 | config.Bootstrap.ConfigGroupID = uniqueUUID.String() |
| 52 | } else if !base.UnitTestUrlIsWalrus() { |
| 53 | t.Skip("BootstrapStartupConfigForTest requires EE support, since the config files can be read by future tests in the bucket pool") |
| 54 | } |
| 55 | |
| 56 | return config |
| 57 | } |
| 58 | |
| 59 | type boostrapResponse struct { |
| 60 | response *http.Response |