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

Function DevTestFetchConfigManual

rest/bootstrap_test.go:200–247  ·  view source on GitHub ↗

Development-time test, expects locally running Couchbase Server and designed for long-running memory profiling

(t *testing.T)

Source from the content-addressed store, hash-verified

198
199// Development-time test, expects locally running Couchbase Server and designed for long-running memory profiling
200func DevTestFetchConfigManual(t *testing.T) {
201
202 base.SetUpTestLogging(t, base.LevelInfo, base.KeyHTTP)
203
204 serverErr := make(chan error)
205
206 config := DefaultStartupConfig("")
207
208 logLevel := base.LevelInfo
209 config.Logging.Console = &base.ConsoleLoggerConfig{
210 LogLevel: &logLevel,
211 LogKeys: []string{"HTTP", "Config", "CRUD", "DCP", "Sync"},
212 }
213
214 config.API.AdminInterfaceAuthentication = base.Ptr(false)
215
216 config.API.PublicInterface = "127.0.0.1:4984"
217 config.API.AdminInterface = "127.0.0.1:4985"
218 config.API.MetricsInterface = "127.0.0.1:4986"
219
220 config.Bootstrap.Server = "couchbase://localhost"
221 config.Bootstrap.Username = "configUser"
222 config.Bootstrap.Password = "password"
223 config.Bootstrap.ServerTLSSkipVerify = base.Ptr(true)
224 config.Bootstrap.UseTLSServer = base.Ptr(false)
225
226 // Start SG with no databases, high frequency polling
227 config.Bootstrap.ConfigUpdateFrequency = base.NewConfigDuration(time.Second)
228
229 ctx := base.TestCtx(t)
230 sc, err := SetupServerContext(ctx, &config, true)
231 require.NoError(t, err)
232
233 defer func() {
234 sc.Close(ctx)
235 require.NoError(t, <-serverErr)
236 }()
237
238 go func() {
239 serverErr <- StartServer(ctx, &config, sc)
240 }()
241 require.NoError(t, sc.WaitForRESTAPIs(ctx))
242
243 // Sleep to wait for bucket polling iterations, or allow manual modification to server accessibility
244
245 time.Sleep(15 * time.Second)
246
247}

Callers

nothing calls this directly

Calls 9

SetUpTestLoggingFunction · 0.92
PtrFunction · 0.92
NewConfigDurationFunction · 0.92
TestCtxFunction · 0.92
DefaultStartupConfigFunction · 0.85
SetupServerContextFunction · 0.85
StartServerFunction · 0.85
WaitForRESTAPIsMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected