diff --git a/Dockerfile b/Dockerfile index d24398d35eb7fb7a7a2df423ea4c6dba23501d0f..a9fe08225b745493a252e106f24c847fe058ca2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ -FROM golang:1.15-alpine AS builder +FROM golang:1.15-buster AS builder ARG GITLAB_USER ARG GITLAB_TOKEN ARG BUILDARGS WORKDIR /src/gosdn COPY . . -RUN apk add git +RUN apt-get update && apt-get install -y git RUN git config --global url."https://$GITLAB_USER:$GITLAB_TOKEN@code.fbi.h-da.de".insteadOf "https://code.fbi.h-da.de" -RUN CGO_ENABLED=0 GOOS=linux go build $BUILDARGS ./cmd/gosdn +RUN GOOS=linux go build $BUILDARGS ./cmd/gosdn FROM alpine:latest EXPOSE 8080 diff --git a/nucleus/integration_test.go b/nucleus/integration_test.go index 171cfd3b9570067509afe4e7007858825d56f979..b06da3e81e6c0f00305a11f7ba28bece0d1394fe 100644 --- a/nucleus/integration_test.go +++ b/nucleus/integration_test.go @@ -263,6 +263,7 @@ func TestGnmi_SubscribeIntegration(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + var wantErr = tt.wantErr g, err := NewGnmiTransport(tt.fields.opt) if err != nil { t.Error(err) @@ -271,10 +272,10 @@ func TestGnmi_SubscribeIntegration(t *testing.T) { ctx := context.WithValue(context.Background(), CtxKeyOpts, tt.args.opts) //nolint ctx, cancel := context.WithCancel(ctx) go func() { - err = g.Subscribe(ctx) - if (err != nil) != tt.wantErr { - if !tt.wantErr { - if err.Error() != "rpc error: code = Canceled desc = context canceled" { + subErr := g.Subscribe(ctx) + if (subErr != nil) != wantErr { + if !wantErr && subErr != nil { + if subErr.Error() != "rpc error: code = Canceled desc = context canceled" { t.Errorf("Subscribe() error = %v, wantErr %v", err, tt.wantErr) } } diff --git a/nucleus/store.go b/nucleus/store.go index a1fbdab764bd7fcb750b0e60ad309211f9caff2c..0563a5a30533467809380ac25d949bfc4b578e68 100644 --- a/nucleus/store.go +++ b/nucleus/store.go @@ -33,7 +33,7 @@ func (s store) add(item Storable) error { log.WithFields(log.Fields{ "type": reflect.TypeOf(item), "uuid": item.ID(), - }).Info("storable was added") + }).Debug("storable was added") return nil } @@ -43,7 +43,7 @@ func (s store) get(id uuid.UUID) (Storable, error) { } log.WithFields(log.Fields{ "uuid": id, - }).Info("storable was accessed") + }).Debug("storable was accessed") storeLock.RLock() defer storeLock.RUnlock() return s[id], nil @@ -58,7 +58,7 @@ func (s store) delete(id uuid.UUID) error { storeLock.Unlock() log.WithFields(log.Fields{ "uuid": id, - }).Info("storable has been deleted") + }).Debug("storable was deleted") return nil } @@ -92,7 +92,7 @@ func (s sbiStore) get(id uuid.UUID) (SouthboundInterface, error) { } log.WithFields(log.Fields{ "uuid": id, - }).Info("southbound interface was accessed") + }).Debug("southbound interface was accessed") return sbi, nil } @@ -114,7 +114,7 @@ func (s pndStore) get(id uuid.UUID) (PrincipalNetworkDomain, error) { } log.WithFields(log.Fields{ "uuid": id, - }).Info("principal network domain was accessed") + }).Debug("principal network domain was accessed") return pnd, nil } @@ -136,6 +136,6 @@ func (s deviceStore) get(id uuid.UUID) (*Device, error) { } log.WithFields(log.Fields{ "uuid": id, - }).Info("device was accessed") + }).Debug("device was accessed") return device, nil }