Files
aptly/files/mocks.go
Ryan Gonzalez f9325fbc91 Add support for Azure package pools
This adds support for storing packages directly on Azure, with no truly
"local" (on-disk) repo used. The existing Azure PublishedStorage
implementation was refactored to move the shared code to a separate
context struct, which can then be re-used by the new PackagePool. In
addition, the files package's mockChecksumStorage was made public so
that it could be used in the Azure PackagePool tests as well.

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
2024-06-17 11:51:18 +02:00

37 lines
725 B
Go

package files
import (
"github.com/aptly-dev/aptly/aptly"
"github.com/aptly-dev/aptly/utils"
)
type MockChecksumStorage struct {
Store map[string]utils.ChecksumInfo
}
// NewMockChecksumStorage creates aptly.ChecksumStorage for tests
func NewMockChecksumStorage() aptly.ChecksumStorage {
return &MockChecksumStorage{
Store: make(map[string]utils.ChecksumInfo),
}
}
func (st *MockChecksumStorage) Get(path string) (*utils.ChecksumInfo, error) {
c, ok := st.Store[path]
if !ok {
return nil, nil
}
return &c, nil
}
func (st *MockChecksumStorage) Update(path string, c *utils.ChecksumInfo) error {
st.Store[path] = *c
return nil
}
// Check interface
var (
_ aptly.ChecksumStorage = &MockChecksumStorage{}
)