(t *testing.T)
| 472 | } |
| 473 | |
| 474 | func TestClusterConfigEncrypted(t *testing.T) { |
| 475 | t.Parallel() |
| 476 | |
| 477 | cfg := config.New(device1) |
| 478 | cfg.Options.MinHomeDiskFree.Value = 0 // avoids unnecessary free space checks |
| 479 | cfg.Devices = []config.DeviceConfiguration{ |
| 480 | { |
| 481 | DeviceID: device1, |
| 482 | }, |
| 483 | { |
| 484 | DeviceID: device2, |
| 485 | }, |
| 486 | } |
| 487 | cfg.Folders = []config.FolderConfiguration{ |
| 488 | { |
| 489 | FilesystemType: config.FilesystemTypeFake, |
| 490 | ID: "folder1", |
| 491 | Path: "testdata1", |
| 492 | Devices: []config.FolderDeviceConfiguration{ |
| 493 | {DeviceID: device1, EncryptionPassword: "trololol"}, // not included, untrusted |
| 494 | {DeviceID: device2}, |
| 495 | }, |
| 496 | }, |
| 497 | { |
| 498 | FilesystemType: config.FilesystemTypeFake, |
| 499 | ID: "folder2", |
| 500 | Path: "testdata2", |
| 501 | Devices: []config.FolderDeviceConfiguration{ |
| 502 | {DeviceID: device1, EncryptionPassword: "trololol"}, // not included, untrusted |
| 503 | {DeviceID: device2, EncryptionPassword: "trololol"}, // included, is destinationd device |
| 504 | }, |
| 505 | }, |
| 506 | { |
| 507 | FilesystemType: config.FilesystemTypeFake, |
| 508 | ID: "folder3", |
| 509 | Path: "testdata3", |
| 510 | Devices: []config.FolderDeviceConfiguration{ |
| 511 | {DeviceID: device1}, |
| 512 | // should not be included, does not include device2 |
| 513 | }, |
| 514 | }, |
| 515 | } |
| 516 | |
| 517 | wrapper, cancel := newConfigWrapper(cfg) |
| 518 | defer cancel() |
| 519 | m := newModel(t, wrapper, myID, nil) |
| 520 | m.ServeBackground() |
| 521 | defer cleanupModel(m) |
| 522 | |
| 523 | cm, _ := m.generateClusterConfig(device2) |
| 524 | |
| 525 | if l := len(cm.Folders); l != 2 { |
| 526 | t.Fatalf("Incorrect number of folders %d != 2", l) |
| 527 | } |
| 528 | |
| 529 | r := cm.Folders[0] |
| 530 | if r.ID != "folder1" { |
| 531 | t.Errorf("Incorrect folder %q != folder1", r.ID) |
nothing calls this directly
no test coverage detected