mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-04 18:52:38 +00:00
Update test/integration/serving/serving_test.go
Co-authored-by: Antonio Ojea <antonio.ojea.garcia@gmail.com>
This commit is contained in:
committed by
Henry Wu
parent
5a8d77a2ae
commit
8bd4e1bab2
@@ -22,6 +22,7 @@ import (
|
|||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
@@ -382,8 +383,13 @@ users:
|
|||||||
if want, got := tt.wantSecureCode != nil, secureInfo != nil; want != got {
|
if want, got := tt.wantSecureCode != nil, secureInfo != nil; want != got {
|
||||||
t.Errorf("SecureServing enabled: expected=%v got=%v", want, got)
|
t.Errorf("SecureServing enabled: expected=%v got=%v", want, got)
|
||||||
} else if want {
|
} else if want {
|
||||||
url := fmt.Sprintf("https://%s%s", secureInfo.Listener.Addr().String(), tt.path)
|
// only interested on the port, because we are using always localhost
|
||||||
url = strings.ReplaceAll(url, "[::]", "127.0.0.1") // switch to IPv4 because the self-signed cert does not support [::]
|
_, port, err := net.SplitHostPort(secureInfo.Listener.Addr().String())
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("could not get host and port from %s : %v", secureInfo.Listener.Addr().String(), err)
|
||||||
|
}
|
||||||
|
// use IPv4 because the self-signed cert does not support [::]
|
||||||
|
url := fmt.Sprintf("https://127.0.0.1:%s%s", port, tt.path)
|
||||||
|
|
||||||
// read self-signed server cert disk
|
// read self-signed server cert disk
|
||||||
pool := x509.NewCertPool()
|
pool := x509.NewCertPool()
|
||||||
|
Reference in New Issue
Block a user