From 45b050edceaee0d2d9fed5355e5976539b7b3bae Mon Sep 17 00:00:00 2001 From: Future Outlier Date: Tue, 1 Aug 2023 13:21:23 +0800 Subject: [PATCH] Add test for NewNotificationsPublisher and NewNotificationsProcessor in factory_test.go Signed-off-by: Future Outlier --- pkg/async/notifications/factory_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkg/async/notifications/factory_test.go b/pkg/async/notifications/factory_test.go index 280f383f2..78e28e44f 100644 --- a/pkg/async/notifications/factory_test.go +++ b/pkg/async/notifications/factory_test.go @@ -3,11 +3,19 @@ package notifications import ( "testing" + "github.com/flyteorg/flyteadmin/pkg/async/notifications/implementations" runtimeInterfaces "github.com/flyteorg/flyteadmin/pkg/runtime/interfaces" "github.com/flyteorg/flytestdlib/promutils" "github.com/stretchr/testify/assert" ) +var ( + scope = promutils.NewScope("test_sandbox_processor") + notificationsConfig = runtimeInterfaces.NotificationsConfig{ + Type: "sandbox", + } +) + func TestGetEmailer(t *testing.T) { defer func() { r := recover(); assert.NotNil(t, r) }() cfg := runtimeInterfaces.NotificationsConfig{ @@ -23,3 +31,13 @@ func TestGetEmailer(t *testing.T) { // shouldn't reach here t.Errorf("did not panic") } + +func TestNewNotificationsProcessor(t *testing.T) { + testSandboxProcessor := NewNotificationsProcessor(notificationsConfig, scope) + assert.IsType(t, testSandboxProcessor, &implementations.SandboxProcessor{}) +} + +func TestNewNotificationPublisher(t *testing.T) { + testSandboxPublisher := NewNotificationsPublisher(notificationsConfig, scope) + assert.IsType(t, testSandboxPublisher, &implementations.SandboxPublisher{}) +}