MCPcopy
hub / github.com/syncthing/syncthing / init

Function init

lib/model/testutils_test.go:36–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34)
35
36func init() {
37 myID, _ = protocol.DeviceIDFromString("ZNWFSWE-RWRV2BD-45BLMCV-LTDE2UR-4LJDW6J-R5BPWEB-TXD27XJ-IZF5RA4")
38 device1, _ = protocol.DeviceIDFromString("AIR6LPZ-7K4PTTV-UXQSMUU-CPQ5YWH-OEDFIIQ-JUG777G-2YQXXR5-YD6AWQR")
39 device2, _ = protocol.DeviceIDFromString("GYRZZQB-IRNPV4Z-T7TC52W-EQYJ3TT-FDQW6MW-DFLMU42-SSSU6EM-FBK2VAY")
40 device1Conn.DeviceIDReturns(device1)
41 device1Conn.ConnectionIDReturns(rand.String(16))
42 device2Conn.DeviceIDReturns(device2)
43 device2Conn.ConnectionIDReturns(rand.String(16))
44
45 cfg := config.New(myID)
46 cfg.Options.MinHomeDiskFree.Value = 0 // avoids unnecessary free space checks
47 defaultCfgWrapper, defaultCfgWrapperCancel = newConfigWrapper(cfg)
48
49 defaultFolderConfig = newFolderConfig()
50
51 waiter, _ := defaultCfgWrapper.Modify(func(cfg *config.Configuration) {
52 cfg.SetDevice(newDeviceConfiguration(cfg.Defaults.Device, device1, "device1"))
53 cfg.SetFolder(defaultFolderConfig)
54 cfg.Options.KeepTemporariesH = 1
55 })
56 waiter.Wait()
57
58 defaultCfg = defaultCfgWrapper.RawCopy()
59
60 defaultAutoAcceptCfg = config.Configuration{
61 Version: config.CurrentVersion,
62 Devices: []config.DeviceConfiguration{
63 {
64 DeviceID: myID, // self
65 },
66 {
67 DeviceID: device1,
68 AutoAcceptFolders: true,
69 },
70 {
71 DeviceID: device2,
72 AutoAcceptFolders: true,
73 },
74 },
75 Defaults: config.Defaults{
76 Folder: config.FolderConfiguration{
77 FilesystemType: config.FilesystemTypeFake,
78 Path: rand.String(32),
79 },
80 },
81 Options: config.OptionsConfiguration{
82 MinHomeDiskFree: config.Size{}, // avoids unnecessary free space checks
83 },
84 }
85}
86
87func newConfigWrapper(cfg config.Configuration) (config.Wrapper, context.CancelFunc) {
88 return newConfigWrapperFromContext(context.Background(), cfg)

Callers

nothing calls this directly

Calls 13

DeviceIDFromStringFunction · 0.92
StringFunction · 0.92
NewFunction · 0.92
newConfigWrapperFunction · 0.85
newFolderConfigFunction · 0.85
DeviceIDReturnsMethod · 0.80
SetDeviceMethod · 0.80
SetFolderMethod · 0.80
newDeviceConfigurationFunction · 0.70
ModifyMethod · 0.65
WaitMethod · 0.65
RawCopyMethod · 0.65

Tested by

no test coverage detected