Documentation ¶
Overview ¶
Package testsuite provides test environment to run E2E and integration tests..
Index ¶
Constants ¶
const ( VerificationTokenDuration = time.Second * 2 APIKeyCacheDuration = time.Second * 2 APISrvPort = "8080" AdminSrvPort = "8081" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
APIClient is a test client for verification API.
func NewAPIClient ¶
NewAPIClient creates an API server test client.
func (*APIClient) GetCertificate ¶
func (c *APIClient) GetCertificate(req api.VerificationCertificateRequest) (*api.VerificationCertificateResponse, error)
GetCertificate wraps the VerificationCertificate API call.
func (*APIClient) GetToken ¶
func (c *APIClient) GetToken(req api.VerifyCodeRequest) (*api.VerifyCodeResponse, error)
GetToken wraps the VerifyCode API call.
type AdminClient ¶
type AdminClient struct {
// contains filtered or unexported fields
}
AdminClient is a test client for admin API.
func NewAdminClient ¶
func NewAdminClient(addr, key string) (*AdminClient, error)
NewAdminClient creates an Admin API test client.
func (*AdminClient) IssueCode ¶
func (c *AdminClient) IssueCode(req api.IssueCodeRequest) (*api.IssueCodeResponse, error)
IssueCode wraps the IssueCode API call.
type E2EConfig ¶ added in v0.17.1
type E2EConfig struct { APIServerURL string `env:"E2E_APISERVER_URL"` AdminAPIURL string `env:"E2E_ADMINAPI_URL"` ProjectID string `env:"E2E_PROJECT_ID"` DBConfig *database.Config `env:",prefix=E2E_"` }
E2EConfig represents configurations to run server E2E tests.
type E2ESuite ¶
type E2ESuite struct {
// contains filtered or unexported fields
}
E2ESuite contains E2E test configs and other useful data.
func NewE2ESuite ¶
NewE2ESuite returns an E2E test suite.
func (*E2ESuite) NewAPIClient ¶
NewAPIClient returns an API client.
func (*E2ESuite) NewAdminAPIClient ¶
NewAdminAPIClient returns an admin API client.
type IntegrationSuite ¶
type IntegrationSuite struct {
// contains filtered or unexported fields
}
IntegrationSuite contains the integration test configs and other useful data.
func NewIntegrationSuite ¶
func NewIntegrationSuite(tb testing.TB, ctx context.Context) *IntegrationSuite
NewIntegrationSuite creates a IntegrationSuite for integration tests.
func (*IntegrationSuite) NewAPIClient ¶
NewAPIClient runs an API Server and returns a corresponding client.
func (*IntegrationSuite) NewAdminAPIClient ¶
func (s *IntegrationSuite) NewAdminAPIClient(ctx context.Context, tb testing.TB) (*AdminClient, error)
NewAdminAPIClient runs an Admin API Server and returns a corresponding client.
type IntegrationTestConfig ¶ added in v0.17.1
type IntegrationTestConfig struct { Observability *observability.Config DBConfig *database.Config APISrvConfig config.APIServerConfig AdminAPISrvConfig config.AdminAPIServerConfig }
IntegrationTestConfig represents configurations to run server integration tests.