From 7aaa47e142845612a91c766c15e9f2dbbd26ef1f Mon Sep 17 00:00:00 2001 From: saji Date: Fri, 1 Mar 2024 16:33:30 -0600 Subject: [PATCH] fix missing error check, improve get test --- internal/db/db_test.go | 4 +++- internal/db/getters.go | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/db/db_test.go b/internal/db/db_test.go index 031f90f..6e018ec 100644 --- a/internal/db/db_test.go +++ b/internal/db/db_test.go @@ -144,7 +144,9 @@ func TestTelemDb(t *testing.T) { if err != nil { t.Fatalf("error getting packets: %v", err) } - t.Log(pkt) + if len(pkt) != 1 { + t.Fatalf("expected exactly one response, got %d", len(pkt)) + } }) t.Run("test read-write packet", func(t *testing.T) { diff --git a/internal/db/getters.go b/internal/db/getters.go index 8392554..fc10e37 100644 --- a/internal/db/getters.go +++ b/internal/db/getters.go @@ -93,6 +93,9 @@ func (tdb *TelemDb) GetPackets(ctx context.Context, filter BusEventFilter, optio Name: ev.Name, } BusEv.Data, err = skylab.FromJson(ev.Name, ev.Data) + if err != nil { + return events, nil + } events = append(events, BusEv) }