Skip to content

Commit 8585bff

Browse files
committed
fix: hit record test
1 parent 430acf6 commit 8585bff

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

vsl/records_test.go

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -487,11 +487,13 @@ func TestURLRecord(t *testing.T) {
487487

488488
func TestHitRecord(t *testing.T) {
489489
type test struct {
490-
logRecord string
491-
vxid vsl.VXID
492-
ttl time.Duration
493-
grace time.Duration
494-
keep time.Duration
490+
logRecord string
491+
vxid vsl.VXID
492+
ttl time.Duration
493+
grace time.Duration
494+
keep time.Duration
495+
fetched vsl.SizeValue
496+
contentLength vsl.SizeValue
495497
}
496498

497499
testList := []test{
@@ -503,11 +505,13 @@ func TestHitRecord(t *testing.T) {
503505
keep: time.Duration(0 * time.Second),
504506
},
505507
{
506-
logRecord: "-4- Hit 32775 14.998964 10.000000 0.000000 a b",
507-
vxid: vsl.VXID(32775),
508-
ttl: time.Duration(float64(14.998964) * float64(time.Second)),
509-
grace: time.Duration(10 * time.Second),
510-
keep: time.Duration(0 * time.Second),
508+
logRecord: "-4- Hit 32775 14.998964 10.000000 0.000000 1 2",
509+
vxid: vsl.VXID(32775),
510+
ttl: time.Duration(float64(14.998964) * float64(time.Second)),
511+
grace: time.Duration(10 * time.Second),
512+
keep: time.Duration(0 * time.Second),
513+
fetched: vsl.SizeValue(1),
514+
contentLength: vsl.SizeValue(2),
511515
},
512516
}
513517

@@ -533,6 +537,12 @@ func TestHitRecord(t *testing.T) {
533537
if record.Keep != test.keep {
534538
t.Errorf("Keep() want: %v got: %v", test.keep, record.Keep)
535539
}
540+
if record.Fetched != test.fetched {
541+
t.Errorf("Fetched() want: %v got: %v", test.fetched, record.Fetched)
542+
}
543+
if record.ContentLength != test.contentLength {
544+
t.Errorf("Keep() want: %v got: %v", test.contentLength, record.ContentLength)
545+
}
536546
}
537547
}
538548

0 commit comments

Comments
 (0)