github.com/argoproj/argo-events@v1.9.1/controllers/eventbus/installer/exotic_jetstream_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  var (
    15  	testJSExoticURL = "nats://nats:4222"
    16  
    17  	testJSExoticBus = &v1alpha1.EventBus{
    18  		TypeMeta: metav1.TypeMeta{
    19  			APIVersion: v1alpha1.SchemeGroupVersion.String(),
    20  			Kind:       "EventBus",
    21  		},
    22  		ObjectMeta: metav1.ObjectMeta{
    23  			Namespace: testNamespace,
    24  			Name:      testExoticName,
    25  		},
    26  		Spec: v1alpha1.EventBusSpec{
    27  			JetStreamExotic: &v1alpha1.JetStreamConfig{
    28  				URL: testJSExoticURL,
    29  			},
    30  		},
    31  	}
    32  )
    33  
    34  func TestInstallationJSExotic(t *testing.T) {
    35  	t.Run("installation with exotic jetstream config", func(t *testing.T) {
    36  		installer := NewExoticJetStreamInstaller(testJSExoticBus, logging.NewArgoEventsLogger())
    37  		conf, err := installer.Install(context.TODO())
    38  		assert.NoError(t, err)
    39  		assert.NotNil(t, conf.JetStream)
    40  		assert.Equal(t, conf.JetStream.URL, testJSExoticURL)
    41  	})
    42  }
    43  
    44  func TestUninstallationJSExotic(t *testing.T) {
    45  	t.Run("uninstallation with exotic jetstream config", func(t *testing.T) {
    46  		installer := NewExoticJetStreamInstaller(testJSExoticBus, logging.NewArgoEventsLogger())
    47  		err := installer.Uninstall(context.TODO())
    48  		assert.NoError(t, err)
    49  	})
    50  }