From b367f33bc21cf687cd3f63cac33ddea69e56d35d Mon Sep 17 00:00:00 2001 From: Aaron Crickenberger Date: Thu, 16 Feb 2017 11:20:38 -0800 Subject: [PATCH] Allow `make test-integration` to pass on OSX `/var/run` is not world-writable on my OSX 10.11.x setup, so tests that standup a secure apiserver fail with the default cert dir. Use a tempdir instead. --- test/integration/examples/apiserver_test.go | 5 +++++ test/integration/kubeaggregator/aggregator_test.go | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/test/integration/examples/apiserver_test.go b/test/integration/examples/apiserver_test.go index 636f3d370a5..40fc308e0e2 100644 --- a/test/integration/examples/apiserver_test.go +++ b/test/integration/examples/apiserver_test.go @@ -57,6 +57,10 @@ func TestRunServer(t *testing.T) { defer os.Remove(kubeconfigFile.Name()) clientcmd.WriteToFile(*adminKubeConfig, kubeconfigFile.Name()) + // Avoid default cert-dir of /var/run/kubernetes to allow this to run on darwin + certDir, _ := ioutil.TempDir("", "test-integration-apiserver") + defer os.Remove(certDir) + stopCh := make(chan struct{}) defer close(stopCh) cmd := server.NewCommandStartWardleServer(os.Stdout, os.Stderr, stopCh) @@ -66,6 +70,7 @@ func TestRunServer(t *testing.T) { "--authentication-kubeconfig", kubeconfigFile.Name(), "--authorization-kubeconfig", kubeconfigFile.Name(), "--etcd-servers", framework.GetEtcdURLFromEnv(), + "--cert-dir", certDir, }) go cmd.Execute() diff --git a/test/integration/kubeaggregator/aggregator_test.go b/test/integration/kubeaggregator/aggregator_test.go index 2b9ef472c50..37acb77ccb2 100644 --- a/test/integration/kubeaggregator/aggregator_test.go +++ b/test/integration/kubeaggregator/aggregator_test.go @@ -18,7 +18,9 @@ package kubeaggregator import ( "fmt" + "io/ioutil" "net/http" + "os" "testing" "time" @@ -50,6 +52,12 @@ func runAPIServer(t *testing.T, stopCh <-chan struct{}) string { // Change the ports, because otherwise it will fail if examples/apiserver/apiserver_test and this are run in parallel. serverRunOptions.SecureServing.ServingOptions.BindPort = 6443 + 3 serverRunOptions.InsecureServing.BindPort = 8080 + 3 + + // Avoid default cert-dir of /var/run/kubernetes to allow this to run on darwin + certDir, _ := ioutil.TempDir("", "test-integration-kubeaggregator") + defer os.Remove(certDir) + serverRunOptions.SecureServing.ServerCert.CertDirectory = certDir + go func() { if err := serverRunOptions.Run(stopCh); err != nil { t.Fatalf("Error in bringing up the example apiserver: %v", err)