remove pkg/testutil/loopback_linux.go and use continuity/testutil/loopback

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
Akihiro Suda
2018-10-02 13:08:29 +09:00
parent ac01f20a8e
commit 5349fa31df
10 changed files with 156 additions and 20 deletions

View File

@@ -16,14 +16,7 @@
limitations under the License.
*/
// FIXME: we can't put this test to the mount package:
// import cycle not allowed in test
// package github.com/containerd/containerd/mount (test)
// imports github.com/containerd/containerd/pkg/testutil
// imports github.com/containerd/containerd/mount
//
// NOTE: we can't have this as lookup_test (compilation fails)
package lookuptest
package mount
import (
"fmt"
@@ -34,14 +27,16 @@ import (
"strings"
"testing"
"github.com/containerd/containerd/mount"
"github.com/containerd/containerd/pkg/testutil"
// containerd/pkg/testutil has circular dependency on this mount pkg.
// so we use continuity/testutil instead.
"github.com/containerd/continuity/testutil"
"github.com/containerd/continuity/testutil/loopback"
"gotest.tools/assert"
)
func checkLookup(t *testing.T, fsType, mntPoint, dir string) {
t.Helper()
info, err := mount.Lookup(dir)
info, err := Lookup(dir)
assert.NilError(t, err)
assert.Equal(t, fsType, info.FSType)
assert.Equal(t, mntPoint, info.Mountpoint)
@@ -55,7 +50,7 @@ func testLookup(t *testing.T, fsType string) {
}
defer os.RemoveAll(mnt)
deviceName, cleanupDevice, err := testutil.NewLoopback(100 << 20) // 100 MB
deviceName, cleanupDevice, err := loopback.New(100 << 20) // 100 MB
if err != nil {
t.Fatal(err)
}

View File

@@ -1,19 +0,0 @@
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package lookuptest
// FIXME: without this dummy file, `make build` fails with "no buildable Go source files" error