Skip to content

Commit

Permalink
Gracefully terminate test
Browse files Browse the repository at this point in the history
Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
  • Loading branch information
fpetkovski committed Jan 24, 2023
1 parent 5785c7a commit edd6e56
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/receive/multitsdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,15 +540,19 @@ func TestMultiTSDBWithNilStore(t *testing.T) {
)
defer func() { testutil.Ok(t, m.Close()) }()

_, err := m.TenantAppendable("test-tenant")
const tenantID = "test-tenant"
_, err := m.TenantAppendable(tenantID)
testutil.Ok(t, err)

// Get LabelSets of newly created TSDB.
clients := m.TSDBLocalClients()
for _, client := range clients {
testutil.Ok(t, testutil.FaultOrPanicToErr(func() {
client.LabelSets()
}))
testutil.Ok(t, testutil.FaultOrPanicToErr(func() { client.LabelSets() }))
}

// Wait for tenant to become ready before terminating the test.
// This allows the tear down procedure to cleanup properly.
testutil.Ok(t, appendSample(m, tenantID, time.Now()))
}

func appendSample(m *MultiTSDB, tenant string, timestamp time.Time) error {
Expand Down

0 comments on commit edd6e56

Please sign in to comment.