Retire mount.Exec for k8s.io/utils/exec

This patch removes mount.Exec entirely and instead uses the common
utility from k8s.io/utils/exec.

The fake exec implementation found in k8s.io/utils/exec differs a bit
than mount.Exec, with the ability to pre-script expected calls to
Command.CombinedOutput(), so tests that previously relied on a callback
mechanism to produce specific output have been updated to use that
mechanism.
This commit is contained in:
Travis Rhoden
2019-10-10 11:27:54 -06:00
parent e7ce8d8a6f
commit 367f879131
53 changed files with 449 additions and 324 deletions

View File

@@ -28,8 +28,7 @@ import (
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/stretchr/testify/assert"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/utils/exec"
)
type fakeFileInfo struct {
@@ -126,7 +125,7 @@ func TestIoHandler(t *testing.T) {
if runtime.GOOS != "windows" && runtime.GOOS != "linux" {
t.Skipf("TestIoHandler not supported on GOOS=%s", runtime.GOOS)
}
disk, err := findDiskByLun(lun, &fakeIOHandler{}, mount.NewOSExec())
disk, err := findDiskByLun(lun, &fakeIOHandler{}, exec.New())
if runtime.GOOS == "windows" {
if err != nil {
t.Errorf("no data disk found: disk %v err %v", disk, err)