@@ -28,7 +28,7 @@ func TestAppendingRequests(t *testing.T) {
28
28
root := testutil .GenerateCids (1 )[0 ]
29
29
ssb := builder .NewSelectorSpecBuilder (basicnode .Prototype .Any )
30
30
selector := ssb .Matcher ().Node ()
31
- id := graphsync .RequestID ( rand . Int31 () )
31
+ id := graphsync .NewRequestID ( )
32
32
priority := graphsync .Priority (rand .Int31 ())
33
33
34
34
builder := NewBuilder ()
@@ -53,7 +53,7 @@ func TestAppendingRequests(t *testing.T) {
53
53
require .NoError (t , err )
54
54
55
55
pbRequest := pbMessage .Requests [0 ]
56
- require .Equal (t , int32 ( id ) , pbRequest .Id )
56
+ require .Equal (t , id [:] , pbRequest .Id )
57
57
require .Equal (t , int32 (priority ), pbRequest .Priority )
58
58
require .False (t , pbRequest .Cancel )
59
59
require .False (t , pbRequest .Update )
@@ -85,7 +85,7 @@ func TestAppendingResponses(t *testing.T) {
85
85
Name : extensionName ,
86
86
Data : basicnode .NewBytes (extensionBytes ),
87
87
}
88
- requestID := graphsync .RequestID ( rand . Int31 () )
88
+ requestID := graphsync .NewRequestID ( )
89
89
status := graphsync .RequestAcknowledged
90
90
91
91
builder := NewBuilder ()
@@ -105,7 +105,7 @@ func TestAppendingResponses(t *testing.T) {
105
105
pbMessage , err := gsm .ToProto ()
106
106
require .NoError (t , err , "serialize to protobuf errored" )
107
107
pbResponse := pbMessage .Responses [0 ]
108
- require .Equal (t , int32 ( requestID ) , pbResponse .Id )
108
+ require .Equal (t , requestID [:] , pbResponse .Id )
109
109
require .Equal (t , int32 (status ), pbResponse .Status )
110
110
require .Equal (t , extensionBytes , pbResponse .Extensions ["graphsync/awesome" ])
111
111
@@ -157,7 +157,7 @@ func contains(strs []string, x string) bool {
157
157
func TestRequestCancel (t * testing.T ) {
158
158
ssb := builder .NewSelectorSpecBuilder (basicnode .Prototype .Any )
159
159
selector := ssb .Matcher ().Node ()
160
- id := graphsync .RequestID ( rand . Int31 () )
160
+ id := graphsync .NewRequestID ( )
161
161
priority := graphsync .Priority (rand .Int31 ())
162
162
root := testutil .GenerateCids (1 )[0 ]
163
163
@@ -187,7 +187,7 @@ func TestRequestCancel(t *testing.T) {
187
187
188
188
func TestRequestUpdate (t * testing.T ) {
189
189
190
- id := graphsync .RequestID ( rand . Int31 () )
190
+ id := graphsync .NewRequestID ( )
191
191
extensionName := graphsync .ExtensionName ("graphsync/awesome" )
192
192
extension := NamedExtension {
193
193
Name : extensionName ,
@@ -238,7 +238,7 @@ func TestToNetFromNetEquivalency(t *testing.T) {
238
238
Name : extensionName ,
239
239
Data : basicnode .NewBytes (testutil .RandomBytes (100 )),
240
240
}
241
- id := graphsync .RequestID ( rand . Int31 () )
241
+ id := graphsync .NewRequestID ( )
242
242
priority := graphsync .Priority (rand .Int31 ())
243
243
status := graphsync .RequestAcknowledged
244
244
@@ -332,7 +332,7 @@ func TestMergeExtensions(t *testing.T) {
332
332
root := testutil .GenerateCids (1 )[0 ]
333
333
ssb := builder .NewSelectorSpecBuilder (basicnode .Prototype .Any )
334
334
selector := ssb .Matcher ().Node ()
335
- id := graphsync .RequestID ( rand . Int31 () )
335
+ id := graphsync .NewRequestID ( )
336
336
priority := graphsync .Priority (rand .Int31 ())
337
337
defaultRequest := NewRequest (id , root , selector , priority , initialExtensions ... )
338
338
t .Run ("when merging into empty" , func (t * testing.T ) {
0 commit comments