Skip to content

Commit

Permalink
fix lint and hanging listener in test
Browse files Browse the repository at this point in the history
  • Loading branch information
fredcarle committed Mar 8, 2024
1 parent 30c6eab commit f4bec70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions http/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ func TestServerListenAndServeWithTLSAndInvalidCerts(t *testing.T) {
require.NoError(t, err)
err = srv.Serve()
require.ErrorContains(t, err, "no such file or directory")
err = srv.listener.Close()
require.NoError(t, err)
}

func TestServerListenAndServeWithAddress(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package node

import (
"context"
"errors"
"fmt"
gohttp "net/http"

Expand Down Expand Up @@ -167,7 +168,7 @@ func (n *Node) Start(ctx context.Context) error {
}

Check warning on line 168 in node/node.go

View check run for this annotation

Codecov / codecov/patch

node/node.go#L167-L168

Added lines #L167 - L168 were not covered by tests
log.FeedbackInfo(ctx, fmt.Sprintf("Providing HTTP API at %s.", n.Server.Address()))
go func() {
if err := n.Server.Serve(); err != nil && err != gohttp.ErrServerClosed {
if err := n.Server.Serve(); err != nil && !errors.Is(err, gohttp.ErrServerClosed) {
log.FeedbackErrorE(ctx, "HTTP server stopped", err)
}
}()
Expand Down

0 comments on commit f4bec70

Please sign in to comment.