testreporters

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 17 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(config.EnvVarSlackKey)
	SlackChannel = os.Getenv(config.EnvVarSlackChannel)
	SlackUserID  = os.Getenv(config.EnvVarSlackUser)
)

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

Functions

func CommonSlackNotificationBlocks added in v1.4.10

func CommonSlackNotificationBlocks(
	headerText, namespace,
	reportCsvLocation string,
) []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(t *testing.T, env *environment.Environment, logsPath string, optionalTestReporter TestReporter) error

SendReport writes a test report and sends a Slack notification if the test provides one

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 SlackNotifyBlocks added in v1.7.2

func SlackNotifyBlocks(headerText, namespace string, msgtext []string) []slack.Block

SlackNotifyBlocks creates a slack payload and writes into the specified json

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(
	t *testing.T,
	env *environment.Environment,
	optionalTestReporter TestReporter,
	failingLogLevel zapcore.Level,
) error

WriteTeardownLogs attempts to download the logs of all ephemeral test deployments onto the test runner, also writing a test report if one is provided. A failing log level also enables you to fail a test based on what level logs the Chainlink nodes have thrown during their test.

Types

type TestReporter

type TestReporter interface {
	WriteReport(folderLocation string) error
	SendSlackNotification(t *testing.T, 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