fix SaveMeta test; ensure storage backend env is used

This commit is contained in:
Travis 2021-03-02 17:14:58 -06:00
parent 0568daaa14
commit 3d10af9d47
No known key found for this signature in database
GPG key ID: 37080CC2042BA34E
2 changed files with 6 additions and 2 deletions

View file

@ -209,7 +209,9 @@ func NewTestField(t *testing.T, opts FieldOption) *TestField {
t.Fatal(err)
}
h := NewHolder(path, DefaultHolderConfig())
cfg := DefaultHolderConfig()
cfg.StorageConfig.Backend = CurrentBackendOrDefault()
h := NewHolder(path, cfg)
panicOn(h.Open())
idx, err := h.CreateIndex("i", IndexOptions{})
@ -940,6 +942,8 @@ func TestField_SaveMeta(t *testing.T) {
t.Fatal(err)
} else if !changed {
t.Fatal("expected SetValue to return changed = true")
} else if err := tx.Commit(); err != nil {
t.Fatal(err)
}
if f.options.BitDepth != expBitDepth {

View file

@ -208,7 +208,7 @@ func CurrentBackend() string {
}
// CurrentBackendOrDefault tries the environment variable first, but falls back
// to the default backed if the environment variable is empty.
// to the default backend if the environment variable is empty.
func CurrentBackendOrDefault() string {
if backend := os.Getenv("PILOSA_STORAGE_BACKEND"); backend != "" {
return backend