github.com/argoproj/argo-events@v1.9.1/controllers/eventbus/installer/exotic_nats_test.go (about) 1 package installer 2 3 import ( 4 "context" 5 "testing" 6 7 "github.com/stretchr/testify/assert" 8 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 9 10 "github.com/argoproj/argo-events/common/logging" 11 "github.com/argoproj/argo-events/pkg/apis/eventbus/v1alpha1" 12 ) 13 14 const ( 15 testExoticName = "test-bus" 16 testExoticURL = "nats://xxxxxx" 17 ) 18 19 var ( 20 testNatsExoticBus = &v1alpha1.EventBus{ 21 TypeMeta: metav1.TypeMeta{ 22 APIVersion: v1alpha1.SchemeGroupVersion.String(), 23 Kind: "EventBus", 24 }, 25 ObjectMeta: metav1.ObjectMeta{ 26 Namespace: testNamespace, 27 Name: testExoticName, 28 }, 29 Spec: v1alpha1.EventBusSpec{ 30 NATS: &v1alpha1.NATSBus{ 31 Exotic: &v1alpha1.NATSConfig{ 32 URL: testExoticURL, 33 }, 34 }, 35 }, 36 } 37 ) 38 39 func TestInstallationExotic(t *testing.T) { 40 t.Run("installation with exotic nats config", func(t *testing.T) { 41 installer := NewExoticNATSInstaller(testNatsExoticBus, logging.NewArgoEventsLogger()) 42 conf, err := installer.Install(context.TODO()) 43 assert.NoError(t, err) 44 assert.NotNil(t, conf.NATS) 45 assert.Equal(t, conf.NATS.URL, testExoticURL) 46 }) 47 } 48 49 func TestUninstallationExotic(t *testing.T) { 50 t.Run("uninstallation with exotic nats config", func(t *testing.T) { 51 installer := NewExoticNATSInstaller(testNatsExoticBus, logging.NewArgoEventsLogger()) 52 err := installer.Uninstall(context.TODO()) 53 assert.NoError(t, err) 54 }) 55 }