...
1 package sharedtest
2
3 import (
4 "github.com/launchdarkly/go-server-sdk/v6/subsystems"
5 )
6
7
8 func NewSimpleTestContext(sdkKey string) subsystems.ClientContext {
9 return NewTestContext(sdkKey, nil, nil)
10 }
11
12
13
14 func NewTestContext(
15 sdkKey string,
16 optHTTPConfig *subsystems.HTTPConfiguration,
17 optLoggingConfig *subsystems.LoggingConfiguration,
18 ) subsystems.BasicClientContext {
19 ret := subsystems.BasicClientContext{SDKKey: sdkKey}
20 if optHTTPConfig != nil {
21 ret.HTTP = *optHTTPConfig
22 }
23 if optLoggingConfig != nil {
24 ret.Logging = *optLoggingConfig
25 } else {
26 ret.Logging = TestLoggingConfig()
27 }
28 return ret
29 }
30
31
32 func TestLoggingConfig() subsystems.LoggingConfiguration {
33 return subsystems.LoggingConfiguration{Loggers: NewTestLoggers()}
34 }
35
View as plain text