github.com/kyma-project/kyma-environment-broker@v0.0.1/internal/process/provisioning/create_runtime_for_own_cluster_step_test.go (about) 1 package provisioning 2 3 import ( 4 "testing" 5 6 "github.com/kyma-project/kyma-environment-broker/internal/broker" 7 "github.com/kyma-project/kyma-environment-broker/internal/storage" 8 "github.com/sirupsen/logrus" 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func TestCreateRuntimeForOwnCluster_Run(t *testing.T) { 13 // given 14 log := logrus.New() 15 memoryStorage := storage.NewMemoryStorage() 16 17 operation := fixOperationCreateRuntime(t, broker.OwnClusterPlanID, "europe-west3") 18 operation.ShootDomain = "kyma.org" 19 err := memoryStorage.Operations().InsertOperation(operation) 20 assert.NoError(t, err) 21 22 err = memoryStorage.Instances().Insert(fixInstance()) 23 assert.NoError(t, err) 24 25 step := NewCreateRuntimeForOwnClusterStep(memoryStorage.Operations(), memoryStorage.Instances()) 26 27 // when 28 entry := log.WithFields(logrus.Fields{"step": "TEST"}) 29 operation, _, err = step.Run(operation, entry) 30 31 // then 32 33 storedInstance, err := memoryStorage.Instances().GetByID(operation.InstanceID) 34 assert.NoError(t, err) 35 assert.NotEmpty(t, storedInstance.RuntimeID) 36 37 storedOperation, err := memoryStorage.Operations().GetOperationByID(operationID) 38 assert.NoError(t, err) 39 assert.Empty(t, storedOperation.ProvisionerOperationID) 40 assert.Equal(t, storedInstance.RuntimeID, storedOperation.RuntimeID) 41 }