github.com/kyma-project/kyma-environment-broker@v0.0.1/internal/runtime/custom_disabler_example_test.go (about)

     1  package runtime_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/kyma-project/control-plane/components/provisioner/pkg/gqlschema"
     7  	"github.com/kyma-project/kyma-environment-broker/internal"
     8  	"github.com/kyma-project/kyma-environment-broker/internal/runtime"
     9  	"github.com/stretchr/testify/assert"
    10  )
    11  
    12  func TestCustomDisablerExample(t *testing.T) {
    13  	// given
    14  	sut := runtime.NewCustomDisablerExample()
    15  
    16  	givenComponents := internal.ComponentConfigurationInputList{
    17  		{
    18  			Component: runtime.CustomDisablerComponentName,
    19  			Namespace: "kyma-system",
    20  		},
    21  	}
    22  	expComponents := internal.ComponentConfigurationInputList{
    23  		{
    24  			Component: runtime.CustomDisablerComponentName,
    25  			Namespace: "kyma-system",
    26  			Configuration: []*gqlschema.ConfigEntryInput{
    27  				{
    28  					Key:   "component-x.enabled",
    29  					Value: "false",
    30  				},
    31  				{
    32  					Key:   "component-x.Output.conf.enabled",
    33  					Value: "false",
    34  				},
    35  			},
    36  		},
    37  	}
    38  
    39  	// when
    40  	modifiedComponents := sut.Disable(givenComponents)
    41  
    42  	// then
    43  	assert.EqualValues(t, expComponents, modifiedComponents)
    44  }