mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
Merge pull request #45123 from spiffxp/osx-make-test-integration-2
Automatic merge from submit-queue (batch tested with PRs 41583, 45117, 45123) Allow `make test-integration` to pass on OSX **What this PR does / why we need it**: `make test-integration` isn't passing on my OSX setup (10.11.6, go1.8.1, 17.05.0-ce-rc1). Tests that startup an api server fail because the default `cert-dir` of `/var/run/kubernetes` isn't world-writable. Use a tempdir instead. **Release note**: ```release-note NONE ``` ref: #41595 /cc @kubernetes/sig-testing-pr-reviews
This commit is contained in:
commit
9c1f7bff36
@ -22,9 +22,11 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"mime"
|
"mime"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
@ -395,7 +397,10 @@ const testNamespace = "etcdstoragepathtestnamespace"
|
|||||||
// It will also fail when a type gets moved to a different location. Be very careful in this situation because
|
// It will also fail when a type gets moved to a different location. Be very careful in this situation because
|
||||||
// it essentially means that you will be break old clusters unless you create some migration path for the old data.
|
// it essentially means that you will be break old clusters unless you create some migration path for the old data.
|
||||||
func TestEtcdStoragePath(t *testing.T) {
|
func TestEtcdStoragePath(t *testing.T) {
|
||||||
client, kvClient, mapper := startRealMasterOrDie(t)
|
certDir, _ := ioutil.TempDir("", "test-integration-etcd")
|
||||||
|
defer os.RemoveAll(certDir)
|
||||||
|
|
||||||
|
client, kvClient, mapper := startRealMasterOrDie(t, certDir)
|
||||||
defer func() {
|
defer func() {
|
||||||
dumpEtcdKVOnFailure(t, kvClient)
|
dumpEtcdKVOnFailure(t, kvClient)
|
||||||
}()
|
}()
|
||||||
@ -522,7 +527,7 @@ func TestEtcdStoragePath(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func startRealMasterOrDie(t *testing.T) (*allClient, clientv3.KV, meta.RESTMapper) {
|
func startRealMasterOrDie(t *testing.T, certDir string) (*allClient, clientv3.KV, meta.RESTMapper) {
|
||||||
_, defaultServiceClusterIPRange, err := net.ParseCIDR("10.0.0.0/24")
|
_, defaultServiceClusterIPRange, err := net.ParseCIDR("10.0.0.0/24")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@ -535,6 +540,7 @@ func startRealMasterOrDie(t *testing.T) (*allClient, clientv3.KV, meta.RESTMappe
|
|||||||
for {
|
for {
|
||||||
kubeAPIServerOptions := options.NewServerRunOptions()
|
kubeAPIServerOptions := options.NewServerRunOptions()
|
||||||
kubeAPIServerOptions.SecureServing.BindAddress = net.ParseIP("127.0.0.1")
|
kubeAPIServerOptions.SecureServing.BindAddress = net.ParseIP("127.0.0.1")
|
||||||
|
kubeAPIServerOptions.SecureServing.ServerCert.CertDirectory = certDir
|
||||||
kubeAPIServerOptions.Etcd.StorageConfig.ServerList = []string{framework.GetEtcdURLFromEnv()}
|
kubeAPIServerOptions.Etcd.StorageConfig.ServerList = []string{framework.GetEtcdURLFromEnv()}
|
||||||
kubeAPIServerOptions.Etcd.DefaultStorageMediaType = runtime.ContentTypeJSON // TODO use protobuf?
|
kubeAPIServerOptions.Etcd.DefaultStorageMediaType = runtime.ContentTypeJSON // TODO use protobuf?
|
||||||
kubeAPIServerOptions.ServiceClusterIPRange = *defaultServiceClusterIPRange
|
kubeAPIServerOptions.ServiceClusterIPRange = *defaultServiceClusterIPRange
|
||||||
|
Loading…
Reference in New Issue
Block a user