testreporters

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: MIT Imports: 10 Imported by: 5

Documentation

Overview

Package testreporters holds all the tools necessary to report on tests that are run utilizing the testsetups package

Index

Constants

View Source
const (
	// DefaultArtifactsDir default artifacts dir
	DefaultArtifactsDir string = "logs"
)

Variables

View Source
var (
	SlackAPIKey  = os.Getenv("SLACK_API")
	SlackChannel = os.Getenv("SLACK_CHANNEL")
	SlackUserID  = os.Getenv("SLACK_USER_ID")
)

Values for reporters to use slack to notify user of test end

Functions

func CommonSlackNotificationBlocks added in v1.4.10

func CommonSlackNotificationBlocks(slackClient *slack.Client, headerText, namespace, reportCsvLocation, slackUserId string, testFailed bool) []slack.Block

func MkdirIfNotExists added in v1.4.10

func MkdirIfNotExists(dirName string) error

creates a directory if it doesn't already exist

func SendReport added in v1.4.10

func SendReport(env *environment.Environment, logsPath string, optionalTestReporter TestReporter) error

if provided, writes a test report and sends a Slack notification

func SendSlackMessage added in v1.4.10

func SendSlackMessage(slackClient *slack.Client, msgOptions ...slack.MsgOption) (string, error)

Sends a slack message, and returns an error and the message timestamp

func UpdateSlackEnvVars

func UpdateSlackEnvVars()

UpdateSlackEnvVars updates the slack environment variables in case they are changed while remote test is running. Usually used for unit tests.

func UploadSlackFile added in v1.4.10

func UploadSlackFile(slackClient *slack.Client, uploadParams slack.FileUploadParameters) error

Uploads a slack file to the designated channel using the API key

func WriteTeardownLogs added in v1.4.10

func WriteTeardownLogs(env *environment.Environment, optionalTestReporter TestReporter) error

attempts to download the logs of all ephemeral test deployments onto the test runner, also writing a test report if one is provided

Types

type TestReporter

type TestReporter interface {
	WriteReport(folderLocation string) error
	SendSlackNotification(slackClient *slack.Client) error
	SetNamespace(namespace string)
}

TestReporter is a general interface for all test reporters

Jump to

Keyboard shortcuts

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