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.
This commit is contained in:
Aaron Crickenberger
2017-02-16 11:20:38 -08:00
parent 2be53cf0f8
commit b367f33bc2
2 changed files with 13 additions and 0 deletions

View File

@@ -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)