github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/ledger/complete/wal/checkpoint_v5_test.go (about) 1 package wal 2 3 import ( 4 "path/filepath" 5 "testing" 6 7 "github.com/rs/zerolog/log" 8 "github.com/stretchr/testify/require" 9 10 "github.com/onflow/flow-go/utils/unittest" 11 ) 12 13 func TestCopyCheckpointFileV5(t *testing.T) { 14 unittest.RunWithTempDir(t, func(dir string) { 15 tries := createSimpleTrie(t) 16 fileName := "checkpoint" 17 logger := unittest.Logger() 18 require.NoErrorf(t, StoreCheckpointV5(dir, fileName, logger, tries...), "fail to store checkpoint") 19 to := filepath.Join(dir, "newfolder") 20 newPaths, err := CopyCheckpointFile(fileName, dir, to) 21 require.NoError(t, err) 22 log.Info().Msgf("copied to :%v", newPaths) 23 decoded, err := LoadCheckpoint(filepath.Join(to, fileName), logger) 24 require.NoErrorf(t, err, "fail to read checkpoint %v/%v", dir, fileName) 25 requireTriesEqual(t, tries, decoded) 26 }) 27 }