(t *testing.T)
| 31 | } |
| 32 | |
| 33 | func TestShortIDCheck(t *testing.T) { |
| 34 | cfg := config.Wrap(tempCfgFilename(t), config.Configuration{ |
| 35 | Devices: []config.DeviceConfiguration{ |
| 36 | {DeviceID: protocol.DeviceID{8, 16, 24, 32, 40, 48, 56, 0, 0}}, |
| 37 | {DeviceID: protocol.DeviceID{8, 16, 24, 32, 40, 48, 56, 1, 1}}, // first 56 bits same, differ in the first 64 bits |
| 38 | }, |
| 39 | }, protocol.LocalDeviceID, events.NoopLogger) |
| 40 | defer os.Remove(cfg.ConfigPath()) |
| 41 | |
| 42 | if err := checkShortIDs(cfg); err != nil { |
| 43 | t.Error("Unexpected error:", err) |
| 44 | } |
| 45 | |
| 46 | cfg = config.Wrap("/tmp/test", config.Configuration{ |
| 47 | Devices: []config.DeviceConfiguration{ |
| 48 | {DeviceID: protocol.DeviceID{8, 16, 24, 32, 40, 48, 56, 64, 0}}, |
| 49 | {DeviceID: protocol.DeviceID{8, 16, 24, 32, 40, 48, 56, 64, 1}}, // first 64 bits same |
| 50 | }, |
| 51 | }, protocol.LocalDeviceID, events.NoopLogger) |
| 52 | |
| 53 | if err := checkShortIDs(cfg); err == nil { |
| 54 | t.Error("Should have gotten an error") |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | func TestStartupFail(t *testing.T) { |
| 59 | cert, err := tlsutil.NewCertificateInMemory("syncthing", 365) |
nothing calls this directly
no test coverage detected