Documentation
¶
Overview ¶
Copyright 2023- IBM Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
Index ¶
- Variables
- func CheckActualVsExpectedOutputMatch(t *testing.T, ...)
- func CheckErrorContainment(t *testing.T, testInfo, expectedErrorMsg, actualErrMsg string)
- func ConnlistTestNameByTestArgs(dirName, focusWorkload, format string, exposureFlag bool) (testName, expectedOutputFileName string)
- func DiffTestNameByTestArgs(ref1, ref2, format string) (testName, expectedOutputFileName string)
- func GenerateTempDirWithPods(origDir, srcName, srcNs, dstName, dstNs string) error
- func GetTestDirPath(dirName string) string
- func WarnOnErrorReadingFile(err error, file string)
- type PodInfo
- type TestLogger
- func (tl *TestLogger) Debugf(format string, o ...interface{})
- func (tl *TestLogger) Errorf(err error, format string, o ...interface{})
- func (tl *TestLogger) GetLoggerMessages() string
- func (tl *TestLogger) Infof(format string, o ...interface{})
- func (tl *TestLogger) Warnf(format string, o ...interface{})
- type WorkloadMetadata
Constants ¶
This section is empty.
Variables ¶
var TmpDir = filepath.Join(projectpath.Root, "temp") // cleaned up after the test is done
Functions ¶
func CheckActualVsExpectedOutputMatch ¶
func CheckActualVsExpectedOutputMatch(t *testing.T, expectedOutputFileName, actualOutput, testInfo, testingPkg string)
CheckActualVsExpectedOutputMatch: testing helping func - checks if actual output matches expected output, if not generates actual output file if --update flag is on, writes the actual output to the expected output file
func CheckErrorContainment ¶
CheckErrorContainment: helping func - if the actual error/warning message does not contain the expected error, fail the test with relevant info
func ConnlistTestNameByTestArgs ¶
func ConnlistTestNameByTestArgs(dirName, focusWorkload, format string, exposureFlag bool) (testName, expectedOutputFileName string)
ConnlistTestNameByTestArgs returns connlist test name and test's expected output file from some tests args
func DiffTestNameByTestArgs ¶
DiffTestNameByTestArgs returns diff test name and test's expected output file from some tests args
func GenerateTempDirWithPods ¶ added in v1.3.0
GenerateTempDirWithPods generates new temporary dir that copies origDir and adds yaml files of Pod kind matching the input workload resources of the src and dst the function returns the path of the generated temp dir.
func GetTestDirPath ¶
helping func - returns test's dir path from test's dir name
func WarnOnErrorReadingFile ¶
Types ¶
type PodInfo ¶ added in v1.3.0
type PodInfo struct { Name string `yaml:"name"` Namespace string `yaml:"namespace,omitempty"` Labels map[string]string `yaml:"labels,omitempty"` }
PodInfo contains metadata of the pod so we can : 1. extract relevant workload from input resources 2. generate relevant pod template
type TestLogger ¶ added in v1.3.0
type TestLogger struct {
// contains filtered or unexported fields
}
implements logger.Logger (to be used with connlist-analyzer)
func NewTestLogger ¶ added in v1.3.0
func NewTestLogger() *TestLogger
NewTestLogger returns a new TestLogger that writes to a buffer for testing
func (*TestLogger) Debugf ¶ added in v1.3.0
func (tl *TestLogger) Debugf(format string, o ...interface{})
Debugf writes a debug message to the log
func (*TestLogger) Errorf ¶ added in v1.3.0
func (tl *TestLogger) Errorf(err error, format string, o ...interface{})
Errorf writes an error message to the log
func (*TestLogger) GetLoggerMessages ¶ added in v1.3.0
func (tl *TestLogger) GetLoggerMessages() string
GetLoggerMessages returns logged messages as a string
func (*TestLogger) Infof ¶ added in v1.3.0
func (tl *TestLogger) Infof(format string, o ...interface{})
Infof writes an informative message to the log
func (*TestLogger) Warnf ¶ added in v1.3.0
func (tl *TestLogger) Warnf(format string, o ...interface{})
Warnf writes a warning message to the log
type WorkloadMetadata ¶ added in v1.3.0
type WorkloadMetadata struct {
Metadata PodInfo `yaml:"metadata"`
}
workloadMetadata the yaml is unmarshal to workload metadata struct which is the only interesting part for our goals