alexedwards / scs

HTTP Session Management for Go
MIT License
2.05k stars 165 forks source link

BuntDB support resumed and fixed typos #119

Closed gandaldf closed 2 years ago

gandaldf commented 2 years ago

About #116 issue

alexedwards commented 2 years ago

Thanks. I'll give this a look over and merge as soon as I have a chance.

alexedwards commented 2 years ago

Thanks, this looks really good.

I'm getting the following error when running the tests:

$ cd buntdbstore/
$ go test .
go: downloading github.com/tidwall/buntdb v1.2.6
go: downloading github.com/tidwall/rtred v0.1.2
go: downloading github.com/tidwall/gjson v1.8.0
go: downloading github.com/tidwall/btree v0.6.0
go: downloading github.com/tidwall/grect v0.1.2
go: downloading github.com/tidwall/match v1.0.3
go: downloading github.com/tidwall/tinyqueue v0.1.1
go: downloading github.com/tidwall/pretty v1.1.0
--- FAIL: TestCommit (0.00s)
panic: remove /tmp/testing.db: no such file or directory [recovered]
        panic: remove /tmp/testing.db: no such file or directory

goroutine 18 [running]:
testing.tRunner.func1.2({0x51c7a0, 0xc0000a22d0})
        /usr/local/go/src/testing/testing.go:1209 +0x24e
testing.tRunner.func1()
        /usr/local/go/src/testing/testing.go:1212 +0x218
panic({0x51c7a0, 0xc0000a22d0})
        /usr/local/go/src/runtime/panic.go:1038 +0x215
github.com/alexedwards/scs/buntdbstore.getTestDatabase()
        /home/alex/Dropbox/Projects/scs/buntdbstore/buntdbstore_test.go:18 +0x6e
github.com/alexedwards/scs/buntdbstore.TestCommit(0xc0000831e0)
        /home/alex/Dropbox/Projects/scs/buntdbstore/buntdbstore_test.go:28 +0x47
testing.tRunner(0xc0000831e0, 0x53fd68)
        /usr/local/go/src/testing/testing.go:1259 +0x102
created by testing.(*T).Run
        /usr/local/go/src/testing/testing.go:1306 +0x35a
FAIL    github.com/alexedwards/scs/buntdbstore  0.004s
FAIL

I think it's just that the getTestDatabase() helper function needs to be updated to check if /tmp/testing.db exists before trying to delete it.

gandaldf commented 2 years ago

Mmm ok... I'll try to fix it!

gandaldf commented 2 years ago

Hi Alex! I've fixed the buntdbstore test and thanks to your answer (#117) I've implemented the All() method in some of the stores, I hope you will find it useful!

alexedwards commented 2 years ago

This is fantastic, thank you so much! :smiley:

It all looks good to me, so I'll merge it now.