MCPcopy
hub / github.com/google/seesaw / TestBasicSync

Function TestBasicSync

engine/sync_test.go:85–115  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

83}
84
85func TestBasicSync(t *testing.T) {
86 ln, client, server, dispatcher, err := newSyncTest()
87 if err != nil {
88 t.Fatal(err)
89 }
90 defer ln.Close()
91
92 go client.runOnce()
93 defer func() { client.quit <- true }()
94
95 // The server should send a desync at the start of the session.
96 n, err := dispatcher.nextNote()
97 if err != nil {
98 t.Fatalf("Expected initial desync, got error: %v", err)
99 }
100 if n.Type != SNTDesync {
101 t.Fatalf("Initial note type = %v, want %v", n.Type, SNTDesync)
102 }
103
104 // Send a notification for each sync note type.
105 for nt := range syncNoteTypeNames {
106 server.notify(&SyncNote{Type: nt})
107 n, err := dispatcher.nextNote()
108 if err != nil {
109 t.Fatalf("After sending %v, nextNote failed: %v", nt, err)
110 }
111 if n.Type != nt {
112 t.Errorf("After sending %v, nextNote = %v, want %v", nt, n, nt)
113 }
114 }
115}
116
117func TestSyncHeartbeats(t *testing.T) {
118 ln, client, server, dispatcher, err := newSyncTest()

Callers

nothing calls this directly

Calls 5

newSyncTestFunction · 0.85
nextNoteMethod · 0.80
CloseMethod · 0.65
runOnceMethod · 0.45
notifyMethod · 0.45

Tested by

no test coverage detected