cmdtest

package
v0.0.0-...-5cc4bf4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Copyright © 2019 IBM Corporation and others.

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.

Index

Constants

View Source
const CLEANUP = true

Variables

This section is empty.

Functions

func AddLocalRepo

func AddLocalRepo(t *TestSandbox, repoName string, repoFilePath string) (string, error)

AddLocalRepo calls the `appsody repo add` command with the repo index located at the local file path. The path may be relative to the current working directory. Returns the URL of the repo added.

func Exists

func Exists(path string) (bool, error)

Checks whether an inode (it does not bother about file or folder) exists or not.

func GetTempProjectDir

func GetTempProjectDir(t *testing.T) string

func ParseJSON

func ParseJSON(repoListString string) string

ParseJSON finds the json on the output string

func ParseListJSON

func ParseListJSON(jsonString string) (cmd.IndexOutputFormat, error)

ParseListJSON takes the json from 'appsody list -o json' and returns an array of IndexOutputFormat from the string.

func ParseListYAML

func ParseListYAML(yamlString string) (cmd.IndexOutputFormat, error)

ParseListYAML takes the yaml from 'appsody list -o yaml' and returns an array of IndexOutputFormat from the string.

func ParseRepoListJSON

func ParseRepoListJSON(jsonString string) (cmd.RepositoryFile, error)

ParseRepoListJSON takes the json from 'appsody repo list -o json' and returns a RepositoryFile from the string.

func ParseRepoListYAML

func ParseRepoListYAML(yamlString string) (cmd.RepositoryFile, error)

ParseRepoListYAML takes the yaml from 'appsody repo list -o yaml' and returns a RepositoryFile from the string.

func ParseYAML

func ParseYAML(output string) string

ParseYAML finds the start of the yaml string

func RunAppsody

func RunAppsody(t *TestSandbox, args ...string) (string, error)

RunAppsody runs the appsody CLI with the given args, using the sandbox for the project dir and config home. The stdout and stderr are captured, printed and returned args will be passed to the appsody command

func RunAppsodyCmd

func RunAppsodyCmd(args []string, projectDir string, t *testing.T) (string, error)

RunAppsodyCmd runs the appsody CLI with the given args, in a custom home directory named after the currently executing test. The stdout and stderr are captured, printed and returned args will be passed to the appsody command projectDir will be the directory the command acts upon

func RunDockerCmdExec

func RunDockerCmdExec(args []string, t *testing.T) (string, error)

RunDockerCmdExec runs the docker command with the given args in a new process The stdout and stderr are captured, printed, and returned args will be passed to the docker command workingDir will be the directory the command runs in

func TestSetup

func TestSetup(t *testing.T, parallel bool)

Types

type Repository

type Repository struct {
	Name string
	URL  string
}

Repository struct represents an appsody repository

func ParseRepoList

func ParseRepoList(repoListString string) []Repository

ParseRepoList takes in the string from 'appsody repo list' command and returns an array of Repository structs from the string.

type TestSandbox

type TestSandbox struct {
	*testing.T
	ProjectDir  string
	ProjectName string
	ConfigDir   string
	ConfigFile  string
	Verbose     bool
}

func TestSetupWithSandbox

func TestSetupWithSandbox(t *testing.T, parallel bool) (*TestSandbox, func())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL