dolthub / driver

Golang database/sql driver for Dolt
Apache License 2.0
22 stars 5 forks source link

Invalid repository state when using dolt@master #13

Closed nustiueudinastea closed 10 months ago

nustiueudinastea commented 10 months ago

Hey folks,

I ran the smoke tests in this repo after updating the latest dolt/go code in main (go get github.com/dolthub/dolt/go@37c8b56616d12b6357ff379ce272de38bef99143), and the tests pass, but the repo is left in an invalid state.

dolthub-driver-tests-db117918735/dolthub-driver-tests-db117918735/testdb [!] 
❯ dolt log
The current directory is not a valid dolt repository.

Is this expected?

In order to re-produce:

go get github.com/dolthub/dolt/go@37c8b56616d12b6357ff379ce272de38bef99143  
go mod tidy

Then disable the cleanup method in the tests so the temporary test dirs remain. Run the tests

go test ./...

Then check the resulting directories. The dolt repo's should be in an invalid state.

jycor commented 10 months ago

Hey @nustiueudinastea, I followed the steps described in your issue, but I was unable to reproduce the issue.

I ran this with the current dolt/go, the one you specified (dolt/go@37c8b56616...), and whatever is at main dolt/go@main All leftover testing repos were usable

$ dolt log
commit 4cldbrj5aft2t5eg7vka572ks79ec46n (HEAD -> main) 
Author: Billy Batson <shazam@gmail.com>
Date:  Tue Nov 28 11:25:59 -0800 2023

        Initialize data repository

The error message, The current directory is not a valid dolt repository. typcally shows up when the directory or any of the subdirectories is missing the .dolt directory. In this case there's a .dolt directory inside of dolthub-driver-tests-.../testdb

$ ls -a
.  ..  .dolt

$ dolt status
On branch main
nothing to commit, working tree clean

$ rm -rf .dolt/

$ dolt status
The current directory is not a valid dolt repository.

I prevented the testing dirs from getting deleted by commenting out the cleanupFunc in initializeTestDatabaseConnection

cleanUpFunc = func() {
    //os.RemoveAll(dir)
}

I'm not sure how the .dolt directory is getting deleted on your end. Maybe it has something to do with how you're disabling the clean up method?

nustiueudinastea commented 10 months ago

Hey there, the dolt directory is not deleted, but I still get the invalid repo state. I will try to reproduce in a Docker container and get back to you. I only tested on my MacOS host.

nustiueudinastea commented 10 months ago

After upgrading to the latest dolt command I can't reproduce the issue anymore. So most likely the slightly older dolt binary I had installed was not correctly reading repos created by the latest code. Sorry for the false alarm!