utils

package
v0.0.0-...-8972199 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSSHClient

func GetSSHClient(host string, port string, config *ssh.ClientConfig) (*ssh.Client, error)

GetSSHClient - utility function to get an ssh client from the host, port, and clientconfig passed into the function

func Parse

func Parse(filepath string, out interface{}) (interface{}, error)

Parse - Function used to parse the HCL according to the type passed in

Types

type Host

type Host struct {
	IP   string `hcl:"ip"`
	Port string `hcl:"port,optional"`
	User string `hcl:"user,optional"`
}

Host - struct to hold host information

func NewHost

func NewHost(ip string, port string) Host

NewHost - Function to create a new host object

type HostHCLUtil

type HostHCLUtil struct {
	Hosts []Host `hcl:"host,block"`
}

HostHCLUtil - struct to hold host info read from a hosts HCL file

type RunBlock

type RunBlock struct {
	Cmd []*resources.Command `hcl:"command,block"`
	Os  *resources.OS        `hcl:"os,block"`
}

RunBlock is a struct to hold the data of a run block of a test

type Test

type Test struct {
	Title string               `hcl:"title,attr"`
	Cmds  []*resources.Command `hcl:"command,block"`
	Os    *resources.OS        `hcl:"os,block"`
}

Test - struct to hold test information

type UnitTestHCLUtil

type UnitTestHCLUtil struct {
	UnitTests []UnitTestUtil `hcl:"unittest,block"`
}

UnitTestHCLUtil - Structure to hold info about unit tests

type UnitTestUtil

type UnitTestUtil struct {
	Name          string   `hcl:"name,label"`
	Image         string   `hcl:"image"`
	Port          string   `hcl:"port"`
	ContainerName string   `hcl:"containerName"`
	Run           RunBlock `hcl:"run,block"`
	ContainerID   string
}

UnitTestUtil is a struct to hold our test data.

func NewUnitTestUtil

func NewUnitTestUtil(name string, image string, port string, containerName string) *UnitTestUtil

NewUnitTestUtil Returns a new UnitTestUtil

func (*UnitTestUtil) GetImage

func (test *UnitTestUtil) GetImage() error

GetImage will get the specified image for the test

func (*UnitTestUtil) RemoveContainer

func (test *UnitTestUtil) RemoveContainer() error

RemoveContainer - Function to remove a Docker Container

func (*UnitTestUtil) RemoveImage

func (test *UnitTestUtil) RemoveImage() error

RemoveImage - Function to remove a Docker Image from the system

func (*UnitTestUtil) RunImage

func (test *UnitTestUtil) RunImage() error

RunImage runs the pulled test image in a container

func (*UnitTestUtil) SSHDRunning

func (test *UnitTestUtil) SSHDRunning() (bool, error)

SSHDRunning - Function to check if the container has the SSHD service running

func (*UnitTestUtil) StopContainer

func (test *UnitTestUtil) StopContainer() error

StopContainer - Function to stop a test container

Jump to

Keyboard shortcuts

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