Browse Source

Test encode with replica ID

Jaime Soriano Pastor 7 years ago
parent
commit
c8d0e3b3ff
1 changed files with 10 additions and 0 deletions
  1. 10 0
      offset_request_test.go

+ 10 - 0
offset_request_test.go

@@ -23,6 +23,10 @@ var (
 		0x00, 0x00, 0x00, 0x01,
 		0x00, 0x00, 0x00, 0x04,
 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}
+
+	offsetRequestReplicaID = []byte{
+		0x00, 0x00, 0x00, 0x2a,
+		0x00, 0x00, 0x00, 0x00}
 )
 
 func TestOffsetRequest(t *testing.T) {
@@ -41,3 +45,9 @@ func TestOffsetRequestV1(t *testing.T) {
 	request.AddBlock("bar", 4, 1, 2) // Last argument is ignored for V1
 	testRequest(t, "one block", request, offsetRequestOneBlockV1)
 }
+
+func TestOffsetRequestReplicaID(t *testing.T) {
+	request := new(OffsetRequest)
+	request.SetReplicaID(42)
+	testRequestEncode(t, "with replica ID", request, offsetRequestReplicaID)
+}