mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +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/go-openapi/spec v0.19.3
|
||||
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/pflag v1.0.5
|
||||
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",
|
||||
"//vendor/github.com/emicklei/go-restful: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/kube-openapi/pkg/aggregator:go_default_library",
|
||||
"//vendor/k8s.io/kube-openapi/pkg/builder:go_default_library",
|
||||
|
@ -18,12 +18,12 @@ package aggregator
|
||||
|
||||
import (
|
||||
"crypto/sha512"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/go-openapi/spec"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
|
||||
"k8s.io/apiserver/pkg/authentication/user"
|
||||
"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
|
||||
case http.StatusOK:
|
||||
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
|
||||
}
|
||||
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 {
|
||||
client := c.CoreV1().RESTClient().(*rest.RESTClient).Client
|
||||
url := c.CoreV1().RESTClient().Get().AbsPath("openapi", "v2").URL()
|
||||
client := c.Discovery().RESTClient().(*rest.RESTClient).Client
|
||||
url := c.Discovery().RESTClient().Get().AbsPath("openapi", "v2").URL()
|
||||
lastMsg := ""
|
||||
etag := ""
|
||||
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
|
||||
spec := &spec.Swagger{}
|
||||
req, err := http.NewRequest("GET", url.String(), nil)
|
||||
|
Loading…
Reference in New Issue
Block a user