@@ -89,7 +89,7 @@ func (rw *mockReadWriteCloser) Close() error {
89
89
// TestSendPackWithReportStatus tests the SendPack function with ReportStatus capability
90
90
func TestSendPackWithReportStatus (t * testing.T ) {
91
91
caps := capability .NewList ()
92
- caps .Add (capability .ReportStatus )
92
+ caps .Add (capability .ReportStatus ) //nolint:errcheck
93
93
conn := & mockConnection {caps : caps }
94
94
95
95
// Create a mock reader with a valid report status response
@@ -101,6 +101,7 @@ func TestSendPackWithReportStatus(t *testing.T) {
101
101
reader := newMockRWC ([]byte (reportStatusResponse ))
102
102
writer := newMockRWC (nil )
103
103
104
+ var buf bytes.Buffer
104
105
req := & PushRequest {
105
106
Commands : []* packp.Command {
106
107
{
@@ -109,6 +110,7 @@ func TestSendPackWithReportStatus(t *testing.T) {
109
110
New : plumbing .NewHash ("0123456789012345678901234567890123456789" ),
110
111
},
111
112
},
113
+ Packfile : io .NopCloser (& buf ), // Use a buffer to simulate packfile
112
114
}
113
115
114
116
storer := memory .NewStorage ()
@@ -135,6 +137,7 @@ func TestSendPackWithReportStatusError(t *testing.T) {
135
137
reader := newMockRWC ([]byte (reportStatusResponse ))
136
138
writer := newMockRWC (nil )
137
139
140
+ var buf bytes.Buffer
138
141
req := & PushRequest {
139
142
Commands : []* packp.Command {
140
143
{
@@ -143,6 +146,7 @@ func TestSendPackWithReportStatusError(t *testing.T) {
143
146
New : plumbing .NewHash ("0123456789012345678901234567890123456789" ),
144
147
},
145
148
},
149
+ Packfile : io .NopCloser (& buf ), // Use a buffer to simulate packfile
146
150
}
147
151
148
152
// Call SendPack
@@ -167,6 +171,7 @@ func TestSendPackWithoutReportStatus(t *testing.T) {
167
171
reader := newMockRWC (nil )
168
172
writer := newMockRWC (nil )
169
173
174
+ var buf bytes.Buffer
170
175
req := & PushRequest {
171
176
Commands : []* packp.Command {
172
177
{
@@ -175,6 +180,7 @@ func TestSendPackWithoutReportStatus(t *testing.T) {
175
180
New : plumbing .NewHash ("0123456789012345678901234567890123456789" ),
176
181
},
177
182
},
183
+ Packfile : io .NopCloser (& buf ), // Use a buffer to simulate packfile
178
184
}
179
185
180
186
storer := memory .NewStorage ()
@@ -216,6 +222,7 @@ func TestSendPackWithProgress(t *testing.T) {
216
222
// Create a progress buffer to capture progress messages
217
223
progressBuf := & bytes.Buffer {}
218
224
225
+ var buf bytes.Buffer
219
226
req := & PushRequest {
220
227
Commands : []* packp.Command {
221
228
{
@@ -224,6 +231,7 @@ func TestSendPackWithProgress(t *testing.T) {
224
231
New : plumbing .NewHash ("0123456789012345678901234567890123456789" ),
225
232
},
226
233
},
234
+ Packfile : io .NopCloser (& buf ), // Use a buffer to simulate packfile
227
235
Progress : progressBuf ,
228
236
}
229
237
@@ -289,6 +297,7 @@ func TestSendPackErrors(t *testing.T) {
289
297
writer .writeErr = errors .New ("encode error" )
290
298
reader := newMockRWC (nil )
291
299
300
+ var buf bytes.Buffer
292
301
req := & PushRequest {
293
302
Commands : []* packp.Command {
294
303
{
@@ -297,6 +306,7 @@ func TestSendPackErrors(t *testing.T) {
297
306
New : plumbing .NewHash ("0123456789012345678901234567890123456789" ),
298
307
},
299
308
},
309
+ Packfile : io .NopCloser (& buf ), // Use a buffer to simulate packfile
300
310
}
301
311
302
312
storer := memory .NewStorage ()
@@ -336,6 +346,7 @@ func TestSendPackErrors(t *testing.T) {
336
346
writer .closeErr = errors .New ("writer close error" )
337
347
reader := newMockRWC (nil )
338
348
349
+ var buf bytes.Buffer
339
350
req := & PushRequest {
340
351
Commands : []* packp.Command {
341
352
{
@@ -344,6 +355,7 @@ func TestSendPackErrors(t *testing.T) {
344
355
New : plumbing .NewHash ("0123456789012345678901234567890123456789" ),
345
356
},
346
357
},
358
+ Packfile : io .NopCloser (& buf ), // Use a buffer to simulate packfile
347
359
}
348
360
349
361
storer := memory .NewStorage ()
@@ -361,6 +373,7 @@ func TestSendPackErrors(t *testing.T) {
361
373
reader := newMockRWC ([]byte (invalidResponse ))
362
374
writer := newMockRWC (nil )
363
375
376
+ var buf bytes.Buffer
364
377
req := & PushRequest {
365
378
Commands : []* packp.Command {
366
379
{
@@ -369,6 +382,7 @@ func TestSendPackErrors(t *testing.T) {
369
382
New : plumbing .NewHash ("0123456789012345678901234567890123456789" ),
370
383
},
371
384
},
385
+ Packfile : io .NopCloser (& buf ), // Use a buffer to simulate packfile
372
386
}
373
387
374
388
storer := memory .NewStorage ()
@@ -388,6 +402,7 @@ func TestSendPackErrors(t *testing.T) {
388
402
reader .closeErr = errors .New ("reader close error" )
389
403
writer := newMockRWC (nil )
390
404
405
+ var buf bytes.Buffer
391
406
req := & PushRequest {
392
407
Commands : []* packp.Command {
393
408
{
@@ -396,6 +411,7 @@ func TestSendPackErrors(t *testing.T) {
396
411
New : plumbing .NewHash ("0123456789012345678901234567890123456789" ),
397
412
},
398
413
},
414
+ Packfile : io .NopCloser (& buf ), // Use a buffer to simulate packfile
399
415
}
400
416
401
417
storer := memory .NewStorage ()
0 commit comments