Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

Commit

Permalink
NATS fixes and debugging
Browse files Browse the repository at this point in the history
This introduces some debugging statements and fixes our usage of a
deprecated library function.

Signed-off-by: Juan Antonio Osorio <juan.osoriorobles@eu.equinix.com>
  • Loading branch information
JAORMX committed Dec 22, 2022
1 parent 22a6823 commit bc8c3f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions notifier/nats/nats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func TestBasicNotifications(t *testing.T) {

msgChan := make(chan *natsgo.Msg, 10)
_, err = clientconn.Subscribe(subject, func(m *natsgo.Msg) {
t.Logf("Received message: %s", string(m.Data))
msgChan <- m
})
assert.NoError(t, err, "creating NATS subscription")
Expand Down
6 changes: 5 additions & 1 deletion notifier/nats/utils/testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package utils

import (
"errors"
"fmt"
"testing"
"time"

Expand All @@ -19,13 +20,16 @@ const (
func StartNatsServer() (*natssrv.Server, error) {
const maxControlLine = 2048

s := natssrv.New(&natssrv.Options{
s, err := natssrv.NewServer(&natssrv.Options{
Host: "127.0.0.1",
Port: natssrv.RANDOM_PORT,
NoLog: true,
NoSigs: true,
MaxControlLine: maxControlLine,
})
if err != nil {
return nil, fmt.Errorf("building nats server: %w", err)
}

//nolint:errcheck // we don't care about the error here
go natssrv.Run(s)
Expand Down

0 comments on commit bc8c3f7

Please sign in to comment.