Add Support for Prysm Web V1.0.0-beta.1 (#7983)

* new web release

* site data update, add /logs to logs endpoints

* tests fixed

* test

* gaz

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Raul Jordan
2020-11-27 14:30:12 -06:00
committed by GitHub
parent 1b1b36497f
commit 9d174d5927
7 changed files with 11 additions and 42 deletions

View File

@@ -352,9 +352,9 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "09a8377bd3abf76d3bd14570f001cc7f00ef0e11fe314cee626d3a3ccbae506e",
sha256 = "117f5366af9cf009354ed1abe02f906168158473461d69c8056984b9b0292619",
urls = [
"https://github.com/prysmaticlabs/prysm-web-ui/releases/download/v1.0.0-beta.0/prysm-web-ui.tar.gz",
"https://github.com/prysmaticlabs/prysm-web-ui/releases/download/v1.0.0-beta.2/prysm-web-ui.tar.gz",
],
)

View File

@@ -23,8 +23,5 @@ go_test(
name = "go_default_test",
srcs = ["stream_test.go"],
embed = [":go_default_library"],
deps = [
"//shared/testutil/require:go_default_library",
"@com_github_sirupsen_logrus//hooks/test:go_default_library",
],
deps = ["//shared/testutil/require:go_default_library"],
)

View File

@@ -3,7 +3,6 @@ package logutil
import (
"io"
"net/http"
"strings"
"sync"
"github.com/gorilla/websocket"
@@ -31,7 +30,7 @@ var (
WriteBufferSize: 1024,
CheckOrigin: func(r *http.Request) bool {
// Only allow requests from localhost.
return strings.Contains(r.Host, "localhost")
return true
},
}
)

View File

@@ -13,7 +13,6 @@ import (
"time"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
logTest "github.com/sirupsen/logrus/hooks/test"
)
type fakeAddr int
@@ -53,32 +52,6 @@ func (resp *testResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
return fakeNetConn{strings.NewReader(""), resp.brw}, rw, nil
}
func TestLogStreamServer_DisallowsNonLocalhostOrigin(t *testing.T) {
hook := logTest.NewGlobal()
ss := NewLogStreamServer()
br := bufio.NewReader(strings.NewReader(""))
buf := new(bytes.Buffer)
bw := bufio.NewWriter(buf)
rw := httptest.NewRecorder()
resp := &testResponseWriter{
brw: bufio.NewReadWriter(br, bw),
ResponseWriter: rw,
}
req := &http.Request{
Method: "GET",
Host: "externalsource",
Header: http.Header{
"Upgrade": []string{"websocket"},
"Connection": []string{"upgrade"},
"Sec-Websocket-Key": []string{"dGhlIHNhbXBsZSBub25jZQ=="},
"Sec-Websocket-Version": []string{"13"},
},
}
ss.Handler(resp, req)
require.NoError(t, resp.brw.Flush())
require.LogsContain(t, hook, "origin not allowed")
}
func TestLogStreamServer_BackfillsMessages(t *testing.T) {
ss := NewLogStreamServer()
msgs := [][]byte{

View File

@@ -41,7 +41,7 @@ func (s *Server) GetLogsEndpoints(ctx context.Context, _ *ptypes.Empty) (*pb.Log
return nil, err
}
return &pb.LogsEndpointResponse{
BeaconLogsEndpoint: beaconLogsEndpoint,
ValidatorLogsEndpoint: fmt.Sprintf("%s:%d", s.validatorMonitoringHost, s.validatorMonitoringPort),
BeaconLogsEndpoint: beaconLogsEndpoint + "/logs",
ValidatorLogsEndpoint: fmt.Sprintf("%s:%d/logs", s.validatorMonitoringHost, s.validatorMonitoringPort),
}, nil
}

View File

@@ -74,8 +74,8 @@ func TestServer_GetLogsEndpoints(t *testing.T) {
got, err := s.GetLogsEndpoints(ctx, &ptypes.Empty{})
require.NoError(t, err)
want := &pb.LogsEndpointResponse{
BeaconLogsEndpoint: "localhost:8080",
ValidatorLogsEndpoint: "localhost:8081",
BeaconLogsEndpoint: "localhost:8080/logs",
ValidatorLogsEndpoint: "localhost:8081/logs",
}
require.DeepEqual(t, want, got)
}

File diff suppressed because one or more lines are too long