MCPcopy
hub / github.com/syncthing/syncthing / initConfig

Function initConfig

lib/connections/limiter_test.go:44–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42}
43
44func initConfig() (config.Wrapper, context.CancelFunc) {
45 wrapper := config.Wrap("/dev/null", config.New(device1), device1, events.NoopLogger)
46 dev1Conf = newDeviceConfiguration(wrapper, device1, "device1")
47 dev2Conf = newDeviceConfiguration(wrapper, device2, "device2")
48 dev3Conf = newDeviceConfiguration(wrapper, device3, "device3")
49 dev4Conf = newDeviceConfiguration(wrapper, device4, "device4")
50
51 ctx, cancel := context.WithCancel(context.Background())
52 go wrapper.Serve(ctx)
53
54 dev2Conf.MaxRecvKbps = rand.Int() % 100000
55 dev2Conf.MaxSendKbps = rand.Int() % 100000
56
57 waiter, _ := wrapper.Modify(func(cfg *config.Configuration) {
58 cfg.SetDevices([]config.DeviceConfiguration{dev1Conf, dev2Conf, dev3Conf, dev4Conf})
59 })
60 waiter.Wait()
61 return wrapper, cancel
62}
63
64func TestLimiterInit(t *testing.T) {
65 wrapper, wrapperCancel := initConfig()

Callers 6

TestLimiterInitFunction · 0.85
TestSetDeviceLimitsFunction · 0.85
TestRemoveDeviceFunction · 0.85
TestAddDeviceFunction · 0.85
TestAddAndRemoveFunction · 0.85
TestHTTPLoginFunction · 0.85

Calls 7

WrapFunction · 0.92
NewFunction · 0.92
SetDevicesMethod · 0.80
newDeviceConfigurationFunction · 0.70
ModifyMethod · 0.65
WaitMethod · 0.65
ServeMethod · 0.45

Tested by

no test coverage detected