Skip to content

Commit

Permalink
change vendor for debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Gekko0114 committed May 7, 2023
1 parent 5e528ce commit 6f6a6d9
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 24 deletions.
2 changes: 1 addition & 1 deletion pkg/autoscaler/statserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (s *Server) Handler(w http.ResponseWriter, r *http.Request) {
if err != nil {
// We close abnormally, because we're just closing the connection in the client,
// which is okay. There's no value delaying closure of the connection unnecessarily.
if errors.Is(err, io.ErrUnexpectedEOF) {
if errors.Is(err, io.EOF) {
s.logger.Debug("Handler disconnected")
} else {
s.logger.Errorf("Handler exiting on error: %#v", err)
Expand Down
1 change: 1 addition & 0 deletions test/e2e/websocket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ func TestWebSocket(t *testing.T) {
if err := ValidateWebSocketConnection(t, clients, names, NoDelay); err != nil {
t.Error(err)
}
t.Fatal("debug")
}

// and with -1 as target burst capacity and then validates that we can still serve.
Expand Down
17 changes: 8 additions & 9 deletions test/e2e/websocket_ws.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import (
"fmt"
"io"
"net"
"net/http"
"net/url"
"strings"
"testing"
"time"

"github.com/gobwas/ws"
"github.com/gobwas/ws/wsutil"
Expand Down Expand Up @@ -62,12 +62,11 @@ func connectWS(t *testing.T, clients *test.Clients, domain, timeout string) (net
waitErr := wait.PollImmediate(connectRetryInterval, connectTimeout, func() (bool, error) {
t.Logf("Connecting using websocket: url=%s, host=%s", u.String(), domain)
dialer := &ws.Dialer{
// Timeout: 45 * time.Second,
Header: ws.HandshakeHeaderHTTP(http.Header{"Host": {domain}}),
Timeout: 45 * time.Second,
OnStatusError: func(status int, reason []byte, resp io.Reader) {
var b bytes.Buffer
io.Copy(&b, resp)
t.Logf("HTTP connection failed: %v Response=%+v. ResponseBody=%q", reason, status, b.String())
t.Logf("HTTP connection failed: %v Response=%+v. ResponseBody=%q", string(reason), status, b.String())
},
}
if test.ServingFlags.HTTPS {
Expand All @@ -76,16 +75,16 @@ func connectWS(t *testing.T, clients *test.Clients, domain, timeout string) (net
}

c, _, _, err := dialer.Dial(context.TODO(), u.String())
if c != nil {
t.Log("WebSocket connection established.")
conn = c
return true, nil
}
if err != nil {
// We don't have an HTTP response, probably TCP errors.
t.Log("Connection failed:", err)
return false, nil
}
if c != nil {
t.Log("WebSocket connection established.")
conn = c
return true, nil
}
return false, nil
})
return conn, waitErr
Expand Down
4 changes: 3 additions & 1 deletion test/test_images/wsserver/echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package main
import (
"errors"
"flag"
"fmt"
"io"
"log"
"net/http"
Expand Down Expand Up @@ -50,6 +51,7 @@ var upgrader = ws.HTTPUpgrader{}
func handler(w http.ResponseWriter, r *http.Request) {
params := r.URL.Query()
d := params.Get("delay")
fmt.Println("debug: handler is called")
if d != "" {
log.Println("Found delay header")
parsed, _ := strconv.Atoi(d)
Expand All @@ -73,7 +75,7 @@ func handler(w http.ResponseWriter, r *http.Request) {
if err != nil {
// We close abnormally, because we're just closing the connection in the client,
// which is okay. There's no value delaying closure of the connection unnecessarily.
if errors.Is(err, io.ErrUnexpectedEOF) {
if errors.Is(err, io.EOF) {
log.Println("Client disconnected.")
} else {
log.Println("Handler exiting on error:", err)
Expand Down
9 changes: 8 additions & 1 deletion vendor/github.com/gobwas/ws/dialer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions vendor/github.com/gobwas/ws/http.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 19 additions & 12 deletions vendor/github.com/gorilla/websocket/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6f6a6d9

Please sign in to comment.