Documentation ¶
Index ¶
- func CleanUpGitFixtures(t *testing.T)
- func DummyConfig() *config.Config
- func DummyContext() *config.Context
- func DummyContextOptions() *config.ContextOptions
- func DummyManagementConfiguration() *config.ManagementConfiguration
- func DummyManifest() *config.Manifest
- func DummyManifestOptions() *config.ManifestOptions
- func DummyRepoAuth() *config.RepoAuth
- func DummyRepoCheckout() *config.RepoCheckout
- func DummyRepository() *config.Repository
- func InitConfig(t *testing.T) (conf *config.Config, cleanup func(*testing.T))
- func NewTestBundle(t *testing.T, fixtureDir string) document.Bundle
- func RunTest(t *testing.T, test *CmdTest)
- func SetupTestFs(t *testing.T, fixtureDir string) fs.FileSystem
- func TempDir(t *testing.T, prefix string) (path string, cleanup func(*testing.T))
- type CmdTest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanUpGitFixtures ¶
CleanUpGitFixtures removes any temp directories created by the go-git test fixtures
func DummyConfig ¶
DummyConfig used by tests, to initialize min set of data
func DummyContext ¶
DummyContext creates a Context config object for unit testing
func DummyContextOptions ¶
func DummyContextOptions() *config.ContextOptions
DummyContextOptions creates ContextOptions config object for unit testing
func DummyManagementConfiguration ¶
func DummyManagementConfiguration() *config.ManagementConfiguration
DummyManagementConfiguration creates a management configuration for unit testing
func DummyManifest ¶
DummyManifest creates a Manifest config object for unit testing
func DummyManifestOptions ¶
func DummyManifestOptions() *config.ManifestOptions
DummyManifestOptions creates ManifestOptions config object for unit testing
func DummyRepoAuth ¶
DummyRepoAuth creates a RepoAuth config object for unit testing
func DummyRepoCheckout ¶
func DummyRepoCheckout() *config.RepoCheckout
DummyRepoCheckout creates a RepoCheckout config object for unit testing
func DummyRepository ¶
func DummyRepository() *config.Repository
DummyRepository creates a Repository config object for unit testing
func InitConfig ¶
InitConfig creates a Config object meant for testing.
The returned config object will be associated with real files stored in a directory in the user's temporary file storage This directory can be cleaned up by calling the returned "cleanup" function
func NewTestBundle ¶
NewTestBundle helps to create a new bundle with FakeFs containing documents from fixtureDir
func RunTest ¶
RunTest either asserts that a specific command's output matches the expected output from its golden file, or generates golden files if the -update flag is passed
func SetupTestFs ¶
func SetupTestFs(t *testing.T, fixtureDir string) fs.FileSystem
SetupTestFs help manufacture a fake file system for testing purposes. It will iterate over the files in fixtureDir, which is a directory relative to the tests themselves, and will write each of those files (preserving names) to an in-memory file system and return that fs
Types ¶
type CmdTest ¶
type CmdTest struct { // The name of the test. This will be used when generating golden // files Name string // The values that would be inputted to airshipctl as commands, flags, // and arguments. The initial "airshipctl" is implied CmdLine string // The instantiated version of the root airshipctl command to test Cmd *cobra.Command // The expected error Error error }
CmdTest is a command to be run on the command line as a test