diff options
author | Victor Morales <victor.morales@intel.com> | 2019-01-24 17:46:43 -0800 |
---|---|---|
committer | Victor Morales <victor.morales@intel.com> | 2019-01-25 16:52:38 -0800 |
commit | 083465d10c8fdeaffa89aa7daa93def3eca77df1 (patch) | |
tree | 23135a724a1628e986f9c6748b82f275763cdf10 /src/k8splugin/plugins/network/plugin_test.go | |
parent | 5c4e91705457dc4bdb5526e6f5210fa879ab659d (diff) |
Use a standard Go project layout
This project wasn't following some Standard Go Project Layout
guidelines(https://github.com/golang-standards/project-layout). This
change pretends to organize the source code and following those
guidelines.
Change-Id: I61085ac20f28069cede013f83034bed06892d87c
Signed-off-by: Victor Morales <victor.morales@intel.com>
Issue-ID: MULTICLOUD-301
Diffstat (limited to 'src/k8splugin/plugins/network/plugin_test.go')
-rw-r--r-- | src/k8splugin/plugins/network/plugin_test.go | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/k8splugin/plugins/network/plugin_test.go b/src/k8splugin/plugins/network/plugin_test.go index 325de31f..02391177 100644 --- a/src/k8splugin/plugins/network/plugin_test.go +++ b/src/k8splugin/plugins/network/plugin_test.go @@ -16,13 +16,14 @@ limitations under the License. package main import ( - pkgerrors "github.com/pkg/errors" - "k8splugin/krd" + utils "k8splugin/internal" "os" "plugin" "reflect" "strings" "testing" + + pkgerrors "github.com/pkg/errors" ) func LoadMockNetworkPlugins(krdLoadedPlugins *map[string]*plugin.Plugin, networkName, errMsg string) error { @@ -53,15 +54,15 @@ func LoadMockNetworkPlugins(krdLoadedPlugins *map[string]*plugin.Plugin, network func TestCreateNetwork(t *testing.T) { internalVNFID := "1" - oldkrdPluginData := krd.LoadedPlugins + oldkrdPluginData := utils.LoadedPlugins defer func() { - krd.LoadedPlugins = oldkrdPluginData + utils.LoadedPlugins = oldkrdPluginData }() testCases := []struct { label string - input *krd.ResourceData + input *utils.ResourceData mockError string mockOutput string expectedResult string @@ -69,14 +70,14 @@ func TestCreateNetwork(t *testing.T) { }{ { label: "Fail to decode a network object", - input: &krd.ResourceData{ + input: &utils.ResourceData{ YamlFilePath: "../../mock_files/mock_yamls/service.yaml", }, expectedError: "Fail to decode network's configuration: Invalid configuration value", }, { label: "Fail to create a network", - input: &krd.ResourceData{ + input: &utils.ResourceData{ YamlFilePath: "../../mock_files/mock_yamls/ovn4nfvk8s.yaml", }, mockError: "Internal error", @@ -84,7 +85,7 @@ func TestCreateNetwork(t *testing.T) { }, { label: "Successfully create a ovn4nfv network", - input: &krd.ResourceData{ + input: &utils.ResourceData{ VnfId: internalVNFID, YamlFilePath: "../../mock_files/mock_yamls/ovn4nfvk8s.yaml", }, @@ -95,7 +96,7 @@ func TestCreateNetwork(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.label, func(t *testing.T) { - err := LoadMockNetworkPlugins(&krd.LoadedPlugins, testCase.mockOutput, testCase.mockError) + err := LoadMockNetworkPlugins(&utils.LoadedPlugins, testCase.mockOutput, testCase.mockError) if err != nil { t.Fatalf("TestCreateNetwork returned an error (%s)", err) } @@ -121,10 +122,10 @@ func TestCreateNetwork(t *testing.T) { } func TestDeleteNetwork(t *testing.T) { - oldkrdPluginData := krd.LoadedPlugins + oldkrdPluginData := utils.LoadedPlugins defer func() { - krd.LoadedPlugins = oldkrdPluginData + utils.LoadedPlugins = oldkrdPluginData }() testCases := []struct { @@ -154,7 +155,7 @@ func TestDeleteNetwork(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.label, func(t *testing.T) { - err := LoadMockNetworkPlugins(&krd.LoadedPlugins, testCase.mockOutput, testCase.mockError) + err := LoadMockNetworkPlugins(&utils.LoadedPlugins, testCase.mockOutput, testCase.mockError) if err != nil { t.Fatalf("TestDeleteNetwork returned an error (%s)", err) } |