@@ -29,25 +29,25 @@ import (
2929 "go.uber.org/zap"
3030)
3131
32- // testingMemoryStorage is an in-memory storage implementation with known contents *and* fixed iteration order for List.
33- type testingMemoryStorage struct {
34- contents []testingMemoryStorageItem
32+ // memoryStorage is an in-memory storage implementation with known contents *and* fixed iteration order for List.
33+ type memoryStorage struct {
34+ contents []memoryStorageItem
3535}
3636
37- type testingMemoryStorageItem struct {
37+ type memoryStorageItem struct {
3838 key string
3939 data []byte
4040}
4141
42- func (m * testingMemoryStorage ) lookup (_ context.Context , key string ) * testingMemoryStorageItem {
42+ func (m * memoryStorage ) lookup (_ context.Context , key string ) * memoryStorageItem {
4343 for _ , item := range m .contents {
4444 if item .key == key {
4545 return & item
4646 }
4747 }
4848 return nil
4949}
50- func (m * testingMemoryStorage ) Delete (ctx context.Context , key string ) error {
50+ func (m * memoryStorage ) Delete (ctx context.Context , key string ) error {
5151 for i , item := range m .contents {
5252 if item .key == key {
5353 m .contents = append (m .contents [:i ], m .contents [i + 1 :]... )
@@ -56,14 +56,14 @@ func (m *testingMemoryStorage) Delete(ctx context.Context, key string) error {
5656 }
5757 return fs .ErrNotExist
5858}
59- func (m * testingMemoryStorage ) Store (ctx context.Context , key string , value []byte ) error {
60- m .contents = append (m .contents , testingMemoryStorageItem {key : key , data : value })
59+ func (m * memoryStorage ) Store (ctx context.Context , key string , value []byte ) error {
60+ m .contents = append (m .contents , memoryStorageItem {key : key , data : value })
6161 return nil
6262}
63- func (m * testingMemoryStorage ) Exists (ctx context.Context , key string ) bool {
63+ func (m * memoryStorage ) Exists (ctx context.Context , key string ) bool {
6464 return m .lookup (ctx , key ) != nil
6565}
66- func (m * testingMemoryStorage ) List (ctx context.Context , path string , recursive bool ) ([]string , error ) {
66+ func (m * memoryStorage ) List (ctx context.Context , path string , recursive bool ) ([]string , error ) {
6767 if recursive {
6868 panic ("unimplemented" )
6969 }
@@ -88,22 +88,22 @@ nextitem:
8888 }
8989 return result , nil
9090}
91- func (m * testingMemoryStorage ) Load (ctx context.Context , key string ) ([]byte , error ) {
91+ func (m * memoryStorage ) Load (ctx context.Context , key string ) ([]byte , error ) {
9292 if item := m .lookup (ctx , key ); item != nil {
9393 return item .data , nil
9494 }
9595 return nil , fs .ErrNotExist
9696}
97- func (m * testingMemoryStorage ) Stat (ctx context.Context , key string ) (KeyInfo , error ) {
97+ func (m * memoryStorage ) Stat (ctx context.Context , key string ) (KeyInfo , error ) {
9898 if item := m .lookup (ctx , key ); item != nil {
9999 return KeyInfo {Key : key , Size : int64 (len (item .data ))}, nil
100100 }
101101 return KeyInfo {}, fs .ErrNotExist
102102}
103- func (m * testingMemoryStorage ) Lock (ctx context.Context , name string ) error { panic ("unimplemented" ) }
104- func (m * testingMemoryStorage ) Unlock (ctx context.Context , name string ) error { panic ("unimplemented" ) }
103+ func (m * memoryStorage ) Lock (ctx context.Context , name string ) error { panic ("unimplemented" ) }
104+ func (m * memoryStorage ) Unlock (ctx context.Context , name string ) error { panic ("unimplemented" ) }
105105
106- var _ Storage = (* testingMemoryStorage )(nil )
106+ var _ Storage = (* memoryStorage )(nil )
107107
108108type recordingStorage struct {
109109 Storage
@@ -293,7 +293,7 @@ func TestGetAccountAlreadyExistsSkipsBroken(t *testing.T) {
293293 am := & ACMEIssuer {CA : dummyCA , Logger : zap .NewNop (), mu : new (sync.Mutex )}
294294 testConfig := & Config {
295295 Issuers : []Issuer {am },
296- Storage : & testingMemoryStorage {},
296+ Storage : & memoryStorage {},
297297 Logger : defaultTestLogger ,
298298 certCache : new (Cache ),
299299 }
@@ -342,7 +342,7 @@ func TestGetAccountWithEmailAlreadyExists(t *testing.T) {
342342 am := & ACMEIssuer {CA : dummyCA , Logger : zap .NewNop (), mu : new (sync.Mutex )}
343343 testConfig := & Config {
344344 Issuers : []Issuer {am },
345- Storage : & recordingStorage {Storage : & testingMemoryStorage {}},
345+ Storage : & recordingStorage {Storage : & memoryStorage {}},
346346 Logger : defaultTestLogger ,
347347 certCache : new (Cache ),
348348 }
0 commit comments