Skip to content

Commit

Permalink
Fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
binwiederhier committed Nov 17, 2023
1 parent 22f48c5 commit b650447
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 12 deletions.
4 changes: 0 additions & 4 deletions cmd/serve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ import (
"heckel.io/ntfy/v2/util"
)

func init() {
rand.Seed(time.Now().UnixMilli())
}

func TestCLI_Serve_Unix_Curl(t *testing.T) {
sockFile := filepath.Join(t.TempDir(), "ntfy.sock")
configFile := newEmptyFile(t) // Avoid issues with existing server.yml file on system
Expand Down
2 changes: 1 addition & 1 deletion server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package server
import (
"bufio"
"context"
"crypto/rand"
"encoding/base64"
"encoding/json"
"fmt"
"golang.org/x/crypto/bcrypt"
"heckel.io/ntfy/v2/user"
"io"
"math/rand"
"net/http"
"net/http/httptest"
"net/netip"
Expand Down
4 changes: 2 additions & 2 deletions server/topic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestTopic_Subscribe_DuplicateID(t *testing.T) {
t.Parallel()
to := newTopic("mytopic")

// Fix random seed to force same number generation
//lint:ignore SA1019 Fix random seed to force same number generation
rand.Seed(1)
a := rand.Int()
to.subscribers[a] = &topicSubscriber{
Expand All @@ -82,7 +82,7 @@ func TestTopic_Subscribe_DuplicateID(t *testing.T) {
return nil
}

// Force rand.Int to generate the same id once more
//lint:ignore SA1019 Force rand.Int to generate the same id once more
rand.Seed(1)
id := to.Subscribe(subFn, "b", func() {})
res := to.subscribers[id]
Expand Down
5 changes: 0 additions & 5 deletions test/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@ import (
"net/http"
"path/filepath"
"testing"
"time"
)

func init() {
rand.Seed(time.Now().UnixMilli())
}

// StartServer starts a server.Server with a random port and waits for the server to be up
func StartServer(t *testing.T) (*server.Server, int) {
return StartServerWithConfig(t, server.NewConfig())
Expand Down

0 comments on commit b650447

Please sign in to comment.