(t *testing.T)
| 593 | } |
| 594 | |
| 595 | func TestRequestZeroSize(t *testing.T) { |
| 596 | // A zero-sized request should be accepted, since current versions of |
| 597 | // Syncthing send these. See https://github.com/syncthing/syncthing/issues/10709. |
| 598 | m := newTestModel() |
| 599 | rw := testutil.NewBlockingRW() |
| 600 | c := getRawConnection(NewConnection(c0ID, rw, &testutil.NoopRW{}, testutil.NoopCloser{}, m, new(mockedConnectionInfo), CompressionAlways, testKeyGen)) |
| 601 | c.Start() |
| 602 | defer closeAndWait(c, rw) |
| 603 | |
| 604 | c.inbox <- &bep.ClusterConfig{} |
| 605 | c.inbox <- &bep.Request{ |
| 606 | Id: 1, |
| 607 | Name: "valid", |
| 608 | Size: 0, |
| 609 | } |
| 610 | |
| 611 | select { |
| 612 | case res := <-c.outbox: |
| 613 | if msg, ok := res.msg.(*bep.Response); !ok || msg.Id != 1 { |
| 614 | t.Errorf("bad response %#v", msg) |
| 615 | } |
| 616 | case <-c.dispatcherLoopStopped: |
| 617 | t.Fatal("dispatcher loop terminated, expected zero-sized request to be accepted") |
| 618 | case <-time.After(time.Second): |
| 619 | t.Fatal("timed out waiting for response") |
| 620 | } |
| 621 | } |
| 622 | |
| 623 | func TestRequestInvalidFilename(t *testing.T) { |
| 624 | m := newTestModel() |
nothing calls this directly
no test coverage detected