From 81a2f49e4288ddc11fc42ccbcbc9656f926b0ba5 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 11 Jul 2024 15:11:45 +0200 Subject: [PATCH] Added integration test --- internal/integrationtest/daemon/daemon_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/internal/integrationtest/daemon/daemon_test.go b/internal/integrationtest/daemon/daemon_test.go index 366fec20497..742e7774316 100644 --- a/internal/integrationtest/daemon/daemon_test.go +++ b/internal/integrationtest/daemon/daemon_test.go @@ -91,6 +91,24 @@ func TestArduinoCliDaemon(t *testing.T) { testWatcher() testWatcher() + + { + // Test that the watcher stays open until the grpc call is canceled + + ctx, cancel := context.WithTimeout(context.Background(), time.Second*2) + defer cancel() + + start := time.Now() + watcher, err := grpcInst.BoardListWatch(ctx) + require.NoError(t, err) + for { + _, err := watcher.Recv() + if err != nil { + break + } + } + require.Greater(t, time.Since(start), 2*time.Second) + } } func TestDaemonAutoUpdateIndexOnFirstInit(t *testing.T) {