Skip to content

Commit 2cd409e

Browse files
committed
resolve conflict
1 parent 8a50eb5 commit 2cd409e

4 files changed

Lines changed: 0 additions & 172 deletions

File tree

test/e2e/crds/v2/route.go

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,37 +2323,12 @@ spec:
23232323
applier.MustApplyAPIv2(types.NamespacedName{Namespace: s.Namespace(), Name: "default"},
23242324
new(apiv2.ApisixRoute), fmt.Sprintf(apisixRouteWithBackendWSS, s.Namespace()))
23252325

2326-
<<<<<<< HEAD
2327-
By("verify wss connection with retry")
2328-
u := url.URL{
2329-
Scheme: "wss",
2330-
Host: s.GetAPISIXHTTPSEndpoint(),
2331-
Path: "/ws",
2332-
}
2333-
headers := http.Header{"Host": []string{"api6.com"}}
2334-
dialer := websocket.Dialer{
2335-
TLSClientConfig: &tls.Config{
2336-
InsecureSkipVerify: true,
2337-
ServerName: "api6.com",
2338-
},
2339-
}
2340-
2341-
var conn *websocket.Conn
2342-
var resp *http.Response
2343-
Eventually(func() error {
2344-
var dialErr error
2345-
conn, resp, dialErr = dialer.Dial(u.String(), headers)
2346-
return dialErr
2347-
}).WithTimeout(30*time.Second).WithPolling(2*time.Second).Should(Succeed(), "WebSocket handshake should succeed")
2348-
Expect(resp.StatusCode).Should(Equal(http.StatusSwitchingProtocols))
2349-
=======
23502326
By("verify wss connection")
23512327
hostname := "api6.com"
23522328
conn := s.NewWebsocketClient(&tls.Config{
23532329
InsecureSkipVerify: true,
23542330
ServerName: hostname,
23552331
}, "/ws", http.Header{"Host": []string{hostname}})
2356-
>>>>>>> b70e22eb (fix: wss related tests are unstable (#2675))
23572332

23582333
defer func() {
23592334
_ = conn.Close()

test/e2e/gatewayapi/httproute.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2509,29 +2509,10 @@ spec:
25092509

25102510
By("verify wss connection")
25112511
hostname := "api6.com"
2512-
<<<<<<< HEAD
2513-
2514-
dialer := websocket.Dialer{
2515-
TLSClientConfig: &tls.Config{
2516-
InsecureSkipVerify: true,
2517-
ServerName: hostname,
2518-
},
2519-
}
2520-
2521-
var conn *websocket.Conn
2522-
var resp *http.Response
2523-
Eventually(func() error {
2524-
var dialErr error
2525-
conn, resp, dialErr = dialer.Dial(u.String(), headers)
2526-
return dialErr
2527-
}).WithTimeout(30*time.Second).WithPolling(2*time.Second).Should(Succeed(), "WebSocket handshake should succeed")
2528-
Expect(resp.StatusCode).Should(Equal(http.StatusSwitchingProtocols))
2529-
=======
25302512
conn := s.NewWebsocketClient(&tls.Config{
25312513
InsecureSkipVerify: true,
25322514
ServerName: hostname,
25332515
}, "/ws", http.Header{"Host": []string{hostname}})
2534-
>>>>>>> b70e22eb (fix: wss related tests are unstable (#2675))
25352516

25362517
defer func() {
25372518
_ = conn.Close()

test/e2e/ingress/ingress.go

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,35 +1121,11 @@ spec:
11211121
Expect(s.CreateResourceFromString(fmt.Sprintf(ingressWithWSS, s.Namespace()))).ShouldNot(HaveOccurred(), "creating Ingress")
11221122

11231123
By("verify wss connection")
1124-
<<<<<<< HEAD
1125-
u := url.URL{
1126-
Scheme: "wss",
1127-
Host: s.GetAPISIXHTTPSEndpoint(),
1128-
Path: "/ws",
1129-
}
1130-
headers := http.Header{"Host": []string{"api6.com"}}
1131-
dialer := websocket.Dialer{
1132-
TLSClientConfig: &tls.Config{
1133-
InsecureSkipVerify: true,
1134-
ServerName: "api6.com",
1135-
},
1136-
}
1137-
1138-
var conn *websocket.Conn
1139-
var resp *http.Response
1140-
Eventually(func() error {
1141-
var dialErr error
1142-
conn, resp, dialErr = dialer.Dial(u.String(), headers)
1143-
return dialErr
1144-
}).WithTimeout(30*time.Second).WithPolling(2*time.Second).Should(Succeed(), "WebSocket handshake should succeed")
1145-
Expect(resp.StatusCode).Should(Equal(http.StatusSwitchingProtocols))
1146-
=======
11471124
hostname := "api6.com"
11481125
conn := s.NewWebsocketClient(&tls.Config{
11491126
InsecureSkipVerify: true,
11501127
ServerName: hostname,
11511128
}, "/ws", http.Header{"Host": []string{hostname}})
1152-
>>>>>>> b70e22eb (fix: wss related tests are unstable (#2675))
11531129

11541130
defer func() {
11551131
_ = conn.Close()

test/e2e/scaffold/scaffold.go

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,6 @@ func (s *Scaffold) GetMetricsEndpoint() string {
580580
s.addFinalizers(tunnel.Close)
581581
return fmt.Sprintf("http://%s/metrics", tunnel.Endpoint())
582582
}
583-
<<<<<<< HEAD
584-
=======
585583

586584
func (s *Scaffold) NewWebsocketClient(tls *tls.Config, path string, headers http.Header) *websocket.Conn {
587585
var host = s.ApisixHTTPEndpoint()
@@ -616,105 +614,3 @@ func (s *Scaffold) NewWebsocketClient(tls *tls.Config, path string, headers http
616614
}).ShouldNot(HaveOccurred(), "establishing websocket connection")
617615
return conn
618616
}
619-
620-
func (s *Scaffold) ControlAPIClient() (ControlAPIClient, error) {
621-
tunnel := k8s.NewTunnel(s.kubectlOptions, k8s.ResourceTypeService, "apisix-control-api", 9090, 9090)
622-
if err := tunnel.ForwardPortE(s.t); err != nil {
623-
return nil, err
624-
}
625-
s.addFinalizers(tunnel.Close)
626-
627-
return &controlAPI{
628-
client: NewClient("http", tunnel.Endpoint()),
629-
}, nil
630-
}
631-
632-
func (s *Scaffold) EnsureNumService(controlAPIClient ControlAPIClient, matcher func(result int) bool) error {
633-
times := 0
634-
return wait.PollUntilContextTimeout(context.Background(), 100*time.Millisecond, 10*time.Minute, true, func(ctx context.Context) (done bool, err error) {
635-
times++
636-
results, _, err := controlAPIClient.ListServices()
637-
if err != nil {
638-
log.Errorw("failed to ListServices", zap.Error(err))
639-
return false, nil
640-
}
641-
if !matcher(len(results)) {
642-
log.Debugw("number of effective services", zap.Int("number", len(results)), zap.Int("times", times))
643-
return false, nil
644-
}
645-
return true, nil
646-
})
647-
}
648-
649-
func (s *Scaffold) ExpectUpstream(controlAPIClient ControlAPIClient, name string, matcher func(upstream adctypes.Upstream) bool) error {
650-
times := 0
651-
return wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 10*time.Minute, true, func(ctx context.Context) (done bool, err error) {
652-
times++
653-
upstreams, _, err := controlAPIClient.ListUpstreams()
654-
if err != nil {
655-
log.Errorw("failed to ListServices", zap.Error(err))
656-
return false, nil
657-
}
658-
for _, upstream := range upstreams {
659-
upsValue := upstream.(map[string]any)
660-
data, err := json.Marshal(upsValue["value"])
661-
if err != nil {
662-
return false, fmt.Errorf("failed to marshal upstream: %v", err)
663-
}
664-
665-
var ups adctypes.Upstream
666-
if err := json.Unmarshal(data, &ups); err != nil {
667-
return false, fmt.Errorf("failed to unmarshal upstream: %v", err)
668-
}
669-
if name != "" && ups.Name != name {
670-
continue
671-
}
672-
if ok := matcher(ups); !ok {
673-
return false, nil
674-
}
675-
}
676-
return true, nil
677-
})
678-
}
679-
680-
func (s *Scaffold) EnsureNumUpstreamNodes(controlAPIClient ControlAPIClient, name string, number int) error {
681-
return s.ExpectUpstream(controlAPIClient, name, func(upstream adctypes.Upstream) bool {
682-
if len(upstream.Nodes) != number {
683-
log.Warnf("expect upstream: [%s] nodes num to be %d, but got %d", upstream.Name, number, len(upstream.Nodes))
684-
return false
685-
}
686-
return true
687-
})
688-
}
689-
690-
type ControlAPIClient interface {
691-
ListServices() ([]any, int64, error)
692-
ListUpstreams() ([]any, int64, error)
693-
}
694-
695-
type controlAPI struct {
696-
client *httpexpect.Expect
697-
}
698-
699-
func (c *controlAPI) ListUpstreams() (result []any, total int64, err error) {
700-
resp := c.client.Request(http.MethodGet, "/v1/upstreams").Expect()
701-
if resp.Raw().StatusCode != http.StatusOK {
702-
return nil, 0, fmt.Errorf("unexpected status code: %v, message: %s", resp.Raw().StatusCode, resp.Body().Raw())
703-
}
704-
if err = json.Unmarshal([]byte(resp.Body().Raw()), &result); err != nil {
705-
return nil, 0, fmt.Errorf("failed to unmarshal response body: %w", err)
706-
}
707-
return result, int64(len(result)), err
708-
}
709-
710-
func (c *controlAPI) ListServices() (result []any, total int64, err error) {
711-
resp := c.client.Request(http.MethodGet, "/v1/services").Expect()
712-
if resp.Raw().StatusCode != http.StatusOK {
713-
return nil, 0, fmt.Errorf("unexpected status code: %v, message: %s", resp.Raw().StatusCode, resp.Body().Raw())
714-
}
715-
if err = json.Unmarshal([]byte(resp.Body().Raw()), &result); err != nil {
716-
return nil, 0, fmt.Errorf("failed to unmarshal response body: %w", err)
717-
}
718-
return result, int64(len(result)), err
719-
}
720-
>>>>>>> b70e22eb (fix: wss related tests are unstable (#2675))

0 commit comments

Comments
 (0)