|
@@ -31,10 +31,10 @@ func TestPing(t *testing.T) {
|
|
|
ar, aw := io.Pipe()
|
|
ar, aw := io.Pipe()
|
|
|
br, bw := io.Pipe()
|
|
br, bw := io.Pipe()
|
|
|
|
|
|
|
|
- c0 := NewConnection(c0ID, ar, bw, newTestModel(), "name", CompressionAlways).(wireFormatConnection).Connection.(*rawConnection)
|
|
|
|
|
|
|
+ c0 := NewConnection(c0ID, ar, bw, testutils.NoopCloser{}, newTestModel(), &testutils.FakeConnectionInfo{"name"}, CompressionAlways).(wireFormatConnection).Connection.(*rawConnection)
|
|
|
c0.Start()
|
|
c0.Start()
|
|
|
defer closeAndWait(c0, ar, bw)
|
|
defer closeAndWait(c0, ar, bw)
|
|
|
- c1 := NewConnection(c1ID, br, aw, newTestModel(), "name", CompressionAlways).(wireFormatConnection).Connection.(*rawConnection)
|
|
|
|
|
|
|
+ c1 := NewConnection(c1ID, br, aw, testutils.NoopCloser{}, newTestModel(), &testutils.FakeConnectionInfo{"name"}, CompressionAlways).(wireFormatConnection).Connection.(*rawConnection)
|
|
|
c1.Start()
|
|
c1.Start()
|
|
|
defer closeAndWait(c1, ar, bw)
|
|
defer closeAndWait(c1, ar, bw)
|
|
|
c0.ClusterConfig(ClusterConfig{})
|
|
c0.ClusterConfig(ClusterConfig{})
|
|
@@ -57,10 +57,10 @@ func TestClose(t *testing.T) {
|
|
|
ar, aw := io.Pipe()
|
|
ar, aw := io.Pipe()
|
|
|
br, bw := io.Pipe()
|
|
br, bw := io.Pipe()
|
|
|
|
|
|
|
|
- c0 := NewConnection(c0ID, ar, bw, m0, "name", CompressionAlways).(wireFormatConnection).Connection.(*rawConnection)
|
|
|
|
|
|
|
+ c0 := NewConnection(c0ID, ar, bw, testutils.NoopCloser{}, m0, &testutils.FakeConnectionInfo{"name"}, CompressionAlways).(wireFormatConnection).Connection.(*rawConnection)
|
|
|
c0.Start()
|
|
c0.Start()
|
|
|
defer closeAndWait(c0, ar, bw)
|
|
defer closeAndWait(c0, ar, bw)
|
|
|
- c1 := NewConnection(c1ID, br, aw, m1, "name", CompressionAlways)
|
|
|
|
|
|
|
+ c1 := NewConnection(c1ID, br, aw, testutils.NoopCloser{}, m1, &testutils.FakeConnectionInfo{"name"}, CompressionAlways)
|
|
|
c1.Start()
|
|
c1.Start()
|
|
|
defer closeAndWait(c1, ar, bw)
|
|
defer closeAndWait(c1, ar, bw)
|
|
|
c0.ClusterConfig(ClusterConfig{})
|
|
c0.ClusterConfig(ClusterConfig{})
|
|
@@ -102,7 +102,7 @@ func TestCloseOnBlockingSend(t *testing.T) {
|
|
|
m := newTestModel()
|
|
m := newTestModel()
|
|
|
|
|
|
|
|
rw := testutils.NewBlockingRW()
|
|
rw := testutils.NewBlockingRW()
|
|
|
- c := NewConnection(c0ID, rw, rw, m, "name", CompressionAlways).(wireFormatConnection).Connection.(*rawConnection)
|
|
|
|
|
|
|
+ c := NewConnection(c0ID, rw, rw, testutils.NoopCloser{}, m, &testutils.FakeConnectionInfo{"name"}, CompressionAlways).(wireFormatConnection).Connection.(*rawConnection)
|
|
|
c.Start()
|
|
c.Start()
|
|
|
defer closeAndWait(c, rw)
|
|
defer closeAndWait(c, rw)
|
|
|
|
|
|
|
@@ -153,10 +153,10 @@ func TestCloseRace(t *testing.T) {
|
|
|
ar, aw := io.Pipe()
|
|
ar, aw := io.Pipe()
|
|
|
br, bw := io.Pipe()
|
|
br, bw := io.Pipe()
|
|
|
|
|
|
|
|
- c0 := NewConnection(c0ID, ar, bw, m0, "c0", CompressionNever).(wireFormatConnection).Connection.(*rawConnection)
|
|
|
|
|
|
|
+ c0 := NewConnection(c0ID, ar, bw, testutils.NoopCloser{}, m0, &testutils.FakeConnectionInfo{"c0"}, CompressionNever).(wireFormatConnection).Connection.(*rawConnection)
|
|
|
c0.Start()
|
|
c0.Start()
|
|
|
defer closeAndWait(c0, ar, bw)
|
|
defer closeAndWait(c0, ar, bw)
|
|
|
- c1 := NewConnection(c1ID, br, aw, m1, "c1", CompressionNever)
|
|
|
|
|
|
|
+ c1 := NewConnection(c1ID, br, aw, testutils.NoopCloser{}, m1, &testutils.FakeConnectionInfo{"c1"}, CompressionNever)
|
|
|
c1.Start()
|
|
c1.Start()
|
|
|
defer closeAndWait(c1, ar, bw)
|
|
defer closeAndWait(c1, ar, bw)
|
|
|
c0.ClusterConfig(ClusterConfig{})
|
|
c0.ClusterConfig(ClusterConfig{})
|
|
@@ -193,7 +193,7 @@ func TestClusterConfigFirst(t *testing.T) {
|
|
|
m := newTestModel()
|
|
m := newTestModel()
|
|
|
|
|
|
|
|
rw := testutils.NewBlockingRW()
|
|
rw := testutils.NewBlockingRW()
|
|
|
- c := NewConnection(c0ID, rw, &testutils.NoopRW{}, m, "name", CompressionAlways).(wireFormatConnection).Connection.(*rawConnection)
|
|
|
|
|
|
|
+ c := NewConnection(c0ID, rw, &testutils.NoopRW{}, testutils.NoopCloser{}, m, &testutils.FakeConnectionInfo{"name"}, CompressionAlways).(wireFormatConnection).Connection.(*rawConnection)
|
|
|
c.Start()
|
|
c.Start()
|
|
|
defer closeAndWait(c, rw)
|
|
defer closeAndWait(c, rw)
|
|
|
|
|
|
|
@@ -245,7 +245,7 @@ func TestCloseTimeout(t *testing.T) {
|
|
|
m := newTestModel()
|
|
m := newTestModel()
|
|
|
|
|
|
|
|
rw := testutils.NewBlockingRW()
|
|
rw := testutils.NewBlockingRW()
|
|
|
- c := NewConnection(c0ID, rw, rw, m, "name", CompressionAlways).(wireFormatConnection).Connection.(*rawConnection)
|
|
|
|
|
|
|
+ c := NewConnection(c0ID, rw, rw, testutils.NoopCloser{}, m, &testutils.FakeConnectionInfo{"name"}, CompressionAlways).(wireFormatConnection).Connection.(*rawConnection)
|
|
|
c.Start()
|
|
c.Start()
|
|
|
defer closeAndWait(c, rw)
|
|
defer closeAndWait(c, rw)
|
|
|
|
|
|
|
@@ -865,7 +865,7 @@ func TestClusterConfigAfterClose(t *testing.T) {
|
|
|
m := newTestModel()
|
|
m := newTestModel()
|
|
|
|
|
|
|
|
rw := testutils.NewBlockingRW()
|
|
rw := testutils.NewBlockingRW()
|
|
|
- c := NewConnection(c0ID, rw, rw, m, "name", CompressionAlways).(wireFormatConnection).Connection.(*rawConnection)
|
|
|
|
|
|
|
+ c := NewConnection(c0ID, rw, rw, testutils.NoopCloser{}, m, &testutils.FakeConnectionInfo{"name"}, CompressionAlways).(wireFormatConnection).Connection.(*rawConnection)
|
|
|
c.Start()
|
|
c.Start()
|
|
|
defer closeAndWait(c, rw)
|
|
defer closeAndWait(c, rw)
|
|
|
|
|
|
|
@@ -889,7 +889,7 @@ func TestDispatcherToCloseDeadlock(t *testing.T) {
|
|
|
// the model callbacks (ClusterConfig).
|
|
// the model callbacks (ClusterConfig).
|
|
|
m := newTestModel()
|
|
m := newTestModel()
|
|
|
rw := testutils.NewBlockingRW()
|
|
rw := testutils.NewBlockingRW()
|
|
|
- c := NewConnection(c0ID, rw, &testutils.NoopRW{}, m, "name", CompressionAlways).(wireFormatConnection).Connection.(*rawConnection)
|
|
|
|
|
|
|
+ c := NewConnection(c0ID, rw, &testutils.NoopRW{}, testutils.NoopCloser{}, m, &testutils.FakeConnectionInfo{"name"}, CompressionAlways).(wireFormatConnection).Connection.(*rawConnection)
|
|
|
m.ccFn = func(devID DeviceID, cc ClusterConfig) {
|
|
m.ccFn = func(devID DeviceID, cc ClusterConfig) {
|
|
|
c.Close(errManual)
|
|
c.Close(errManual)
|
|
|
}
|
|
}
|