2020-08-21 18:36:08 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
2021-08-19 15:16:55 +00:00
|
|
|
"path"
|
2020-08-21 18:36:08 +00:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestGetPath(t *testing.T) {
|
2021-08-25 19:17:37 +00:00
|
|
|
testPath := t.TempDir()
|
2021-08-19 15:16:55 +00:00
|
|
|
actual, err := getPath(testPath, 123)
|
2020-08-21 18:36:08 +00:00
|
|
|
require.NoError(t, err)
|
2021-08-19 15:16:55 +00:00
|
|
|
require.Equal(t, path.Join(testPath, "/BlockStorage_100000/dump-block-1000.json"), actual)
|
2020-08-21 18:36:08 +00:00
|
|
|
|
2021-08-19 15:16:55 +00:00
|
|
|
actual, err = getPath(testPath, 1230)
|
2020-08-21 18:36:08 +00:00
|
|
|
require.NoError(t, err)
|
2021-08-19 15:16:55 +00:00
|
|
|
require.Equal(t, path.Join(testPath, "/BlockStorage_100000/dump-block-2000.json"), actual)
|
2020-08-21 18:36:08 +00:00
|
|
|
|
2021-08-19 15:16:55 +00:00
|
|
|
actual, err = getPath(testPath, 123000)
|
2020-08-21 18:36:08 +00:00
|
|
|
require.NoError(t, err)
|
2021-08-19 15:16:55 +00:00
|
|
|
require.Equal(t, path.Join(testPath, "/BlockStorage_200000/dump-block-123000.json"), actual)
|
2020-08-21 18:36:08 +00:00
|
|
|
}
|