Documentation
¶
Overview ¶
package test temporarily contains all commonly used, generic utils for testing.
Index ¶
- Constants
- Variables
- func NewHTTPClientWithRetry() *resty.Client
- func NewHTTPClientWithoutRetry() *resty.Client
- func SetSeverity(t *testing.T, s Severity)
- func SetupConfig(filename string, opts ...CfgOption) error
- func SetupConfigWithFixture[T any](configPath string, custom *T) error
- func SkipTestIfInSkipList(t *testing.T, testName string)
- type CfgOption
- type RespBody
- type Severity
- type TestConfig
Constants ¶
const ( LOCAL environment = "local" STG environment = "staging" PROD environment = "production" )
const (
SEVERITY_LOG_PREFIX = "Severity#"
)
Variables ¶
var TestCfg = TestConfig{}
Functions ¶
func NewHTTPClientWithRetry ¶
func NewHTTPClientWithRetry() *resty.Client
NewHTTPClientWithRetry returns a http client with retry mechanism
func NewHTTPClientWithoutRetry ¶
func NewHTTPClientWithoutRetry() *resty.Client
NewHTTPClientWithoutRetry returns a http client without retry mechanism
func SetSeverity ¶
SetSeverity sets the severity of a test.
func SetupConfig ¶
SetupConfig initializes the configuration and accepts optional configuration functions. please ensure that config file contains `test` section.
func SetupConfigWithFixture ¶
SetupConfigWithFixture initializes the configuration and custom fixture. It finally overwrites a given fixture as argument with an initialized one which should have some values you set beforehand. please ensure that config file contains `test` section and `fixture` section there.
func SkipTestIfInSkipList ¶
Types ¶
type CfgOption ¶
type CfgOption func(*TestConfig)
func WithFixture ¶
WithFixture is an option function to set the Fixture
type RespBody ¶
type RespBody struct { ErrorCode string `json:"errorCode,omitempty"` Data map[string]interface{} `json:"data,omitempty"` }
RespBody is a common response body.