Merge pull request #1501 from travisturner/disco-bitdepth-test-fix

fix SaveMeta test; ensure storage backend env is used
This commit is contained in:
Matthew Jaffee 2021-03-02 17:26:52 -06:00 • committed by GitHub
commit b790d2cc5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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