github.com/ystia/yorc/v4@v4.3.0/plugin/serve_test.go (about)

     1  // Copyright 2018 Bull S.A.S. Atos Technologies - Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois, France.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package plugin
    16  
    17  import (
    18  	"testing"
    19  
    20  	"github.com/hashicorp/go-plugin"
    21  	"github.com/stretchr/testify/require"
    22  )
    23  
    24  func TestServeDefaultOpts(t *testing.T) {
    25  	t.Parallel()
    26  	client, _ := plugin.TestPluginRPCConn(t, getPlugins(nil), nil)
    27  	defer client.Close()
    28  
    29  	raw, err := client.Dispense(OperationPluginName)
    30  	require.Nil(t, err)
    31  
    32  	opPlugin := raw.(OperationExecutor)
    33  	arts, err := opPlugin.GetSupportedArtifactTypes()
    34  	require.Nil(t, err)
    35  	require.Len(t, arts, 0)
    36  
    37  	raw, err = client.Dispense(DelegatePluginName)
    38  	require.Nil(t, err)
    39  
    40  	delPlugin := raw.(DelegateExecutor)
    41  	types, err := delPlugin.GetSupportedTypes()
    42  	require.Nil(t, err)
    43  	require.Len(t, types, 0)
    44  
    45  	raw, err = client.Dispense(DefinitionsPluginName)
    46  	require.Nil(t, err)
    47  
    48  	defPlugin := raw.(Definitions)
    49  	defs, err := defPlugin.GetDefinitions()
    50  	require.Nil(t, err)
    51  	require.Len(t, defs, 0)
    52  
    53  }