detect profile name for all tests using profileName(t)

pull/4948/head
Medya Gh 2019-08-01 12:44:41 -07:00
parent 3907c1564a
commit 5a5bec97dc
20 changed files with 35 additions and 33 deletions

View File

@ -38,7 +38,7 @@ import (
// is used to cache images and binaries used by other parallel tests to avoid redownloading.
// TestDownloadOnly tests the --download-only option
func TestDownloadOnly(t *testing.T) {
p := profile(t)
p := profileName(t)
mk := NewMinikubeRunner(t, p)
if !isTestNoneDriver() { // none driver doesnt need to be deleted
defer mk.TearDown(t)

View File

@ -41,7 +41,7 @@ func TestContainerd(t *testing.T) {
}
func testGvisorRestart(t *testing.T) {
p := profile(t)
p := profileName(t)
if toParallel() {
t.Parallel()
}

View File

@ -31,7 +31,7 @@ func TestDocker(t *testing.T) {
if isTestNoneDriver() {
t.Skip("skipping test as none driver does not bundle docker")
}
p := profile(t)
p := profileName(t)
if toParallel() {
t.Parallel()
}

View File

@ -58,9 +58,9 @@ func isTestNoneDriver() bool {
return strings.Contains(*startArgs, "--vm-driver=none")
}
// profile chooses a profile name based on the test name
// profileName chooses a profile name based on the test name
// to be used in minikube and kubecontext across that test
func profile(t *testing.T) string {
func profileName(t *testing.T) string {
if isTestNoneDriver() {
return "minikube"
}
@ -68,6 +68,9 @@ func profile(t *testing.T) string {
if strings.Contains(p, "/") { // for i.e, TestFunctional/SSH returns TestFunctional
p = strings.Split(p, "/")[0]
}
if p == "TestFunctional" {
return "minikube"
}
return p
}

View File

@ -41,7 +41,7 @@ import (
func testAddons(t *testing.T) {
t.Parallel()
p := "minikube"
p := profileName(t)
client, err := pkgutil.GetClient(p)
if err != nil {
t.Fatalf("Could not get kubernetes client: %v", err)
@ -78,7 +78,7 @@ func readLineWithTimeout(b *bufio.Reader, timeout time.Duration) (string, error)
func testDashboard(t *testing.T) {
t.Parallel()
p := "minikube"
p := profileName(t)
mk := NewMinikubeRunner(t, p, "--wait=false")
cmd, out := mk.RunDaemon("dashboard --url")
defer func() {
@ -124,7 +124,7 @@ func testDashboard(t *testing.T) {
func testIngressController(t *testing.T) {
t.Parallel()
p := "minikube"
p := profileName(t)
mk := NewMinikubeRunner(t, p, "--wait=false")
kr := util.NewKubectlRunner(t, p)
@ -173,7 +173,7 @@ func testIngressController(t *testing.T) {
func testServicesList(t *testing.T) {
t.Parallel()
p := "minikube"
p := profileName(t)
mk := NewMinikubeRunner(t, p)
checkServices := func() error {
@ -189,7 +189,7 @@ func testServicesList(t *testing.T) {
}
func testRegistry(t *testing.T) {
t.Parallel()
p := "minikube"
p := profileName(t)
mk := NewMinikubeRunner(t, p)
mk.RunCommand("addons enable registry", true)
client, err := pkgutil.GetClient(p)

View File

@ -32,7 +32,7 @@ import (
func testClusterDNS(t *testing.T) {
t.Parallel()
p := "minikube"
p := profileName(t)
client, err := pkgutil.GetClient(p)
if err != nil {
t.Fatalf("Error getting kubernetes client %v", err)

View File

@ -30,7 +30,7 @@ import (
// Assert that docker-env subcommand outputs usable information for "docker ps"
func testClusterEnv(t *testing.T) {
t.Parallel()
p := "minikube"
p := profileName(t)
mk := NewMinikubeRunner(t, p, "--wait=false")
// Set a specific shell syntax so that we don't have to handle every possible user shell

View File

@ -25,7 +25,7 @@ import (
func testClusterLogs(t *testing.T) {
t.Parallel()
p := "minikube"
p := profileName(t)
mk := NewMinikubeRunner(t, p)
logsCmdOutput := mk.GetLogs()

View File

@ -25,7 +25,7 @@ import (
func testClusterSSH(t *testing.T) {
t.Parallel()
p := "minikube"
p := profileName(t)
mk := NewMinikubeRunner(t, p, "--wait=false")
expectedStr := "hello"
sshCmdOutput, stderr := mk.RunCommand("ssh echo "+expectedStr, true)

View File

@ -28,7 +28,7 @@ import (
)
func testClusterStatus(t *testing.T) {
p := "minikube"
p := profileName(t)
kr := util.NewKubectlRunner(t, p)
cs := api.ComponentStatusList{}

View File

@ -42,7 +42,7 @@ func testMounting(t *testing.T) {
}
t.Parallel()
p := "minikube"
p := profileName(t)
mk := NewMinikubeRunner(t, p, "--wait=false")
tempDir, err := ioutil.TempDir("", "mounttest")

View File

@ -25,7 +25,7 @@ import (
// testProfileList tests the `minikube profile list` command
func testProfileList(t *testing.T) {
p := "minikube"
p := profileName(t)
t.Parallel()
mk := NewMinikubeRunner(t, p, "--wait=false")
out, stderr := mk.RunCommand("profile list", true)

View File

@ -39,7 +39,7 @@ var (
)
func testProvisioning(t *testing.T) {
p := "minikube"
p := profileName(t)
t.Parallel()
kr := util.NewKubectlRunner(t, p)

View File

@ -45,7 +45,7 @@ func testTunnel(t *testing.T) {
}
t.Log("starting tunnel test...")
p := "minikube"
p := profileName(t)
mk := NewMinikubeRunner(t, p, "--wait=false")
go func() {
output, stderr := mk.RunCommand("tunnel --alsologtostderr -v 8 --logtostderr", true)

View File

@ -23,7 +23,8 @@ import (
)
func TestFunctional(t *testing.T) {
mk := NewMinikubeRunner(t, "minikube")
p := profileName(t)
mk := NewMinikubeRunner(t, p)
stdout, stderr, err := mk.Start()
if err != nil {
t.Fatalf("failed to start minikube failed : %v\nstdout: %s\nstderr: %s", err, stdout, stderr)

View File

@ -25,7 +25,7 @@ import (
)
func TestISO(t *testing.T) {
p := profile(t)
p := profileName(t)
if toParalle() {
t.Parallel()
}
@ -47,7 +47,7 @@ func TestISO(t *testing.T) {
}
func testMountPermissions(t *testing.T) {
p := profile(t)
p := profileName(t)
mk := NewMinikubeRunner(t, p, "--wait=false")
// test mount permissions
mountPoints := []string{"/Users", "/hosthome"}
@ -70,7 +70,7 @@ func testMountPermissions(t *testing.T) {
}
func testPackages(t *testing.T) {
p := profile(t)
p := profileName(t)
mk := NewMinikubeRunner(t, p, "--wait=false")
packages := []string{
@ -93,7 +93,7 @@ func testPackages(t *testing.T) {
}
func testPersistence(t *testing.T) {
p := profile(t)
p := profileName(t)
mk := NewMinikubeRunner(t, p, "--wait=false")
for _, dir := range []string{

View File

@ -30,7 +30,7 @@ func TestPersistence(t *testing.T) {
if isTestNoneDriver() {
t.Skip("skipping test as none driver does not support persistence")
}
p := profile(t)
p := profileName(t)
if toParallel() {
t.Parallel()
}

View File

@ -31,7 +31,7 @@ import (
)
func TestStartStop(t *testing.T) {
p := profile(t) // gets profile name used for minikube and kube context
p := profileName(t) // gets profile name used for minikube and kube context
if toParallel() {
t.Parallel()
}

View File

@ -53,7 +53,7 @@ func fileExists(fname string) error {
// the odlest supported k8s version and then runs the current head minikube
// and it tries to upgrade from the older supported k8s to news supported k8s
func TestVersionUpgrade(t *testing.T) {
p := profile(t)
p := profileName(t)
if toParallel() {
t.Parallel()
}

View File

@ -67,10 +67,8 @@ func setUpProxy(t *testing.T) (*http.Server, error) {
func TestProxy(t *testing.T) {
origHP := os.Getenv("HTTP_PROXY")
origNP := os.Getenv("NO_PROXY")
p := profile(t) // profile name
if isTestNoneDriver() {
p = "minikube"
}
p := profileName(t) // profile name
if isTestNoneDriver() {
// TODO fix this later
t.Skip("Skipping proxy warning for none")
@ -110,7 +108,7 @@ func TestProxy(t *testing.T) {
// testProxyWarning checks user is warned correctly about the proxy related env vars
func testProxyWarning(t *testing.T) {
p := profile(t) // profile name
p := profileName(t) // profile name
mk := NewMinikubeRunner(t, p)
stdout, stderr, err := mk.Start()
if err != nil {
@ -130,7 +128,7 @@ func testProxyWarning(t *testing.T) {
// testProxyDashboard checks if dashboard URL is accessible if proxy is set
func testProxyDashboard(t *testing.T) {
p := profile(t) // profile name
p := profileName(t) // profile name
mk := NewMinikubeRunner(t, p)
cmd, out := mk.RunDaemon("dashboard --url")
defer func() {