tests: relax index checks

TestStateStore_Indexes specifically tests for `nodes` index, but asserts
on the exact number of indexes present in the state.  This is fragile
and will break almost everytime we add a state index.
This commit is contained in:
Mahmood Ali 2020-03-25 08:29:25 -04:00
parent 884d18f068
commit 281fc9837c
1 changed files with 3 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import (
"time" "time"
"github.com/hashicorp/go-memdb" "github.com/hashicorp/go-memdb"
"github.com/kr/pretty"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -3137,8 +3138,8 @@ func TestStateStore_Indexes(t *testing.T) {
} }
expect := &IndexEntry{"nodes", 1000} expect := &IndexEntry{"nodes", 1000}
if l := len(out); l != 1 && l != 2 { if l := len(out); l < 1 {
t.Fatalf("unexpected number of index entries: %v", out) t.Fatalf("unexpected number of index entries: %v", pretty.Sprint(out))
} }
for _, index := range out { for _, index := range out {