Work around duplicate registration of groupcache error in tests
This commit is contained in:
parent
b5ddaa2e9e
commit
cf0555d1a5
@ -217,6 +217,7 @@ var _ = Describe("API", func() {
|
||||
RPCGasCap: big.NewInt(10000000000), // Max gas capacity for a rpc call.
|
||||
GroupCacheConfig: ðServerShared.GroupCacheConfig{
|
||||
StateDB: ethServerShared.GroupConfig{
|
||||
Name: "api_test",
|
||||
CacheSizeInMB: 8,
|
||||
CacheExpiryInMins: 60,
|
||||
LogStatsIntervalInSecs: 0,
|
||||
|
@ -117,9 +117,14 @@ type Config struct {
|
||||
func NewEthBackend(db *postgres.DB, c *Config) (*Backend, error) {
|
||||
gcc := c.GroupCacheConfig
|
||||
|
||||
groupName := gcc.StateDB.Name
|
||||
if groupName == "" {
|
||||
groupName = StateDBGroupCacheName
|
||||
}
|
||||
|
||||
r := NewCIDRetriever(db)
|
||||
ethDB := ipfsethdb.NewDatabase(db.DB, ipfsethdb.CacheConfig{
|
||||
Name: StateDBGroupCacheName,
|
||||
Name: groupName,
|
||||
Size: gcc.StateDB.CacheSizeInMB * 1024 * 1024,
|
||||
ExpiryDuration: time.Minute * time.Duration(gcc.StateDB.CacheExpiryInMins),
|
||||
})
|
||||
|
@ -83,6 +83,7 @@ var _ = Describe("eth state reading tests", func() {
|
||||
RPCGasCap: big.NewInt(10000000000), // Max gas capacity for a rpc call.
|
||||
GroupCacheConfig: ðServerShared.GroupCacheConfig{
|
||||
StateDB: ethServerShared.GroupConfig{
|
||||
Name: "eth_state_test",
|
||||
CacheSizeInMB: 8,
|
||||
CacheExpiryInMins: 60,
|
||||
LogStatsIntervalInSecs: 0,
|
||||
|
@ -88,6 +88,7 @@ var _ = Describe("GraphQL", func() {
|
||||
RPCGasCap: big.NewInt(10000000000),
|
||||
GroupCacheConfig: ðServerShared.GroupCacheConfig{
|
||||
StateDB: ethServerShared.GroupConfig{
|
||||
Name: "graphql_test",
|
||||
CacheSizeInMB: 8,
|
||||
CacheExpiryInMins: 60,
|
||||
LogStatsIntervalInSecs: 0,
|
||||
|
@ -26,6 +26,10 @@ type GroupConfig struct {
|
||||
CacheSizeInMB int
|
||||
CacheExpiryInMins int
|
||||
LogStatsIntervalInSecs int
|
||||
|
||||
// Used in tests to override the cache name, to work around
|
||||
// the "duplicate registration of group" error from groupcache
|
||||
Name string
|
||||
}
|
||||
|
||||
type GroupCacheConfig struct {
|
||||
|
Loading…
Reference in New Issue
Block a user