Merge pull request #1057 from dlorenc/isoperms
Add a starter test for ISO permissions.pull/1068/head
commit
e57170061a
3
Makefile
3
Makefile
|
@ -89,6 +89,9 @@ minikube-iso:
|
|||
$(MAKE) BR2_EXTERNAL=../../deploy/iso/minikube-iso minikube_defconfig -C $(BUILD_DIR)/buildroot
|
||||
$(MAKE) -C $(BUILD_DIR)/buildroot
|
||||
|
||||
test-iso:
|
||||
go test -v $(REPOPATH)/test/integration --tags=iso --minikube-args="--iso-url=file://$(shell pwd)/out/buildroot/output/images/rootfs.iso9660"
|
||||
|
||||
.PHONY: integration
|
||||
integration: out/minikube
|
||||
go test -v -test.timeout=30m $(REPOPATH)/test/integration --tags=integration --minikube-args="$(MINIKUBE_ARGS)"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
// +build integration
|
||||
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
// +build iso
|
||||
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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 integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"k8s.io/minikube/test/integration/util"
|
||||
)
|
||||
|
||||
func TestISO(t *testing.T) {
|
||||
|
||||
minikubeRunner := util.MinikubeRunner{
|
||||
Args: *args,
|
||||
BinaryPath: *binaryPath,
|
||||
T: t}
|
||||
|
||||
minikubeRunner.RunCommand("delete", true)
|
||||
minikubeRunner.Start()
|
||||
|
||||
t.Run("permissions", testMountPermissions)
|
||||
}
|
||||
|
||||
func testMountPermissions(t *testing.T) {
|
||||
minikubeRunner := util.MinikubeRunner{
|
||||
Args: *args,
|
||||
BinaryPath: *binaryPath,
|
||||
T: t}
|
||||
// test mount permissions
|
||||
mountPoints := []string{"/Users", "/hosthome"}
|
||||
perms := "drwxr-xr-x"
|
||||
foundMount := false
|
||||
|
||||
for _, dir := range mountPoints {
|
||||
output := minikubeRunner.SSH(fmt.Sprintf("ls -l %s", dir))
|
||||
if strings.Contains(output, "No such file or directory") {
|
||||
continue
|
||||
}
|
||||
foundMount = true
|
||||
if !strings.Contains(output, perms) {
|
||||
t.Fatalf("Incorrect permissions. Expected %s, got %s.", perms, output)
|
||||
}
|
||||
}
|
||||
if !foundMount {
|
||||
t.Fatalf("No shared mount found. Checked %s", mountPoints)
|
||||
}
|
||||
}
|
|
@ -1,5 +1,3 @@
|
|||
// +build integration
|
||||
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
|
@ -71,6 +69,14 @@ func (m *MinikubeRunner) RunCommand(command string, checkError bool) string {
|
|||
return string(stdout)
|
||||
}
|
||||
|
||||
func (m *MinikubeRunner) SSH(command string) string {
|
||||
path, _ := filepath.Abs(m.BinaryPath)
|
||||
cmd := exec.Command(path, "ssh", command)
|
||||
stdout, _ := cmd.CombinedOutput()
|
||||
|
||||
return string(stdout)
|
||||
}
|
||||
|
||||
func (m *MinikubeRunner) Start() {
|
||||
m.RunCommand(fmt.Sprintf("start %s", m.Args), true)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue