NOISSUE - Fix run script and compiler warnings (#1336)

* Fix NATS server naming in run script

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Fix warnings

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Fix typo

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
This commit is contained in:
Dušan Borovčanin 2021-01-26 01:07:06 +01:00 committed by GitHub
parent bf5ede086a
commit 31f5bf714a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 11 deletions

2
.env
View File

@ -86,7 +86,7 @@ MF_MQTT_BROKER_WS_PORT=8080
MF_MQTT_ADAPTER_ES_DB=0
MF_MQTT_ADAPTER_ES_PASS=
### VERMEMQ
### VERNEMQ
MF_DOCKER_VERNEMQ_ALLOW_ANONYMOUS=on
MF_DOCKER_VERNEMQ_LOG__CONSOLE__LEVEL=error

View File

@ -39,8 +39,9 @@ func (lvl Level) isAllowed(logLevel Level) bool {
return lvl <= logLevel
}
// UnmarshalText returns log Level for the given string representation.
func (lvl *Level) UnmarshalText(text string) error {
switch string(strings.ToLower(text)) {
switch strings.ToLower(text) {
case "debug":
*lvl = Debug
case "info":

View File

@ -82,9 +82,6 @@ func (repo mongoRepository) ReadAll(chanID string, offset, limit uint64, query m
if err != nil {
return readers.MessagesPage{}, errors.Wrap(errReadMessages, err)
}
if total < 0 {
return readers.MessagesPage{}, nil
}
return readers.MessagesPage{
Total: uint64(total),

View File

@ -21,18 +21,18 @@ function cleanup {
###
# NATS
###
gnatsd &
nats-server &
counter=1
until nc -zv localhost 4222 1>/dev/null 2>&1;
until fuser 4222/tcp 1>/dev/null 2>&1;
do
sleep 0.5
((counter++))
if [ ${counter} -gt 10 ]
then
echo -ne "gnatsd failed to start in 5 sec, exiting"
echo "NATS failed to start in 5 sec, exiting"
exit 1
fi
echo -ne "Waiting for gnatsd"
echo "Waiting for NATS server"
done
###

View File

@ -6,6 +6,7 @@ package mocks
import (
"context"
"sort"
"strconv"
"strings"
"sync"
@ -31,7 +32,7 @@ func (srm *stateRepositoryMock) Save(ctx context.Context, st twins.State) error
srm.mu.Lock()
defer srm.mu.Unlock()
srm.states[key(st.TwinID, string(st.ID))] = st
srm.states[key(st.TwinID, strconv.FormatInt(st.ID, 10))] = st
return nil
}
@ -41,7 +42,7 @@ func (srm *stateRepositoryMock) Update(ctx context.Context, st twins.State) erro
srm.mu.Lock()
defer srm.mu.Unlock()
srm.states[key(st.TwinID, string(st.ID))] = st
srm.states[key(st.TwinID, strconv.FormatInt(st.ID, 10))] = st
return nil
}