test

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertEqualDirectories

func AssertEqualDirectories(t *testing.T, dir1, dir2 string)

AssertEqualDirectories recursively compares two directories

func AssertEqualFiles

func AssertEqualFiles(t *testing.T, file1, file2 string)

AssertEqualFiles checks if two files are identical by comparing their SHA-256 hashes

func ReadFile

func ReadFile(t *testing.T, path string) string

Types

type HelperSuite

type HelperSuite struct {
	suite.Suite
	// Fields that are initialized once in the constructor
	Bucket         string
	Region         string
	Endpoint       string
	BasePrefix     string
	ClientProvider *s3helper.ClientProvider
	Publisher      *s3publisher.Publisher
	Storage        *s3storage.StorageProvider

	// Fields that are initialized in SetupSuite for every test
	Prefix      string
	JobID       string
	ExecutionID string
	RunID       string
	TempDir     string
	Ctx         context.Context
}

func NewTestHelper

func NewTestHelper(t *testing.T, params HelperSuiteParams) *HelperSuite

func (*HelperSuite) DeleteObjects

func (s *HelperSuite) DeleteObjects(prefix string)

func (*HelperSuite) Destroy

func (s *HelperSuite) Destroy()

func (*HelperSuite) GetClient

func (s *HelperSuite) GetClient() *s3helper.ClientWrapper

GetClient returns a client for the bucket's region and endpoint.

func (*HelperSuite) GetResult

func (s *HelperSuite) GetResult(published *models.SpecConfig) string

GetResult fetches the result from S3 and returns the local path.

func (*HelperSuite) HasValidCredentials

func (s *HelperSuite) HasValidCredentials() bool

HasValidCredentials returns true if the S3 client is installed.

func (*HelperSuite) PrepareAndPublish

func (s *HelperSuite) PrepareAndPublish(compressed bool) (models.SpecConfig, string)

PrepareAndPublish publishes the resultPath to S3 and returns the published key.

func (*HelperSuite) PreparePublisherSpec

func (s *HelperSuite) PreparePublisherSpec(compressed bool) s3helper.PublisherSpec

PreparePublisherSpec returns a publisher spec with the bucket, prefix, and endpoint.

func (*HelperSuite) PrepareResultsPath

func (s *HelperSuite) PrepareResultsPath() string

PrepareResultsPath creates local directories and files that mimic a result directory structure.

func (*HelperSuite) PublishResult

func (s *HelperSuite) PublishResult(publisherConfig s3helper.PublisherSpec, resultPath string) (models.SpecConfig, error)

PublishResult publishes the resultPath to S3 and returns the published key.

func (*HelperSuite) PublishResultSilently

func (s *HelperSuite) PublishResultSilently(publisherConfig s3helper.PublisherSpec, resultPath string) models.SpecConfig

PublishResultSilently publishes the resultPath to S3 and skip if no access.

func (*HelperSuite) SetupSuite

func (s *HelperSuite) SetupSuite()

SetupSuite creates a unique prefix for the test suite to avoid collisions.

type HelperSuiteParams

type HelperSuiteParams struct {
	Bucket     string
	Region     string
	Endpoint   string
	BasePrefix string
}

Jump to

Keyboard shortcuts

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