Documentation
¶
Overview ¶
Package testsupport contains test helpers for Snyk
Index ¶
- Constants
- func CreateFileOrFail(t *testing.T, filePath string, content []byte)
- func CreateTempFile(t *testing.T, tempDir string) *os.File
- func GetEnvironmentToken(secretName string) string
- func NotOnWindows(t *testing.T, reason string)
- func OnlyOnWindows(t *testing.T, reason string)
- func PathSafeTestName(t *testing.T) string
- func RequireEventuallyReceive[T any](t *testing.T, ch <-chan T, waitFor, tick time.Duration, msgAndArgs ...any) T
- type JsonRPCRecorder
- func (r *JsonRPCRecorder) Callbacks() []jrpc2.Request
- func (r *JsonRPCRecorder) ClearCallbacks()
- func (r *JsonRPCRecorder) ClearNotifications()
- func (r *JsonRPCRecorder) FindCallbacksByMethod(method string) []jrpc2.Request
- func (r *JsonRPCRecorder) FindNotificationsByMethod(method string) []jrpc2.Request
- func (r *JsonRPCRecorder) Notifications() []jrpc2.Request
- func (r *JsonRPCRecorder) Record(request jrpc2.Request)
Constants ¶
View Source
const ( IntegTestEnvVar = "INTEG_TESTS" SmokeTestEnvVar = "SMOKE_TESTS" NodejsGoof = "https://github.com/snyk-labs/nodejs-goof" PythonGoof = "https://github.com/JennySnyk/Python-goof" CppGoof = "https://github.com/snyk-fixtures/cpp-goof" CGoof = "https://github.com/pilvikala/c-goof" )
Variables ¶
This section is empty.
Functions ¶
func CreateFileOrFail ¶
CreateFileOrFail creates a file in filePath with the specified content, and fails the test if there's error. If the path to the file doesn't exist, CreateFileOrFail will create it. The file does not get cleaned up, and it is the caller's responsibility to remove it.
func GetEnvironmentToken ¶
func NotOnWindows ¶
func OnlyOnWindows ¶
func PathSafeTestName ¶
PathSafeTestName returns a file-system-safe version of the test name. Replaces characters that could cause issues with file system paths.
Types ¶
type JsonRPCRecorder ¶
type JsonRPCRecorder struct {
// contains filtered or unexported fields
}
func (*JsonRPCRecorder) Callbacks ¶
func (r *JsonRPCRecorder) Callbacks() []jrpc2.Request
func (*JsonRPCRecorder) ClearCallbacks ¶
func (r *JsonRPCRecorder) ClearCallbacks()
func (*JsonRPCRecorder) ClearNotifications ¶
func (r *JsonRPCRecorder) ClearNotifications()
func (*JsonRPCRecorder) FindCallbacksByMethod ¶
func (r *JsonRPCRecorder) FindCallbacksByMethod(method string) []jrpc2.Request
func (*JsonRPCRecorder) FindNotificationsByMethod ¶
func (r *JsonRPCRecorder) FindNotificationsByMethod(method string) []jrpc2.Request
func (*JsonRPCRecorder) Notifications ¶
func (r *JsonRPCRecorder) Notifications() []jrpc2.Request
func (*JsonRPCRecorder) Record ¶
func (r *JsonRPCRecorder) Record(request jrpc2.Request)
Click to show internal directories.
Click to hide internal directories.