mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-05 10:32:19 +00:00
25 lines
566 B
Go
25 lines
566 B
Go
package db_config
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/ledgerwatch/erigon-lib/kv/memdb"
|
|
"github.com/stretchr/testify/require"
|
|
_ "modernc.org/sqlite"
|
|
)
|
|
|
|
func TestDBConfig(t *testing.T) {
|
|
db := memdb.NewTestDB(t)
|
|
defer db.Close()
|
|
tx, err := db.BeginRw(context.Background())
|
|
defer tx.Rollback()
|
|
require.NoError(t, err)
|
|
|
|
c := DatabaseConfiguration{PruneDepth: 69}
|
|
require.NoError(t, WriteConfigurationIfNotExist(context.Background(), tx, c))
|
|
cfg, err := ReadConfiguration(context.Background(), tx)
|
|
require.NoError(t, err)
|
|
require.Equal(t, cfg, c)
|
|
}
|