From 7a0d5ff1c3b1569dc8f7483954fa5a5a0e0835b8 Mon Sep 17 00:00:00 2001 From: Raziel Cohen Date: Mon, 1 May 2023 17:11:08 +0300 Subject: [PATCH] add unitest - add to former commit Signed-off-by: Raziel Cohen --- pkg/conthandler/container_main_handler_test.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/conthandler/container_main_handler_test.go b/pkg/conthandler/container_main_handler_test.go index e9ce164c..f1573830 100644 --- a/pkg/conthandler/container_main_handler_test.go +++ b/pkg/conthandler/container_main_handler_test.go @@ -4,7 +4,6 @@ import ( "path" "sniffer/pkg/config" configV1 "sniffer/pkg/config/v1" - conthadlerV1 "sniffer/pkg/conthandler/v1" conthandlerV1 "sniffer/pkg/conthandler/v1" accumulator "sniffer/pkg/event_data_storage" "sniffer/pkg/sbom" @@ -55,12 +54,12 @@ func TestContMainHandler(t *testing.T) { RedisInstanceID.SetKind("deployment") RedisInstanceID.SetName("redis") RedisInstanceID.SetContainerName("redis") - contHandler.containersEventChan <- *conthadlerV1.CreateNewContainerEvent(RedisImageID, RedisContainerIDContHandler, RedisPodName, RedisWLID, &RedisInstanceID, conthadlerV1.ContainerRunning) + contHandler.containersEventChan <- *conthandlerV1.CreateNewContainerEvent(RedisImageID, RedisContainerIDContHandler, RedisPodName, RedisWLID, &RedisInstanceID, conthandlerV1.ContainerRunning) }() event := <-contHandler.containersEventChan - if event.GetContainerEventType() != conthadlerV1.ContainerRunning { - t.Fatalf("event container type is wrong, get: %s expected: %s", event.GetContainerEventType(), conthadlerV1.ContainerRunning) + if event.GetContainerEventType() != conthandlerV1.ContainerRunning { + t.Fatalf("event container type is wrong, get: %s expected: %s", event.GetContainerEventType(), conthandlerV1.ContainerRunning) } if event.GetContainerID() != RedisContainerIDContHandler { t.Fatalf("container ID is wrong, get: %s expected: %s", event.GetContainerID(), RedisContainerIDContHandler) @@ -105,7 +104,7 @@ func TestContMainHandlerStopMonitorAfterXMinutes(t *testing.T) { RedisInstanceID.SetKind("deployment") RedisInstanceID.SetName("redis") RedisInstanceID.SetContainerName("redis") - contEvent := conthandlerV1.CreateNewContainerEvent(RedisImageID, RedisContainerIDContHandler, RedisWLID, RedisPodName, &RedisInstanceID, conthadlerV1.ContainerRunning) + contEvent := conthandlerV1.CreateNewContainerEvent(RedisImageID, RedisContainerIDContHandler, RedisWLID, RedisPodName, &RedisInstanceID, conthandlerV1.ContainerRunning) newWatchedContainer := watchedContainerData{ containerAggregator: CreateAggregator(getShortContainerID(contEvent.GetContainerID())),