MCPcopy
hub / github.com/syncthing/syncthing / waitForState

Function waitForState

lib/model/model_test.go:1654–1676  ·  view source on GitHub ↗
(t *testing.T, sub events.Subscription, folder, expected string)

Source from the content-addressed store, hash-verified

1652}
1653
1654func waitForState(t *testing.T, sub events.Subscription, folder, expected string) {
1655 t.Helper()
1656 timeout := time.After(5 * time.Second)
1657 var err string
1658 for {
1659 select {
1660 case ev := <-sub.C():
1661 data := ev.Data.(map[string]interface{})
1662 if data["folder"].(string) == folder {
1663 if data["error"] == nil {
1664 err = ""
1665 } else {
1666 err = data["error"].(string)
1667 }
1668 if err == expected {
1669 return
1670 }
1671 }
1672 case <-timeout:
1673 t.Fatalf("Timed out waiting for status: %s, current status: %v", expected, err)
1674 }
1675 }
1676}
1677
1678func TestROScanRecovery(t *testing.T) {
1679 fcfg := config.FolderConfiguration{

Callers 3

TestROScanRecoveryFunction · 0.85
TestRWScanRecoveryFunction · 0.85
TestCustomMarkerNameFunction · 0.85

Calls 2

HelperMethod · 0.80
CMethod · 0.65

Tested by

no test coverage detected