@@ -15,8 +15,7 @@ interface TestConfig {
15
15
spec ?: string
16
16
skip ?: string [ ]
17
17
run ?: string [ ]
18
- maxFailures : number
19
- minimumSuccesses ?: number
18
+ successRate : number
20
19
}
21
20
22
21
function getGatewayConformanceBinaryPath ( ) : string {
@@ -43,224 +42,219 @@ function getConformanceTestArgs (name: string, gwcArgs: string[] = [], goTestArg
43
42
]
44
43
}
45
44
45
+ /**
46
+ * You can see what the latest success rates are by running the following command:
47
+ *
48
+ * ```
49
+ * cd ../../ && npm run build && cd packages/gateway-conformance && SUCCESS_RATE=100 npm run test -- --bail false
50
+ * ```
51
+ */
46
52
const tests : TestConfig [ ] = [
47
53
{
48
54
name : 'TestMetadata' ,
49
55
run : [ 'TestMetadata' ] ,
50
- maxFailures : 0 ,
51
- minimumSuccesses : 1
56
+ successRate : 100
52
57
} ,
53
58
{
54
59
name : 'TestDagPbConversion' ,
55
60
run : [ 'TestDagPbConversion' ] ,
56
- maxFailures : 51 ,
57
- minimumSuccesses : 14
61
+ successRate : 35.38
58
62
} ,
59
63
{
60
64
name : 'TestPlainCodec' ,
61
65
run : [ 'TestPlainCodec' ] ,
62
- maxFailures : 83 ,
63
- minimumSuccesses : 15
66
+ successRate : 39.86
64
67
} ,
65
68
{
66
69
name : 'TestPathing' ,
67
70
run : [ 'TestPathing' ] ,
68
- maxFailures : 13 ,
69
- minimumSuccesses : 0
71
+ successRate : 23.53
70
72
} ,
71
73
{
72
74
name : 'TestDNSLinkGatewayUnixFSDirectoryListing' ,
73
75
run : [ 'TestDNSLinkGatewayUnixFSDirectoryListing' ] ,
74
- maxFailures : 20 ,
75
- minimumSuccesses : 0
76
+ successRate : 0
76
77
} ,
77
78
{
78
79
name : 'TestCors' ,
79
80
run : [ 'TestCors' ] ,
80
- maxFailures : 11 ,
81
- minimumSuccesses : 0
81
+ successRate : 0
82
82
} ,
83
83
{
84
84
name : 'TestGatewayJsonCbor' ,
85
85
run : [ 'TestGatewayJsonCbor' ] ,
86
- maxFailures : 9 ,
87
- minimumSuccesses : 0
86
+ successRate : 44.44
88
87
} ,
89
88
// currently results in an infinite loop without verified-fetch stopping the request whether sessions are enabled or not.
90
89
// {
91
90
// name: 'TestNativeDag',
92
91
// run: ['TestNativeDag'],
93
- // maxFailures: 2,
94
- // minimumSuccesses: 0
92
+ // successRate: 100
95
93
// },
96
94
{
97
95
name : 'TestGatewayJSONCborAndIPNS' ,
98
96
run : [ 'TestGatewayJSONCborAndIPNS' ] ,
99
- maxFailures : 25 ,
100
- minimumSuccesses : 8
97
+ successRate : 24.24
101
98
} ,
102
99
{
103
100
name : 'TestGatewayIPNSPath' ,
104
101
run : [ 'TestGatewayIPNSPath' ] ,
105
- maxFailures : 8 ,
106
- minimumSuccesses : 3
102
+ successRate : 27.27
107
103
} ,
108
104
{
109
105
name : 'TestRedirectCanonicalIPNS' ,
110
106
run : [ 'TestRedirectCanonicalIPNS' ] ,
111
- maxFailures : 7 ,
112
- minimumSuccesses : 0
107
+ successRate : 0
113
108
} ,
114
109
{
115
110
name : 'TestGatewayBlock' ,
116
111
run : [ 'TestGatewayBlock' ] ,
117
- maxFailures : 25 ,
118
- minimumSuccesses : 4
112
+ successRate : 37.93
119
113
} ,
120
114
{
121
115
name : 'TestTrustlessRawRanges' ,
122
116
run : [ 'TestTrustlessRawRanges' ] ,
123
- maxFailures : 5 ,
124
- minimumSuccesses : 7
117
+ successRate : 75
125
118
} ,
126
119
{
127
120
name : 'TestTrustlessRaw' ,
128
121
run : [ 'TestTrustlessRaw' ] ,
129
- maxFailures : 29 ,
130
- minimumSuccesses : 7
122
+ successRate : 55.56
131
123
} ,
132
124
{
133
125
name : 'TestGatewayIPNSRecord' ,
134
126
run : [ 'TestGatewayIPNSRecord' ] ,
135
- maxFailures : 23 ,
136
- minimumSuccesses : 0
127
+ successRate : 0
137
128
} ,
138
129
{
139
130
name : 'TestTrustlessCarOrderAndDuplicates' ,
140
131
run : [ 'TestTrustlessCarOrderAndDuplicates' ] ,
141
- maxFailures : 26 ,
142
- minimumSuccesses : 3
132
+ successRate : 13.79
143
133
} ,
144
134
// times out
145
135
// {
146
136
// name: 'TestTrustlessCarEntityBytes',
147
137
// run: ['TestTrustlessCarEntityBytes'],
148
- // maxFailures: 122,
149
- // minimumSuccesses: 55
138
+ // successRate: 100
150
139
// },
151
140
{
152
141
name : 'TestTrustlessCarDagScopeAll' ,
153
142
run : [ 'TestTrustlessCarDagScopeAll' ] ,
154
- maxFailures : 23 ,
155
- minimumSuccesses : 10
143
+ successRate : 36.36
156
144
} ,
157
145
{
158
146
name : 'TestTrustlessCarDagScopeEntity' ,
159
147
run : [ 'TestTrustlessCarDagScopeEntity' ] ,
160
- maxFailures : 56 ,
161
- minimumSuccesses : 25
148
+ successRate : 34.57
162
149
} ,
163
150
{
164
151
name : 'TestTrustlessCarDagScopeBlock' ,
165
152
run : [ 'TestTrustlessCarDagScopeBlock' ] ,
166
- maxFailures : 34 ,
167
- minimumSuccesses : 15
153
+ successRate : 34.69
168
154
} ,
169
155
{
170
156
name : 'TestTrustlessCarPathing' ,
171
157
run : [ 'TestTrustlessCarPathing' ] ,
172
- maxFailures : 45 ,
173
- minimumSuccesses : 20
158
+ successRate : 33.85
174
159
} ,
175
160
{
176
161
name : 'TestSubdomainGatewayDNSLinkInlining' ,
177
162
run : [ 'TestSubdomainGatewayDNSLinkInlining' ] ,
178
- maxFailures : 41 ,
179
- minimumSuccesses : 0
163
+ successRate : 0
180
164
} ,
181
165
{
182
166
name : 'TestGatewaySubdomainAndIPNS' ,
183
167
run : [ 'TestGatewaySubdomainAndIPNS' ] ,
184
- maxFailures : 95 ,
185
- minimumSuccesses : 0
168
+ successRate : 0
186
169
} ,
187
170
{
188
171
name : 'TestGatewaySubdomains' ,
189
172
run : [ 'TestGatewaySubdomains' ] ,
190
- maxFailures : 279 ,
191
- minimumSuccesses : 0
173
+ successRate : 7.17
192
174
} ,
193
175
// times out
194
176
// {
195
177
// name: 'TestUnixFSDirectoryListingOnSubdomainGateway',
196
178
// run: ['TestUnixFSDirectoryListingOnSubdomainGateway'],
197
- // maxFailures: 39,
198
- // minimumSuccesses: 0
179
+ // successRate: 100
199
180
// },
200
181
{
201
182
name : 'TestRedirectsFileWithIfNoneMatchHeader' ,
202
183
run : [ 'TestRedirectsFileWithIfNoneMatchHeader' ] ,
203
- maxFailures : 15 ,
204
- minimumSuccesses : 0
184
+ successRate : 0
205
185
} ,
206
186
{
207
187
name : 'TestRedirectsFileSupportWithDNSLink' ,
208
188
run : [ 'TestRedirectsFileSupportWithDNSLink' ] ,
209
- maxFailures : 17 ,
210
- minimumSuccesses : 6
189
+ successRate : 26.09
211
190
} ,
212
191
{
213
192
name : 'TestRedirectsFileSupport' ,
214
193
run : [ 'TestRedirectsFileSupport' ] ,
215
- maxFailures : 252 ,
216
- minimumSuccesses : 6
194
+ successRate : 2.33
217
195
} ,
218
196
{
219
197
name : 'TestPathGatewayMiscellaneous' ,
220
198
run : [ 'TestPathGatewayMiscellaneous' ] ,
221
- maxFailures : 3 ,
222
- minimumSuccesses : 0
199
+ successRate : 100
223
200
} ,
224
201
{
225
202
name : 'TestGatewayUnixFSFileRanges' ,
226
203
run : [ 'TestGatewayUnixFSFileRanges' ] ,
227
- maxFailures : 10 ,
228
- minimumSuccesses : 5
204
+ successRate : 40
229
205
} ,
230
206
{
231
207
name : 'TestGatewaySymlink' ,
232
208
run : [ 'TestGatewaySymlink' ] ,
233
- maxFailures : 9 ,
234
- minimumSuccesses : 0
209
+ successRate : 33.33
235
210
} ,
236
211
{
237
212
name : 'TestGatewayCacheWithIPNS' ,
238
213
run : [ 'TestGatewayCacheWithIPNS' ] ,
239
- maxFailures : 27 ,
240
- minimumSuccesses : 15
214
+ successRate : 35.71
241
215
} ,
242
216
// times out
243
217
// {
244
218
// name: 'TestGatewayCache',
245
219
// run: ['TestGatewayCache'],
246
- // maxFailures: 71,
247
- // minimumSuccesses: 23
220
+ // successRate: 100
248
221
// },
249
222
// times out
250
223
// {
251
224
// name: 'TestUnixFSDirectoryListing',
252
225
// run: ['TestUnixFSDirectoryListing'],
253
- // maxFailures: 50,
254
- // minimumSuccesses: 0
226
+ // successRate: 100
255
227
// },
256
228
{
257
229
name : 'TestTar' ,
258
230
run : [ 'TestTar' ] ,
259
- maxFailures : 16 ,
260
- minimumSuccesses : 8
231
+ successRate : 50
261
232
}
262
233
]
263
234
235
+ async function getReportDetails ( path : string ) : Promise < { failureCount : number , successCount : number , successRate : number } > {
236
+ let failureCount = 0
237
+ let successCount = 0
238
+
239
+ // parse the newline delimited JSON report at gwc-report-${name}.json and count the number of "PASS:" and "FAIL:" lines
240
+ const report = await readFile ( path , 'utf8' )
241
+ const lines = report . split ( '\n' )
242
+ for ( const line of lines ) {
243
+ if ( line . includes ( '--- FAIL:' ) ) {
244
+ failureCount ++
245
+ } else if ( line . includes ( '--- PASS:' ) ) {
246
+ successCount ++
247
+ }
248
+ }
249
+ const successRate = Number . parseFloat ( ( ( successCount / ( successCount + failureCount ) ) * 100 ) . toFixed ( 2 ) )
250
+
251
+ return {
252
+ failureCount,
253
+ successCount,
254
+ successRate
255
+ }
256
+ }
257
+
264
258
describe ( '@helia/verified-fetch - gateway conformance' , function ( ) {
265
259
before ( async ( ) => {
266
260
if ( process . env . KUBO_GATEWAY == null ) {
@@ -325,10 +319,11 @@ describe('@helia/verified-fetch - gateway conformance', function () {
325
319
}
326
320
} )
327
321
328
- tests . forEach ( ( { name, spec, skip, run, maxFailures , minimumSuccesses } ) => {
322
+ tests . forEach ( ( { name, spec, skip, run, successRate : minSuccessRate } ) => {
329
323
const log = logger . forComponent ( name )
324
+ const expectedSuccessRate = process . env . SUCCESS_RATE != null ? Number . parseFloat ( process . env . SUCCESS_RATE ) : minSuccessRate
330
325
331
- it ( `has no more than ${ maxFailures } failing tests for ${ name } ` , async function ( ) {
326
+ it ( `${ name } has a success rate of at least ${ expectedSuccessRate } % ` , async function ( ) {
332
327
const { stderr, stdout } = await execa ( binaryPath , getConformanceTestArgs ( name ,
333
328
[
334
329
...( spec != null ? [ '--specs' , spec ] : [ ] )
@@ -342,22 +337,8 @@ describe('@helia/verified-fetch - gateway conformance', function () {
342
337
log ( stdout )
343
338
log . error ( stderr )
344
339
345
- let failureCount = 0
346
- let successCount = 0
347
-
348
- // parse the newline delimited JSON report at gwc-report-${name}.json and count the number of "PASS:" and "FAIL:" lines
349
- const report = await readFile ( `gwc-report-${ name } .json` , 'utf8' )
350
- const lines = report . split ( '\n' )
351
- for ( const line of lines ) {
352
- if ( line . includes ( '--- FAIL:' ) ) {
353
- failureCount ++
354
- } else if ( line . includes ( '--- PASS:' ) ) {
355
- successCount ++
356
- }
357
- }
358
-
359
- expect ( failureCount ) . to . be . lessThanOrEqual ( maxFailures )
360
- expect ( successCount ) . to . be . greaterThanOrEqual ( minimumSuccesses ?? 0 )
340
+ const { successRate } = await getReportDetails ( `gwc-report-${ name } .json` )
341
+ expect ( successRate ) . to . be . greaterThanOrEqual ( expectedSuccessRate )
361
342
} )
362
343
} )
363
344
@@ -382,22 +363,12 @@ describe('@helia/verified-fetch - gateway conformance', function () {
382
363
383
364
log ( stdout )
384
365
log . error ( stderr )
385
- let failureCount = 0
386
- let successCount = 0
387
366
388
- // parse the newline delimited JSON report at gwc-report-${name}.json and count the number of "PASS:" and "FAIL:" lines
389
- const report = await readFile ( 'gwc-report-all.json' , 'utf8' )
390
- const lines = report . split ( '\n' )
391
- for ( const line of lines ) {
392
- if ( line . includes ( '--- FAIL:' ) ) {
393
- failureCount ++
394
- } else if ( line . includes ( '--- PASS:' ) ) {
395
- successCount ++
396
- }
397
- }
398
- // CI has 1134 failures, but I get 1129 locally.
367
+ const { failureCount, successCount, successRate } = await getReportDetails ( 'gwc-report-all.json' )
368
+
399
369
expect ( failureCount ) . to . be . lessThanOrEqual ( 1134 )
400
370
expect ( successCount ) . to . be . greaterThanOrEqual ( 262 )
371
+ expect ( successRate ) . to . be . greaterThanOrEqual ( 18.77 )
401
372
} )
402
373
} )
403
374
} )
0 commit comments