store/cockroach: fix dropped test errors (#1419)

Co-authored-by: Asim Aslam <asim@aslam.me>
This commit is contained in:
Lars Lehtonen 2020-03-27 03:15:37 -07:00 committed by GitHub
parent 6723d17b22
commit 011a783a9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -108,11 +108,17 @@ func TestSQL(t *testing.T) {
sqlStore.Write(&store.Record{Key: "aaaa", Value: []byte("bbb"), Expiry: 5 * time.Second}) sqlStore.Write(&store.Record{Key: "aaaa", Value: []byte("bbb"), Expiry: 5 * time.Second})
sqlStore.Write(&store.Record{Key: "aaaaa", Value: []byte("bbb"), Expiry: 5 * time.Second}) sqlStore.Write(&store.Record{Key: "aaaaa", Value: []byte("bbb"), Expiry: 5 * time.Second})
results, err := sqlStore.Read("a", store.ReadPrefix()) results, err := sqlStore.Read("a", store.ReadPrefix())
if err != nil {
t.Error(err)
}
if len(results) != 3 { if len(results) != 3 {
t.Fatal("Results should have returned 3 records") t.Fatal("Results should have returned 3 records")
} }
time.Sleep(6 * time.Second) time.Sleep(6 * time.Second)
results, err = sqlStore.Read("a", store.ReadPrefix()) results, err = sqlStore.Read("a", store.ReadPrefix())
if err != nil {
t.Error(err)
}
if len(results) != 0 { if len(results) != 0 {
t.Fatal("Results should have returned 0 records") t.Fatal("Results should have returned 0 records")
} }