Implement graceful shutdown of agent.DataAccess (#1008)

* Implements graceful shutdown of agent.DataAccess and underlying Datastore/Logstore/MessageQueue

* adds tests for closing agent.DataAccess and Datastore
This commit is contained in:
Gerardo Viedma
2018-05-21 11:28:21 +01:00
committed by GitHub
parent 105d9b8f1d
commit ea1f94253f
19 changed files with 180 additions and 12 deletions

View File

@@ -127,4 +127,23 @@ func TestDatastore(t *testing.T) {
both(u)
}
}
func TestClose(t *testing.T) {
ctx := context.Background()
defer os.RemoveAll("sqlite_test_dir")
u, err := url.Parse("sqlite3://sqlite_test_dir")
if err != nil {
t.Fatal(err)
}
os.RemoveAll("sqlite_test_dir")
ds, err := newDS(ctx, u)
if err != nil {
t.Fatal(err)
}
if err := ds.Close(); err != nil {
t.Fatalf("Failed to close datastore: %v", err)
}
}