This repository was archived by the owner on Apr 29, 2025. It is now read-only.
This repository was archived by the owner on Apr 29, 2025. It is now read-only.
Description
If I create an empty database:
mkdir database
cd database
git init .
then start datakit:
com.docker.db --git <path>/database -url file:///var/tmp/foo
and then run the Go unit tests:
cd go-datakit
go test
-- everything passes.
If I make a commit to the database directory with git
:
cd database
echo foo > bar
git add bar
git commit -m test
then (whether I restart the server or not) running the tests hangs committing a transaction:
$ go test
2017/09/27 22:17:38 Testing the client interface
2017/09/27 22:17:38 Dialling unix /var/tmp/foo
2017/09/27 22:17:38 Remove [branch master transactions foo rw a b c]
2017/09/27 22:17:38 Testing the configuration interface
2017/09/27 22:17:38 Dialling unix /var/tmp/foo
The test which triggers this seems to be:
$ go test -run TestTransaction
2017/09/27 22:18:00 Testing the transaction interface
2017/09/27 22:18:00 Dialling unix /var/tmp/foo
If I add some printfs:
$ git diff .
diff --git a/api/go-datakit/transaction_test.go b/api/go-datakit/transaction_test.go
index f59aaef..b49912f 100644
--- a/api/go-datakit/transaction_test.go
+++ b/api/go-datakit/transaction_test.go
@@ -24,8 +24,10 @@ func TestTransaction(t *testing.T) {
if err != nil {
t.Fatalf("Transaction.Write failed: %v", err)
}
+ log.Println("Commit")
err = trans.Commit(ctx, "Test transaction")
if err != nil {
t.Fatalf("Transaction.Commit failed: %v", err)
}
+ log.Println("Done")
}
then I get
$ go test -run TestTransaction
2017/09/27 22:19:09 Testing the transaction interface
2017/09/27 22:19:09 Dialling unix /var/tmp/foo
2017/09/27 22:19:09 Commit
which means that the Commit
operation is hanging.