Documentation ¶
Index ¶
- func IntegrationTestsEnabled() bool
- func NewConfData(db *TestDatabase, t *testing.T) *conf.Data
- func NewDataConfig(in *conf.Data) *data.NewConfig
- func NewPolicyProviderConfig(in *conf.Bootstrap) []*policies.NewRegistryConfig
- func NewPromSpec() []*conf.PrometheusIntegrationSpec
- type NewTestingUCOpt
- type TestDatabase
- type TestingRepos
- type TestingUseCases
- type UseCasesEachTestSuite
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IntegrationTestsEnabled ¶
func IntegrationTestsEnabled() bool
We use an env variable because testing flags will require us to add them to each testing package
func NewConfData ¶
func NewConfData(db *TestDatabase, t *testing.T) *conf.Data
func NewPolicyProviderConfig ¶ added in v0.96.1
func NewPolicyProviderConfig(in *conf.Bootstrap) []*policies.NewRegistryConfig
func NewPromSpec ¶ added in v0.95.0
func NewPromSpec() []*conf.PrometheusIntegrationSpec
Types ¶
type NewTestingUCOpt ¶
type NewTestingUCOpt func(*newTestingOpts)
func WithCredsReaderWriter ¶
func WithCredsReaderWriter(rw credentials.ReaderWriter) NewTestingUCOpt
func WithOnboardingConfiguration ¶ added in v0.91.8
func WithOnboardingConfiguration(conf []*config.OnboardingSpec) NewTestingUCOpt
func WithRegisteredIntegration ¶
func WithRegisteredIntegration(i sdk.FanOut) NewTestingUCOpt
type TestDatabase ¶
type TestDatabase struct {
// contains filtered or unexported fields
}
func NewTestDatabase ¶
func NewTestDatabase(t *testing.T) *TestDatabase
func (*TestDatabase) Close ¶
func (db *TestDatabase) Close(t *testing.T)
func (*TestDatabase) ConnectionString ¶
func (db *TestDatabase) ConnectionString(t *testing.T) string
type TestingRepos ¶
type TestingRepos struct { Membership biz.MembershipRepo Referrer biz.ReferrerRepo Workflow biz.WorkflowRepo WorkflowRunRepo biz.WorkflowRunRepo AttestationState biz.AttestationStateRepo OrganizationRepo biz.OrganizationRepo }
type TestingUseCases ¶
type TestingUseCases struct { // Misc DB *TestDatabase Data *data.Data L log.Logger // Use cases Membership *biz.MembershipUseCase CASBackend *biz.CASBackendUseCase Integration *biz.IntegrationUseCase Organization *biz.OrganizationUseCase WorkflowContract *biz.WorkflowContractUseCase Workflow *biz.WorkflowUseCase WorkflowRun *biz.WorkflowRunUseCase Prometheus *biz.PrometheusUseCase User *biz.UserUseCase RobotAccount *biz.RobotAccountUseCase RegisteredIntegrations sdk.AvailablePlugins CASMapping *biz.CASMappingUseCase OrgInvitation *biz.OrgInvitationUseCase Referrer *biz.ReferrerUseCase APIToken *biz.APITokenUseCase Enforcer *authz.Enforcer AttestationState *biz.AttestationStateUseCase ProjectVersion *biz.ProjectVersionUseCase Project *biz.ProjectUseCase // Repositories that can be used for custom crafting of use-cases Repos *TestingRepos }
TestingUseCases holds all the test data that can be used in the different suites NOTE: It connects to a real database
func NewTestingUseCases ¶
func NewTestingUseCases(t *testing.T, opts ...NewTestingUCOpt) *TestingUseCases
func WireTestData ¶
func WireTestData(testDatabase *TestDatabase, t *testing.T, logger log.Logger, readerWriter credentials.ReaderWriter, builder *robotaccount.Builder, auth *conf.Auth, bootstrap *conf.Bootstrap, arg []*v1.OnboardingSpec, availablePlugins sdk.AvailablePlugins, providers backend.Providers) (*TestingUseCases, func(), error)
wireTestData init testing data
type UseCasesEachTestSuite ¶
type UseCasesEachTestSuite struct { suite.Suite *TestingUseCases }
Suite that creates a database and sets the schema before each test
func (*UseCasesEachTestSuite) SetupSuite ¶
func (s *UseCasesEachTestSuite) SetupSuite()
Run only if the integration flag is set
func (*UseCasesEachTestSuite) SetupTest ¶
func (s *UseCasesEachTestSuite) SetupTest()
Run before each test
func (*UseCasesEachTestSuite) TearDownTest ¶
func (s *UseCasesEachTestSuite) TearDownTest()
Run after each test
Click to show internal directories.
Click to hide internal directories.