airshipctl/cmd/config/config_test.go
Alan Meadows 16bc0cc81c Properly locate tests within a config_test pkg for pkg/config and cmd/config
This relocates tests that were improperly placed within the config pkg for both
the pkg/config and cmd/config packages. These were causing testutil to be imported
outside of tests causing a cyclic import issue when trying to import the config
pkg within the document pkg.

This patchset moves the tests as well as refactoring several of them where they
were leveraging private attributes which cannot be accessed as an external test
pkg.

Closes: #109
Relates-To: #107

Change-Id: Ib1bf2aff020599ba0b3f5a7fd7fadf737b8c86b8
2020-03-11 16:21:57 -07:00

44 lines
1.0 KiB
Go

/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package config_test
import (
"testing"
cmd "opendev.org/airship/airshipctl/cmd/config"
"opendev.org/airship/airshipctl/testutil"
)
func TestConfig(t *testing.T) {
cmdTests := []*testutil.CmdTest{
{
Name: "config-cmd-with-defaults",
CmdLine: "",
Cmd: cmd.NewConfigCommand(nil),
},
{
Name: "config-cmd-with-help",
CmdLine: "--help",
Cmd: cmd.NewConfigCommand(nil),
},
}
for _, tt := range cmdTests {
testutil.RunTest(t, tt)
}
}