Linter fixes PR 3 (#4415)

* Linter fixes

* fix(bsr): update test to register TEST protocol once

---------

Co-authored-by: Damian Debkowski <damian.debkowski@hashicorp.com>
This commit is contained in:
Jeff MitchellandDamian Debkowski authored and GitHub committed 2024-02-16 08:30:16 -05:00
1 parent e95eda7ca2
commit 35cef97bd4
119 files changed
+365 -300

No files matched your search

@@ -136,7 +136,9 @@ func createTestServers(t *testing.T) ([]*serverTestInfo, error) {
lInfo := &serverTestInfo{srv: srv, address: listener.Addr().String()}
servers = append(servers, lInfo)
go func(i int) {
servers[i].srv.Serve(listener)
if err := servers[i].srv.Serve(listener); err != nil {
t.Logf("error serving: %v", err)
}
}(i)
}
@@ -228,7 +228,8 @@ func TestHijack_MultipleCalls(t *testing.T) {
n := 10
for i := 0; i < n; i++ {
mw.Hijack()
_, _, err := mw.Hijack()
require.NoError(t, err)
}
require.Equal(t, n, thh.hijackCalledN)
require.Equal(t, 1, tpg.incCalledN)
@@ -30,7 +30,7 @@ func TestProxyDialer(t *testing.T) {
l, err := net.Listen("tcp", "127.0.0.1:0")
require.NoError(t, err)
go func() {
l.Accept()
_, _ = l.Accept()
}()
defer l.Close()
ctx := context.Background()
+1
View File
@@ -48,6 +48,7 @@ func TestWsConn(t testing.TB, ctx context.Context) (clientConn, proxyConn *webso
time.Sleep(time.Duration(1.5 * float64(time.Second)))
clientConn, _, err = websocket.Dial(ctx, fmt.Sprintf("ws://%s", l.Addr().String()), nil)
require.NoError(err)
t.Cleanup(func() { _ = clientConn.Close(websocket.StatusGoingAway, "done") })
wg.Wait()
return
}
+4 -2
View File
@@ -214,7 +214,7 @@ func (s *sess) GetLocalConnections() map[string]ConnInfo {
return res
}
// Return local tofu token, if availble; otherwise return the tofu token from the resp
// Return local tofu token, if available; otherwise return the tofu token from the resp
func (s *sess) GetTofuToken() string {
s.lock.RLock()
defer s.lock.RUnlock()
@@ -352,7 +352,9 @@ func (s *sess) RequestConnectConnection(ctx context.Context, info *pbs.ConnectCo
if err != nil {
return err
}
s.ApplyLocalConnectionStatus(info.GetConnectionId(), st)
if err := s.ApplyLocalConnectionStatus(info.GetConnectionId(), st); err != nil {
return fmt.Errorf("error applying local connection status: %w", err)
}
return nil
}
+1 -1
View File
@@ -559,7 +559,7 @@ func NewTestMultihopWorkers(t testing.TB,
}
// NewAuthorizedPkiTestWorker creates a new test worker with the provided upstreams
// and creates it in the provided repo as an authroized worker. It returns
// and creates it in the provided repo as an authorized worker. It returns
// The TestWorker and it's boundary id.
func NewAuthorizedPkiTestWorker(t *testing.T, repo *server.Repository, name string, upstreams []string) (*TestWorker, string) {
t.Helper()