mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-04-20 19:38:39 +00:00
Allow database to be initialized without opening, unify all the open paths to retry on failure. In API router make sure open requests are matched with acks in explicit way. This also enables re-open attempts in all the aptly commands, so it should make running aptly CLI much easier now hopefully. Fix up system tests for oldoldstable ;)
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
package deb
|
|
|
|
import (
|
|
"github.com/smira/aptly/database"
|
|
"github.com/smira/aptly/utils"
|
|
|
|
. "gopkg.in/check.v1"
|
|
)
|
|
|
|
type ChecksumCollectionSuite struct {
|
|
collection *ChecksumCollection
|
|
c utils.ChecksumInfo
|
|
db database.Storage
|
|
}
|
|
|
|
var _ = Suite(&ChecksumCollectionSuite{})
|
|
|
|
func (s *ChecksumCollectionSuite) SetUpTest(c *C) {
|
|
s.c = utils.ChecksumInfo{
|
|
Size: 124,
|
|
MD5: "da39a3ee5e6b4b0d3255bfef95601890afd80709",
|
|
SHA1: "da39a3ee5e6b4b0d3255bfef95601890afd80709",
|
|
SHA256: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
|
}
|
|
s.db, _ = database.NewOpenDB(c.MkDir())
|
|
s.collection = NewChecksumCollection(s.db)
|
|
}
|
|
|
|
func (s *ChecksumCollectionSuite) TearDownTest(c *C) {
|
|
s.db.Close()
|
|
}
|
|
|
|
func (s *ChecksumCollectionSuite) TestFlow(c *C) {
|
|
// checksum not stored
|
|
checksum, err := s.collection.Get("some/path")
|
|
c.Assert(err, IsNil)
|
|
c.Check(checksum, IsNil)
|
|
|
|
// store checksum
|
|
err = s.collection.Update("some/path", &s.c)
|
|
c.Assert(err, IsNil)
|
|
|
|
// load it back
|
|
checksum, err = s.collection.Get("some/path")
|
|
c.Assert(err, IsNil)
|
|
c.Check(*checksum, DeepEquals, s.c)
|
|
}
|