TestIssue5063 is about a panic in connection with modifying config in quick succession, related with auto accepted folders. It's unclear what exactly, a relevant bit seems to be here: PR-comments: https://github.com/syncthing/syncthing/pull/5069/files#r203146546 Issue: https://github.com/syncthing/s
(t *testing.T)
| 974 | // PR-comments: https://github.com/syncthing/syncthing/pull/5069/files#r203146546 |
| 975 | // Issue: https://github.com/syncthing/syncthing/pull/5509 |
| 976 | func TestIssue5063(t *testing.T) { |
| 977 | m, cancel := newState(t, defaultAutoAcceptCfg) |
| 978 | defer cleanupModel(m) |
| 979 | defer cancel() |
| 980 | |
| 981 | m.mut.Lock() |
| 982 | for _, c := range m.connections { |
| 983 | conn := c.(*fakeConnection) |
| 984 | conn.CloseCalls(func(_ error) {}) |
| 985 | defer m.Closed(c, errStopped) // to unblock deferred m.Stop() |
| 986 | } |
| 987 | m.mut.Unlock() |
| 988 | |
| 989 | wg := sync.WaitGroup{} |
| 990 | |
| 991 | addAndVerify := func(id string) { |
| 992 | m.ClusterConfig(device1Conn, createClusterConfig(device1, id)) |
| 993 | if fcfg, ok := m.cfg.Folder(id); !ok || !fcfg.SharedWith(device1) { |
| 994 | t.Error("expected shared", id) |
| 995 | } |
| 996 | } |
| 997 | |
| 998 | reps := 10 |
| 999 | ids := make([]string, reps) |
| 1000 | for i := 0; i < reps; i++ { |
| 1001 | ids[i] = srand.String(8) |
| 1002 | wg.Go(func() { addAndVerify(ids[i]) }) |
| 1003 | } |
| 1004 | |
| 1005 | finished := make(chan struct{}) |
| 1006 | go func() { |
| 1007 | wg.Wait() |
| 1008 | close(finished) |
| 1009 | }() |
| 1010 | select { |
| 1011 | case <-finished: |
| 1012 | case <-time.After(10 * time.Second): |
| 1013 | pprof.Lookup("goroutine").WriteTo(os.Stdout, 1) |
| 1014 | t.Fatal("Timed out before all devices were added") |
| 1015 | } |
| 1016 | } |
| 1017 | |
| 1018 | func TestAutoAcceptRejected(t *testing.T) { |
| 1019 | // Nothing happens if AutoAcceptFolders not set |
nothing calls this directly
no test coverage detected