2018-02-26 18:51:38 +00:00
|
|
|
package boltdbcachestorage
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io/ioutil"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"testing"
|
|
|
|
|
2018-05-11 05:58:41 +00:00
|
|
|
"github.com/moby/buildkit/solver"
|
2018-05-12 01:32:56 +00:00
|
|
|
"github.com/moby/buildkit/solver/testutil"
|
2018-02-26 18:51:38 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestBoltCacheStorage(t *testing.T) {
|
2018-05-12 01:32:56 +00:00
|
|
|
testutil.RunCacheStorageTests(t, func() (solver.CacheKeyStorage, func()) {
|
2018-02-26 18:51:38 +00:00
|
|
|
tmpDir, err := ioutil.TempDir("", "storage")
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
cleanup := func() {
|
|
|
|
os.RemoveAll(tmpDir)
|
|
|
|
}
|
|
|
|
|
|
|
|
st, err := NewStore(filepath.Join(tmpDir, "cache.db"))
|
|
|
|
if err != nil {
|
|
|
|
cleanup()
|
|
|
|
}
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
return st, cleanup
|
|
|
|
})
|
|
|
|
}
|