@@ -89,6 +89,8 @@ func (f *fixedTimeSource) Now() time.Time {
89
89
}
90
90
91
91
// setupTestLog creates a test TesseraCT log using a POSIX backend.
92
+ //
93
+ // It returns the log and the path to the storage directory.
92
94
func setupTestLog (t * testing.T ) (* log , string ) {
93
95
t .Helper ()
94
96
storageDir := t .TempDir ()
@@ -109,7 +111,7 @@ func setupTestLog(t *testing.T) (*log, string) {
109
111
rejectUnexpired : false ,
110
112
}
111
113
112
- log , err := NewLog (t .Context (), origin , signer , cvOpts , newPosixStorageFunc (t , storageDir ), newFixedTimeSource (fakeTime ))
114
+ log , err := NewLog (t .Context (), origin , signer , cvOpts , newPOSIXStorageFunc (t , storageDir ), newFixedTimeSource (fakeTime ))
113
115
if err != nil {
114
116
t .Fatalf ("newLog(): %v" , err )
115
117
}
@@ -130,13 +132,13 @@ func setupTestServer(t *testing.T, log *log, path string) *httptest.Server {
130
132
return httptest .NewServer (handler )
131
133
}
132
134
133
- // newPosixStorageFunc returns a function to create a new storage.CTStorage instance with:
135
+ // newPOSIXStorageFunc returns a function to create a new storage.CTStorage instance with:
134
136
// - a POSIX Tessera storage driver
135
137
// - a POSIX issuer storage system
136
138
// - a BBolt deduplication database
137
139
//
138
140
// It also prepares directories to host the log and the deduplication database.
139
- func newPosixStorageFunc (t * testing.T , root string ) storage.CreateStorage {
141
+ func newPOSIXStorageFunc (t * testing.T , root string ) storage.CreateStorage {
140
142
t .Helper ()
141
143
142
144
return func (ctx context.Context , signer note.Signer ) (* storage.CTStorage , error ) {
@@ -317,15 +319,15 @@ func parseChain(t *testing.T, isPrecert bool, pemChain []string, root *x509.Cert
317
319
pool := loadCertsIntoPoolOrDie (t , pemChain )
318
320
leafChain := pool .RawCertificates ()
319
321
if ! leafChain [len (leafChain )- 1 ].Equal (root ) {
320
- // The submitted chain may not include a root, but the generated LogLeaf will
322
+ // The submitted chain may not include a root, but the generated LogLeaf will.
321
323
fullChain := make ([]* x509.Certificate , len (leafChain )+ 1 )
322
324
copy (fullChain , leafChain )
323
325
fullChain [len (leafChain )] = root
324
326
leafChain = fullChain
325
327
}
326
328
entry , err := entryFromChain (leafChain , isPrecert , fakeTimeMillis )
327
329
if err != nil {
328
- t .Fatalf ("failed to create entry" )
330
+ t .Fatalf ("Failed to create entry" )
329
331
}
330
332
331
333
return entry , leafChain
@@ -534,7 +536,7 @@ func TestAddChain(t *testing.T) {
534
536
}
535
537
536
538
// Check that the leaf bundle contains the expected leaf.
537
- bPath := path .Join (dir , logDir , "tile/data" , layout .NWithSuffix (0 , test .wantLogSize / 256 , uint8 (test .wantLogSize )))
539
+ bPath := path .Join (dir , logDir , "tile/data" , layout .NWithSuffix (0 , test .wantLogSize / layout . EntryBundleWidth , uint8 (test .wantLogSize )))
538
540
bundle , err := os .ReadFile (bPath )
539
541
if err != nil {
540
542
t .Errorf ("Failed to read leaf bundle at %q: %v" , bPath , err )
@@ -660,7 +662,7 @@ func TestAddPreChain(t *testing.T) {
660
662
}
661
663
662
664
// Check that the leaf bundle contains the expected leaf.
663
- bPath := path .Join (dir , logDir , "tile/data" , layout .NWithSuffix (0 , test .wantLogSize / 256 , uint8 (test .wantLogSize )))
665
+ bPath := path .Join (dir , logDir , "tile/data" , layout .NWithSuffix (0 , test .wantLogSize / layout . EntryBundleWidth , uint8 (test .wantLogSize )))
664
666
bundle , err := os .ReadFile (bPath )
665
667
if err != nil {
666
668
t .Errorf ("Failed to read leaf bundle at %q: %v" , bPath , err )
0 commit comments