erigon-pulse/ethdb/prune/storage_mode_test.go
2021-07-29 18:53:13 +07:00

24 lines
643 B
Go

package prune
import (
"testing"
"github.com/ledgerwatch/erigon-lib/kv/memdb"
"github.com/ledgerwatch/erigon/common/math"
"github.com/stretchr/testify/assert"
)
func TestSetStorageModeIfNotExist(t *testing.T) {
_, tx := memdb.NewTestTx(t)
prune, err := Get(tx)
assert.NoError(t, err)
assert.Equal(t, Mode{true, math.MaxUint64, math.MaxUint64, math.MaxUint64, math.MaxUint64, Experiments{TEVM: false}}, prune)
err = SetIfNotExist(tx, Mode{true, 1, 2, 3, 4, Experiments{TEVM: false}})
assert.NoError(t, err)
prune, err = Get(tx)
assert.NoError(t, err)
assert.Equal(t, Mode{true, 1, 2, 3, 4, Experiments{TEVM: false}}, prune)
}