MCPcopy
hub / github.com/syncthing/syncthing / TestRequestInvalidFilename

Function TestRequestInvalidFilename

lib/protocol/protocol_test.go:623–650  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

621}
622
623func TestRequestInvalidFilename(t *testing.T) {
624 m := newTestModel()
625 rw := testutil.NewBlockingRW()
626 c := getRawConnection(NewConnection(c0ID, rw, &testutil.NoopRW{}, testutil.NoopCloser{}, m, new(mockedConnectionInfo), CompressionAlways, testKeyGen))
627 c.Start()
628 defer closeAndWait(c, rw)
629
630 c.inbox <- &bep.ClusterConfig{}
631 c.inbox <- &bep.Request{
632 Id: 1,
633 Name: "../escape",
634 Size: 1024,
635 }
636
637 select {
638 case <-c.dispatcherLoopStopped:
639 case <-time.After(time.Second):
640 t.Fatal("timed out before dispatcher loop terminated")
641 }
642
643 err := m.closedError()
644 if err == nil {
645 t.Fatal("expected connection to be closed with an error")
646 }
647 if !strings.Contains(err.Error(), "protocol error") {
648 t.Errorf("expected a protocol error, got %v", err)
649 }
650}
651
652func TestIndexIDString(t *testing.T) {
653 // Index ID is a 64 bit, zero padded hex integer.

Callers

nothing calls this directly

Calls 10

NewBlockingRWFunction · 0.92
newTestModelFunction · 0.85
getRawConnectionFunction · 0.85
NewConnectionFunction · 0.85
closeAndWaitFunction · 0.85
FatalMethod · 0.80
closedErrorMethod · 0.80
ContainsMethod · 0.80
StartMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected