Documentation ¶
Index ¶
- Variables
- func CheckSetup(repo model.IRepository) error
- func TestCreateAgreement(t *testing.T, repo model.IRepository)
- func TestCreateAgreementExists(t *testing.T, repo model.IRepository)
- func TestCreateProvider(t *testing.T, repo model.IRepository)
- func TestCreateProviderExists(t *testing.T, repo model.IRepository)
- func TestCreateViolation(t *testing.T, repo model.IRepository)
- func TestCreateViolationExists(t *testing.T, repo model.IRepository)
- func TestDeleteAgreement(t *testing.T, repo model.IRepository)
- func TestDeleteAgreementNotExists(t *testing.T, repo model.IRepository)
- func TestDeleteProvider(t *testing.T, repo model.IRepository)
- func TestDeleteProviderNotExists(t *testing.T, repo model.IRepository)
- func TestGetAgreement(t *testing.T, repo model.IRepository)
- func TestGetAgreementNotExists(t *testing.T, repo model.IRepository)
- func TestGetAgreementsByState(t *testing.T, repo model.IRepository)
- func TestGetAllAgreements(t *testing.T, repo model.IRepository)
- func TestGetAllProviders(t *testing.T, repo model.IRepository)
- func TestGetProvider(t *testing.T, repo model.IRepository)
- func TestGetProviderNotExists(t *testing.T, repo model.IRepository)
- func TestGetViolation(t *testing.T, repo model.IRepository)
- func TestGetViolationNotExists(t *testing.T, repo model.IRepository)
- func TestUpdateAgreement(t *testing.T, repo model.IRepository)
- func TestUpdateAgreementNotExists(t *testing.T, repo model.IRepository)
- func TestUpdateAgreementState(t *testing.T, repo model.IRepository)
- func TestUpdateAgreementStateNotExists(t *testing.T, repo model.IRepository)
- type TestContext
- func (r *TestContext) TestCreateAgreement(t *testing.T)
- func (r *TestContext) TestCreateAgreementExists(t *testing.T)
- func (r *TestContext) TestCreateProvider(t *testing.T)
- func (r *TestContext) TestCreateProviderExists(t *testing.T)
- func (r *TestContext) TestCreateTemplate(t *testing.T)
- func (r *TestContext) TestCreateTemplateExists(t *testing.T)
- func (r *TestContext) TestCreateViolation(t *testing.T)
- func (r *TestContext) TestCreateViolationExists(t *testing.T)
- func (r *TestContext) TestDeleteAgreement(t *testing.T)
- func (r *TestContext) TestDeleteAgreementNotExists(t *testing.T)
- func (r *TestContext) TestDeleteProvider(t *testing.T)
- func (r *TestContext) TestDeleteProviderNotExists(t *testing.T)
- func (r *TestContext) TestGetAgreement(t *testing.T)
- func (r *TestContext) TestGetAgreementNotExists(t *testing.T)
- func (r *TestContext) TestGetAgreementsByState(t *testing.T)
- func (r *TestContext) TestGetAllAgreements(t *testing.T)
- func (r *TestContext) TestGetAllProviders(t *testing.T)
- func (r *TestContext) TestGetAllTemplates(t *testing.T)
- func (r *TestContext) TestGetProvider(t *testing.T)
- func (r *TestContext) TestGetProviderNotExists(t *testing.T)
- func (r *TestContext) TestGetTemplate(t *testing.T)
- func (r *TestContext) TestGetTemplateNotExists(t *testing.T)
- func (r *TestContext) TestGetViolation(t *testing.T)
- func (r *TestContext) TestGetViolationNotExists(t *testing.T)
- func (r *TestContext) TestUpdateAgreement(t *testing.T)
- func (r *TestContext) TestUpdateAgreementNotExists(t *testing.T)
- func (r *TestContext) TestUpdateAgreementState(t *testing.T)
- func (r *TestContext) TestUpdateAgreementStateNotExists(t *testing.T)
- type TestData
Constants ¶
This section is empty.
Variables ¶
var Data = TestData{ P01: model.Provider{ Id: "p01", Name: "Provider01", }, P02: model.Provider{ Id: "p02", Name: "Provider02", }, Pnotexists: model.Provider{ Id: "notexists", Name: "ProviderNotExists", }, A01: model.Agreement{ Id: "a01", Name: "Agreement01", State: model.STOPPED, Assessment: model.Assessment{}, }, A02: model.Agreement{ Id: "a02", Name: "Agreement02", State: model.STARTED, Assessment: model.Assessment{}, }, A03: model.Agreement{ Id: "a03", Name: "Agreement03", State: model.TERMINATED, Assessment: model.Assessment{}, }, Anotexists: model.Agreement{ Id: "notexists", Name: "AgreementNotExists", State: model.STOPPED, Assessment: model.Assessment{}, }, V01: model.Violation{ Id: "v01", AgreementId: "a01", Datetime: time.Now(), Constraint: "t < 100", Guarantee: "gt1", Values: []model.MetricValue{ model.MetricValue{DateTime: time.Now(), Key: "t", Value: 101}, }, }, Vnotexists: model.Violation{ Id: "vnotexists", AgreementId: "a01", }, T01: model.Template{ Id: "t01", Name: "Template01", }, }
Data contains the data to be used in these tests. It can be overwritten if needed.
Functions ¶
func CheckSetup ¶
func CheckSetup(repo model.IRepository) error
CheckSetup checks that the entities to be created on this test do not exist in the repository (this would make the test fail). To be called from TestMain method.
func TestCreateAgreement ¶
func TestCreateAgreement(t *testing.T, repo model.IRepository)
TestCreateAgreement executes this test Deprecated: use TestContext function
func TestCreateAgreementExists ¶
func TestCreateAgreementExists(t *testing.T, repo model.IRepository)
TestCreateAgreementExists executes this test Deprecated: use TestContext function
func TestCreateProvider ¶
func TestCreateProvider(t *testing.T, repo model.IRepository)
TestCreateProvider executes this test Deprecated: use TestContext function
func TestCreateProviderExists ¶
func TestCreateProviderExists(t *testing.T, repo model.IRepository)
TestCreateProviderExists executes this test Deprecated: use TestContext function
func TestCreateViolation ¶
func TestCreateViolation(t *testing.T, repo model.IRepository)
TestCreateViolation executes this test Deprecated: use TestContext function
func TestCreateViolationExists ¶
func TestCreateViolationExists(t *testing.T, repo model.IRepository)
TestCreateViolationExists executes this test Deprecated: use TestContext function
func TestDeleteAgreement ¶
func TestDeleteAgreement(t *testing.T, repo model.IRepository)
TestDeleteAgreement executes this test Deprecated: use TestContext function
func TestDeleteAgreementNotExists ¶
func TestDeleteAgreementNotExists(t *testing.T, repo model.IRepository)
TestDeleteAgreementNotExists executes this test Deprecated: use TestContext function
func TestDeleteProvider ¶
func TestDeleteProvider(t *testing.T, repo model.IRepository)
TestDeleteProvider executes this test Deprecated: use TestContext function
func TestDeleteProviderNotExists ¶
func TestDeleteProviderNotExists(t *testing.T, repo model.IRepository)
TestDeleteProviderNotExists executes this test Deprecated: use TestContext function
func TestGetAgreement ¶
func TestGetAgreement(t *testing.T, repo model.IRepository)
TestGetAgreement executes this test Deprecated: use TestContext function
func TestGetAgreementNotExists ¶
func TestGetAgreementNotExists(t *testing.T, repo model.IRepository)
TestGetAgreementNotExists executes this test Deprecated: use TestContext function
func TestGetAgreementsByState ¶
func TestGetAgreementsByState(t *testing.T, repo model.IRepository)
TestGetAgreementsByState executes this test Deprecated: use TestContext function
func TestGetAllAgreements ¶
func TestGetAllAgreements(t *testing.T, repo model.IRepository)
TestGetAllAgreements executes this test Deprecated: use TestContext function
func TestGetAllProviders ¶
func TestGetAllProviders(t *testing.T, repo model.IRepository)
TestGetAllProviders executes this test Deprecated: use TestContext function
func TestGetProvider ¶
func TestGetProvider(t *testing.T, repo model.IRepository)
TestGetProvider executes this test Deprecated: use TestContext function
func TestGetProviderNotExists ¶
func TestGetProviderNotExists(t *testing.T, repo model.IRepository)
TestGetProviderNotExists executes this test Deprecated: use TestContext function
func TestGetViolation ¶
func TestGetViolation(t *testing.T, repo model.IRepository)
TestGetViolation executes this test Deprecated: use TestContext function
func TestGetViolationNotExists ¶
func TestGetViolationNotExists(t *testing.T, repo model.IRepository)
TestGetViolationNotExists executes this test Deprecated: use TestContext function
func TestUpdateAgreement ¶
func TestUpdateAgreement(t *testing.T, repo model.IRepository)
TestUpdateAgreement executes this test Deprecated: use TestContext function
func TestUpdateAgreementNotExists ¶
func TestUpdateAgreementNotExists(t *testing.T, repo model.IRepository)
TestUpdateAgreementNotExists executes this test Deprecated: use TestContext function
func TestUpdateAgreementState ¶
func TestUpdateAgreementState(t *testing.T, repo model.IRepository)
TestUpdateAgreementState executes this test Deprecated: use TestContext function
func TestUpdateAgreementStateNotExists ¶
func TestUpdateAgreementStateNotExists(t *testing.T, repo model.IRepository)
TestUpdateAgreementStateNotExists executes this test Deprecated: use TestContext function
Types ¶
type TestContext ¶
type TestContext struct {
Repo model.IRepository
}
TestContext contains parameters needed in a repository test when calling from a t.Run() statement
This way, t.Run() can be called like t.Run("Test", ctx.testSomething).
func (*TestContext) TestCreateAgreement ¶
func (r *TestContext) TestCreateAgreement(t *testing.T)
TestCreateAgreement executes this test
func (*TestContext) TestCreateAgreementExists ¶
func (r *TestContext) TestCreateAgreementExists(t *testing.T)
TestCreateAgreementExists executes this test
func (*TestContext) TestCreateProvider ¶
func (r *TestContext) TestCreateProvider(t *testing.T)
TestCreateProvider executes this test
func (*TestContext) TestCreateProviderExists ¶
func (r *TestContext) TestCreateProviderExists(t *testing.T)
TestCreateProviderExists executes this test
func (*TestContext) TestCreateTemplate ¶
func (r *TestContext) TestCreateTemplate(t *testing.T)
TestCreateTemplate executes this test
func (*TestContext) TestCreateTemplateExists ¶
func (r *TestContext) TestCreateTemplateExists(t *testing.T)
TestCreateTemplateExists executes this test
func (*TestContext) TestCreateViolation ¶
func (r *TestContext) TestCreateViolation(t *testing.T)
TestCreateViolation executes this test
func (*TestContext) TestCreateViolationExists ¶
func (r *TestContext) TestCreateViolationExists(t *testing.T)
TestCreateViolationExists executes this test
func (*TestContext) TestDeleteAgreement ¶
func (r *TestContext) TestDeleteAgreement(t *testing.T)
TestDeleteAgreement executes this test
func (*TestContext) TestDeleteAgreementNotExists ¶
func (r *TestContext) TestDeleteAgreementNotExists(t *testing.T)
TestDeleteAgreementNotExists executes this test
func (*TestContext) TestDeleteProvider ¶
func (r *TestContext) TestDeleteProvider(t *testing.T)
TestDeleteProvider executes this test
func (*TestContext) TestDeleteProviderNotExists ¶
func (r *TestContext) TestDeleteProviderNotExists(t *testing.T)
TestDeleteProviderNotExists executes this test
func (*TestContext) TestGetAgreement ¶
func (r *TestContext) TestGetAgreement(t *testing.T)
TestGetAgreement executes this test
func (*TestContext) TestGetAgreementNotExists ¶
func (r *TestContext) TestGetAgreementNotExists(t *testing.T)
TestGetAgreementNotExists executes this test
func (*TestContext) TestGetAgreementsByState ¶
func (r *TestContext) TestGetAgreementsByState(t *testing.T)
TestGetAgreementsByState executes this test
func (*TestContext) TestGetAllAgreements ¶
func (r *TestContext) TestGetAllAgreements(t *testing.T)
TestGetAllAgreements executes this test
func (*TestContext) TestGetAllProviders ¶
func (r *TestContext) TestGetAllProviders(t *testing.T)
TestGetAllProviders executes this test
func (*TestContext) TestGetAllTemplates ¶
func (r *TestContext) TestGetAllTemplates(t *testing.T)
TestGetAllTemplates executes this test
func (*TestContext) TestGetProvider ¶
func (r *TestContext) TestGetProvider(t *testing.T)
TestGetProvider executes this test
func (*TestContext) TestGetProviderNotExists ¶
func (r *TestContext) TestGetProviderNotExists(t *testing.T)
TestGetProviderNotExists executes this test
func (*TestContext) TestGetTemplate ¶
func (r *TestContext) TestGetTemplate(t *testing.T)
TestGetTemplate executes this test
func (*TestContext) TestGetTemplateNotExists ¶
func (r *TestContext) TestGetTemplateNotExists(t *testing.T)
TestGetTemplateNotExists executes this test
func (*TestContext) TestGetViolation ¶
func (r *TestContext) TestGetViolation(t *testing.T)
TestGetViolation executes this test
func (*TestContext) TestGetViolationNotExists ¶
func (r *TestContext) TestGetViolationNotExists(t *testing.T)
TestGetViolationNotExists executes this test
func (*TestContext) TestUpdateAgreement ¶
func (r *TestContext) TestUpdateAgreement(t *testing.T)
TestUpdateAgreement executes this test
func (*TestContext) TestUpdateAgreementNotExists ¶
func (r *TestContext) TestUpdateAgreementNotExists(t *testing.T)
TestUpdateAgreementNotExists executes this test
func (*TestContext) TestUpdateAgreementState ¶
func (r *TestContext) TestUpdateAgreementState(t *testing.T)
TestUpdateAgreementState executes this test
func (*TestContext) TestUpdateAgreementStateNotExists ¶
func (r *TestContext) TestUpdateAgreementStateNotExists(t *testing.T)
TestUpdateAgreementStateNotExists executes this test
type TestData ¶
type TestData struct { P01 model.Provider P02 model.Provider Pnotexists model.Provider A01 model.Agreement A02 model.Agreement A03 model.Agreement Anotexists model.Agreement V01 model.Violation Vnotexists model.Violation T01 model.Template }
TestData contains the data type to be used in these tests
Directories ¶
Path | Synopsis |
---|---|
Package memrepository is a simple implementation of a model.IRepository intended for developing purposes.
|
Package memrepository is a simple implementation of a model.IRepository intended for developing purposes. |
Package mongodb is an implementation of a model.IRepository backed up by a mongodb.
|
Package mongodb is an implementation of a model.IRepository backed up by a mongodb. |
Package validation provides a repository decorator that provides in-memory validation before calling the decorated repository.
|
Package validation provides a repository decorator that provides in-memory validation before calling the decorated repository. |