github.com/letsencrypt/trillian@v1.1.2-0.20180615153820-ae375a99d36a/testonly/integration/registry.go (about) 1 // Copyright 2017 Google Inc. All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package integration 16 17 import ( 18 "context" 19 20 "github.com/google/trillian/extension" 21 "github.com/google/trillian/quota/mysqlqm" 22 "github.com/google/trillian/storage/mysql" 23 "github.com/google/trillian/storage/testdb" 24 ) 25 26 // NewRegistryForTests returns an extension.Registry for integration tests. 27 func NewRegistryForTests(ctx context.Context) (extension.Registry, error) { 28 db, err := testdb.NewTrillianDB(ctx) 29 if err != nil { 30 return extension.Registry{}, err 31 } 32 33 return extension.Registry{ 34 AdminStorage: mysql.NewAdminStorage(db), 35 LogStorage: mysql.NewLogStorage(db, nil), 36 MapStorage: mysql.NewMapStorage(db), 37 QuotaManager: &mysqlqm.QuotaManager{DB: db, MaxUnsequencedRows: mysqlqm.DefaultMaxUnsequenced}, 38 }, nil 39 }