mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Merge pull request #86931 from roycaihw/crd-openapi-deflake
crd openapi e2e: increase waitForOpenAPISchema timeout
This commit is contained in:
commit
5b4d1bf559
@ -9,6 +9,7 @@ require (
|
|||||||
github.com/emicklei/go-restful v2.9.5+incompatible
|
github.com/emicklei/go-restful v2.9.5+incompatible
|
||||||
github.com/go-openapi/spec v0.19.3
|
github.com/go-openapi/spec v0.19.3
|
||||||
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d
|
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d
|
||||||
|
github.com/json-iterator/go v1.1.8
|
||||||
github.com/spf13/cobra v0.0.5
|
github.com/spf13/cobra v0.0.5
|
||||||
github.com/spf13/pflag v1.0.5
|
github.com/spf13/pflag v1.0.5
|
||||||
github.com/stretchr/testify v1.4.0
|
github.com/stretchr/testify v1.4.0
|
||||||
|
@ -20,6 +20,7 @@ go_library(
|
|||||||
"//staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1:go_default_library",
|
"//staging/src/k8s.io/kube-aggregator/pkg/apis/apiregistration/v1:go_default_library",
|
||||||
"//vendor/github.com/emicklei/go-restful:go_default_library",
|
"//vendor/github.com/emicklei/go-restful:go_default_library",
|
||||||
"//vendor/github.com/go-openapi/spec:go_default_library",
|
"//vendor/github.com/go-openapi/spec:go_default_library",
|
||||||
|
"//vendor/github.com/json-iterator/go:go_default_library",
|
||||||
"//vendor/k8s.io/klog:go_default_library",
|
"//vendor/k8s.io/klog:go_default_library",
|
||||||
"//vendor/k8s.io/kube-openapi/pkg/aggregator:go_default_library",
|
"//vendor/k8s.io/kube-openapi/pkg/aggregator:go_default_library",
|
||||||
"//vendor/k8s.io/kube-openapi/pkg/builder:go_default_library",
|
"//vendor/k8s.io/kube-openapi/pkg/builder:go_default_library",
|
||||||
|
@ -18,12 +18,12 @@ package aggregator
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/sha512"
|
"crypto/sha512"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/go-openapi/spec"
|
"github.com/go-openapi/spec"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
|
|
||||||
"k8s.io/apiserver/pkg/authentication/user"
|
"k8s.io/apiserver/pkg/authentication/user"
|
||||||
"k8s.io/apiserver/pkg/endpoints/request"
|
"k8s.io/apiserver/pkg/endpoints/request"
|
||||||
@ -80,7 +80,7 @@ func (s *Downloader) Download(handler http.Handler, etag string) (returnSpec *sp
|
|||||||
return nil, "", http.StatusNotFound, nil
|
return nil, "", http.StatusNotFound, nil
|
||||||
case http.StatusOK:
|
case http.StatusOK:
|
||||||
openAPISpec := &spec.Swagger{}
|
openAPISpec := &spec.Swagger{}
|
||||||
if err := json.Unmarshal(writer.data, openAPISpec); err != nil {
|
if err := jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(writer.data, openAPISpec); err != nil {
|
||||||
return nil, "", 0, err
|
return nil, "", 0, err
|
||||||
}
|
}
|
||||||
newEtag = writer.Header().Get("Etag")
|
newEtag = writer.Header().Get("Etag")
|
||||||
|
@ -596,12 +596,12 @@ func waitForDefinitionCleanup(c k8sclientset.Interface, name string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func waitForOpenAPISchema(c k8sclientset.Interface, pred func(*spec.Swagger) (bool, string)) error {
|
func waitForOpenAPISchema(c k8sclientset.Interface, pred func(*spec.Swagger) (bool, string)) error {
|
||||||
client := c.CoreV1().RESTClient().(*rest.RESTClient).Client
|
client := c.Discovery().RESTClient().(*rest.RESTClient).Client
|
||||||
url := c.CoreV1().RESTClient().Get().AbsPath("openapi", "v2").URL()
|
url := c.Discovery().RESTClient().Get().AbsPath("openapi", "v2").URL()
|
||||||
lastMsg := ""
|
lastMsg := ""
|
||||||
etag := ""
|
etag := ""
|
||||||
var etagSpec *spec.Swagger
|
var etagSpec *spec.Swagger
|
||||||
if err := wait.Poll(500*time.Millisecond, wait.ForeverTestTimeout, mustSucceedMultipleTimes(waitSuccessThreshold, func() (bool, error) {
|
if err := wait.Poll(500*time.Millisecond, 60*time.Second, mustSucceedMultipleTimes(waitSuccessThreshold, func() (bool, error) {
|
||||||
// download spec with etag support
|
// download spec with etag support
|
||||||
spec := &spec.Swagger{}
|
spec := &spec.Swagger{}
|
||||||
req, err := http.NewRequest("GET", url.String(), nil)
|
req, err := http.NewRequest("GET", url.String(), nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user