helpers

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckNamespaces added in v0.4.0

func CheckNamespaces(expectedNamespaces []models.Namespace, requestedNamespaces []request.Namespace) bool

CheckNamespaces checks if the requested namespaces are present in the expected namespaces.

func CheckTagExists

func CheckTagExists(tags []models.ExperimentTag, key, value string) bool

CheckTagExists makes check that Tag exists in provided Tag list.

func DecodeArrowMetrics added in v0.5.0

func DecodeArrowMetrics(buf *bytes.Buffer) ([]models.Metric, error)

func ExtractContext added in v0.5.0

func ExtractContext(contextPrefix string, decodedData map[string]any) map[string]any

ExtractContextBytes finds the metric context in the decoded data, using the given key prefix.

func ExtractContextBytes added in v0.5.0

func ExtractContextBytes(contextPrefix string, decodedData map[string]any) ([]byte, error)

ExtractContextBytes finds the metric context in decoded data, using the given key prefix, and marshals to bytes.

func GenerateDatabaseURI added in v0.5.0

func GenerateDatabaseURI(t *testing.T, backend string) (string, error)

func GetDatabaseBackend added in v0.5.0

func GetDatabaseBackend() string

func GetDescriptionFromExperiment added in v0.4.0

func GetDescriptionFromExperiment(experiment models.Experiment) string

GetDescriptionFromexperiment returns the description of a given experiment.

func GetGSEndpointUri added in v0.4.0

func GetGSEndpointUri() string

func GetLogLevel added in v0.5.0

func GetLogLevel() string

func GetPostgresUri added in v0.5.0

func GetPostgresUri() string

func GetS3EndpointUri added in v0.3.0

func GetS3EndpointUri() string

func NewGSClient added in v0.4.0

func NewGSClient(endpoint string) (*storage.Client, error)

NewGSClient creates new instance of Google Storage client.

func NewS3Client added in v0.3.0

func NewS3Client(endpoint string) (*s3.Client, error)

NewS3Client creates new instance of S3 client.

func StrReplace

func StrReplace(str string, original []string, replacement []interface{}) string

StrReplace makes replacing of multiple placeholders by theirs values in a string.

func TransformRunsToActivityMap added in v0.3.0

func TransformRunsToActivityMap(runs []*models.Run) map[string]int

TransformRunsToActivityMap transform a slice of runs into a map of experiments activity to match the GetExperimentsActivity endpoint response.

Types

type BaseTestSuite added in v0.4.0

type BaseTestSuite struct {
	suite.Suite

	AIMClient                   func() *HttpClient
	MlflowClient                func() *HttpClient
	AdminClient                 func() *HttpClient
	AppFixtures                 *fixtures.AppFixtures
	RunFixtures                 *fixtures.RunFixtures
	TagFixtures                 *fixtures.TagFixtures
	MetricFixtures              *fixtures.MetricFixtures
	ContextFixtures             *fixtures.ContextFixtures
	ParamFixtures               *fixtures.ParamFixtures
	ProjectFixtures             *fixtures.ProjectFixtures
	DashboardFixtures           *fixtures.DashboardFixtures
	ExperimentFixtures          *fixtures.ExperimentFixtures
	DefaultExperiment           *models.Experiment
	NamespaceFixtures           *fixtures.NamespaceFixtures
	DefaultNamespace            *models.Namespace
	ResetOnSubTest              bool
	SkipCreateDefaultNamespace  bool
	SkipCreateDefaultExperiment bool
	// contains filtered or unexported fields
}

func (*BaseTestSuite) AddSetupHook added in v0.4.0

func (s *BaseTestSuite) AddSetupHook(hook func())

func (*BaseTestSuite) AddTearDownHook added in v0.4.0

func (s *BaseTestSuite) AddTearDownHook(hook func())

func (*BaseTestSuite) SetupSubTest added in v0.4.0

func (s *BaseTestSuite) SetupSubTest()

func (*BaseTestSuite) SetupSuite added in v0.4.0

func (s *BaseTestSuite) SetupSuite()

func (*BaseTestSuite) SetupTest added in v0.4.0

func (s *BaseTestSuite) SetupTest()

func (*BaseTestSuite) TearDownSubTest added in v0.4.0

func (s *BaseTestSuite) TearDownSubTest()

func (*BaseTestSuite) TearDownSuite added in v0.5.0

func (s *BaseTestSuite) TearDownSuite()

func (*BaseTestSuite) TearDownTest added in v0.4.0

func (s *BaseTestSuite) TearDownTest()

type GSTestSuite added in v0.4.0

type GSTestSuite struct {
	BaseTestSuite
	Client *storage.Client
	// contains filtered or unexported fields
}

func NewGSTestSuite added in v0.4.0

func NewGSTestSuite(testBuckets ...string) GSTestSuite

NewGSTestSuite creates a new instance of GSTestSuite.

func (*GSTestSuite) CreateTestBuckets added in v0.4.0

func (s *GSTestSuite) CreateTestBuckets() error

CreateTestBuckets creates the test buckets.

func (*GSTestSuite) DeleteTestBuckets added in v0.4.0

func (s *GSTestSuite) DeleteTestBuckets() error

DeleteTestBuckets deletes the test buckets.

func (*GSTestSuite) SetupSuite added in v0.4.0

func (s *GSTestSuite) SetupSuite()

type HttpClient

type HttpClient struct {
	// contains filtered or unexported fields
}

HttpClient represents HTTP client.

func NewAdminApiClient added in v0.4.0

func NewAdminApiClient(server server.Server) *HttpClient

NewAdminApiClient creates new HTTP client for the admin api

func NewAimApiClient

func NewAimApiClient(server server.Server) *HttpClient

NewAimApiClient creates new HTTP client for the aim api

func NewClient added in v0.4.0

func NewClient(server server.Server, basePath string) *HttpClient

NewClient creates new preconfigured HTTP client.

func NewMlflowApiClient

func NewMlflowApiClient(server server.Server) *HttpClient

NewMlflowApiClient creates new HTTP client for the mlflow api

func (*HttpClient) DoRequest added in v0.4.0

func (c *HttpClient) DoRequest(uri string, values ...any) error

DoRequest do actual HTTP request based on provided parameters. nolint:gocyclo

func (*HttpClient) GetStatusCode added in v0.4.0

func (c *HttpClient) GetStatusCode() int

GetStatusCode returns HTTP status code of the last response, if available.

func (*HttpClient) WithHeaders added in v0.4.0

func (c *HttpClient) WithHeaders(headers map[string]string) *HttpClient

WithHeaders adds headers to the HTTP request.

func (*HttpClient) WithMethod added in v0.4.0

func (c *HttpClient) WithMethod(method string) *HttpClient

WithMethod sets the HTTP method.

func (*HttpClient) WithNamespace added in v0.4.0

func (c *HttpClient) WithNamespace(namespace string) *HttpClient

WithNamespace sets the namespace path.

func (*HttpClient) WithQuery added in v0.4.0

func (c *HttpClient) WithQuery(params any) *HttpClient

WithQuery adds query parameters to the HTTP request.

func (*HttpClient) WithRequest added in v0.4.0

func (c *HttpClient) WithRequest(request any) *HttpClient

WithRequest sets request object.

func (*HttpClient) WithResponse added in v0.4.0

func (c *HttpClient) WithResponse(response any) *HttpClient

WithResponse sets the response object where HTTP response will be deserialized.

func (*HttpClient) WithResponseType added in v0.4.0

func (c *HttpClient) WithResponseType(responseType ResponseType) *HttpClient

WithResponseType sets the response object type.

type ResponseType added in v0.4.0

type ResponseType string

ResponseType represents HTTP response type.

const (
	ResponseTypeJSON   ResponseType = "json"
	ResponseTypeBuffer ResponseType = "buffer"
	ResponseTypeHTML   ResponseType = "html"
)

Supported list of HTTP response types. TODO:dsuhinin - add another type `stream`. For this type return `io.ReadCloser`.

type S3TestSuite added in v0.4.0

type S3TestSuite struct {
	BaseTestSuite
	Client *s3.Client
	// contains filtered or unexported fields
}

func NewS3TestSuite added in v0.4.0

func NewS3TestSuite(testBuckets ...string) S3TestSuite

NewS3TestSuite creates a new instance of S3TestSuite.

func (*S3TestSuite) CreateTestBuckets added in v0.4.0

func (s *S3TestSuite) CreateTestBuckets() error

CreateTestBuckets creates the test buckets.

func (*S3TestSuite) DeleteTestBuckets added in v0.4.0

func (s *S3TestSuite) DeleteTestBuckets() error

DeleteTestBuckets deletes the test buckets.

func (*S3TestSuite) SetupSuite added in v0.4.0

func (s *S3TestSuite) SetupSuite()

Jump to

Keyboard shortcuts

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