Documentation
¶
Index ¶
- Variables
- func AssertFileContent(t *testing.T, path string, expected []byte)
- func CaptureOutput(t *testing.T, fn func()) (stdout, stderr string)
- func CopyFile(t *testing.T, src, dst string)
- func CreateTempFile(t *testing.T, dir, pattern string, content []byte) string
- func CreateTestFileTree(t *testing.T, baseDir string, files map[string][]byte)
- func CreateTestLabel(displayName string) *openv1alpha1resource.Label
- func RequireEnv(t *testing.T, key string) string
- func SkipIfShort(t *testing.T)
- func TempDir(t *testing.T) string
- func TestContext(t *testing.T) context.Context
- type FileBuilder
- type ProjectBuilder
- type RecordBuilder
- func (b *RecordBuilder) Build() *openv1alpha1resource.Record
- func (b *RecordBuilder) WithDescription(desc string) *RecordBuilder
- func (b *RecordBuilder) WithDevice(deviceName string) *RecordBuilder
- func (b *RecordBuilder) WithLabels(labels []*openv1alpha1resource.Label) *RecordBuilder
- func (b *RecordBuilder) WithName(name string) *RecordBuilder
- func (b *RecordBuilder) WithTitle(title string) *RecordBuilder
Constants ¶
This section is empty.
Variables ¶
var ( TestProjectName = &name.Project{ ProjectID: "test-project", } TestRecordName = &name.Record{ ProjectID: "test-project", RecordID: "test-record", } TestFileName = &name.File{ ProjectID: "test-project", RecordID: "test-record", Filename: "test.txt", } )
Common test names
Functions ¶
func AssertFileContent ¶
AssertFileContent checks that a file contains the expected content.
func CaptureOutput ¶
CaptureOutput captures stdout and stderr for testing command output.
func CreateTempFile ¶
CreateTempFile creates a temporary file with the given content.
func CreateTestFileTree ¶
CreateTestFileTree creates a directory structure with files for testing.
func CreateTestLabel ¶
func CreateTestLabel(displayName string) *openv1alpha1resource.Label
CreateTestLabel creates a test label with the given display name.
func RequireEnv ¶
RequireEnv skips the test if the given environment variable is not set.
func SkipIfShort ¶
SkipIfShort skips the test if running with -short flag.
Types ¶
type FileBuilder ¶
type FileBuilder struct {
// contains filtered or unexported fields
}
FileBuilder helps create test File objects.
func NewFileBuilder ¶
func NewFileBuilder() *FileBuilder
NewFileBuilder creates a new FileBuilder with defaults.
func (*FileBuilder) Build ¶
func (b *FileBuilder) Build() *openv1alpha1resource.File
Build returns the built File.
func (*FileBuilder) WithFilename ¶
func (b *FileBuilder) WithFilename(filename string) *FileBuilder
WithFilename sets the filename.
func (*FileBuilder) WithName ¶
func (b *FileBuilder) WithName(name string) *FileBuilder
WithName sets the file resource name.
func (*FileBuilder) WithSha256 ¶
func (b *FileBuilder) WithSha256(sha256 string) *FileBuilder
WithSha256 sets the file SHA256.
func (*FileBuilder) WithSize ¶
func (b *FileBuilder) WithSize(size int64) *FileBuilder
WithSize sets the file size.
type ProjectBuilder ¶
type ProjectBuilder struct {
// contains filtered or unexported fields
}
ProjectBuilder helps create test Project objects.
func NewProjectBuilder ¶
func NewProjectBuilder() *ProjectBuilder
NewProjectBuilder creates a new ProjectBuilder with defaults.
func (*ProjectBuilder) Build ¶
func (b *ProjectBuilder) Build() *openv1alpha1resource.Project
Build returns the built Project.
func (*ProjectBuilder) WithDisplayName ¶
func (b *ProjectBuilder) WithDisplayName(displayName string) *ProjectBuilder
WithDisplayName sets the project display name.
func (*ProjectBuilder) WithName ¶
func (b *ProjectBuilder) WithName(name string) *ProjectBuilder
WithName sets the project name.
type RecordBuilder ¶
type RecordBuilder struct {
// contains filtered or unexported fields
}
RecordBuilder helps create test Record objects.
func NewRecordBuilder ¶
func NewRecordBuilder() *RecordBuilder
NewRecordBuilder creates a new RecordBuilder with defaults.
func (*RecordBuilder) Build ¶
func (b *RecordBuilder) Build() *openv1alpha1resource.Record
Build returns the built Record.
func (*RecordBuilder) WithDescription ¶
func (b *RecordBuilder) WithDescription(desc string) *RecordBuilder
WithDescription sets the record description.
func (*RecordBuilder) WithDevice ¶
func (b *RecordBuilder) WithDevice(deviceName string) *RecordBuilder
WithDevice sets the record device.
func (*RecordBuilder) WithLabels ¶
func (b *RecordBuilder) WithLabels(labels []*openv1alpha1resource.Label) *RecordBuilder
WithLabels sets the record labels.
func (*RecordBuilder) WithName ¶
func (b *RecordBuilder) WithName(name string) *RecordBuilder
WithName sets the record name.
func (*RecordBuilder) WithTitle ¶
func (b *RecordBuilder) WithTitle(title string) *RecordBuilder
WithTitle sets the record title.