prysm-pulse/cmd/beacon-chain/storage/options_test.go

31 lines
815 B
Go
Raw Normal View History

package storage
import (
"flag"
"testing"
"github.com/prysmaticlabs/prysm/v4/cmd"
"github.com/prysmaticlabs/prysm/v4/testing/assert"
"github.com/urfave/cli/v2"
)
func TestBlobStoragePath_NoFlagSpecified(t *testing.T) {
app := cli.App{}
set := flag.NewFlagSet("test", 0)
set.String(cmd.DataDirFlag.Name, cmd.DataDirFlag.Value, cmd.DataDirFlag.Usage)
cliCtx := cli.NewContext(&app, set, nil)
storagePath := blobStoragePath(cliCtx)
assert.Equal(t, cmd.DefaultDataDir()+"/blobs", storagePath)
}
func TestBlobStoragePath_FlagSpecified(t *testing.T) {
app := cli.App{}
set := flag.NewFlagSet("test", 0)
set.String(BlobStoragePath.Name, "/blah/blah", BlobStoragePath.Usage)
cliCtx := cli.NewContext(&app, set, nil)
storagePath := blobStoragePath(cliCtx)
assert.Equal(t, "/blah/blah", storagePath)
}