cmdtest

package
v0.0.0-...-58f43b1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: Apache-2.0 Imports: 14 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
View Source
const TravisTesting = false

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 GetEnvStacksList

func GetEnvStacksList() 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 RunCmdExec

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

RunCmdExec runs the command (Docker or Buildah) 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)

func ZAndPDevLocal

func ZAndPDevLocal(t *testing.T, sandbox *TestSandbox)

ZandPDevLocal - Adds dev.local repo to the config repo.yaml

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
	TestDataPath string
	ProjectName  string
	ConfigDir    string
	ConfigFile   string
	Verbose      bool
}

func TestSetupWithSandbox

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

func (*TestSandbox) SetConfigInTestData

func (s *TestSandbox) SetConfigInTestData(pathUnderTestdata string)

Jump to

Keyboard shortcuts

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