mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Fix federation unit tests as non-root
This commit is contained in:
parent
aa81e1d51d
commit
423db16bd2
@ -21,6 +21,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -44,10 +45,18 @@ var groupVersions = []schema.GroupVersion{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRun(t *testing.T) {
|
func TestRun(t *testing.T) {
|
||||||
|
certDir, err := ioutil.TempDir("", "")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Failed to create temporary certificate directory: %v", err)
|
||||||
|
}
|
||||||
|
defer os.RemoveAll(certDir)
|
||||||
|
|
||||||
s := options.NewServerRunOptions()
|
s := options.NewServerRunOptions()
|
||||||
s.SecureServing.ServingOptions.BindPort = securePort
|
s.SecureServing.ServingOptions.BindPort = securePort
|
||||||
s.InsecureServing.BindPort = insecurePort
|
s.InsecureServing.BindPort = insecurePort
|
||||||
s.Etcd.StorageConfig.ServerList = []string{"http://localhost:2379"}
|
s.Etcd.StorageConfig.ServerList = []string{"http://localhost:2379"}
|
||||||
|
s.SecureServing.ServerCert.CertDirectory = certDir
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
if err := app.Run(s); err != nil {
|
if err := app.Run(s); err != nil {
|
||||||
t.Fatalf("Error in bringing up the server: %v", err)
|
t.Fatalf("Error in bringing up the server: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user