MCPcopy Create free account
hub / github.com/cloudbase/garm / TestAddRepoEntityEvent

Method TestAddRepoEntityEvent

database/sql/repositories_test.go:1034–1057  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1032}
1033
1034func (s *RepoTestSuite) TestAddRepoEntityEvent() {
1035 repo, err := s.Store.CreateRepository(
1036 s.adminCtx,
1037 s.Fixtures.CreateRepoParams.Owner,
1038 s.Fixtures.CreateRepoParams.Name,
1039 s.testCreds,
1040 s.Fixtures.CreateRepoParams.WebhookSecret,
1041 params.PoolBalancerTypeRoundRobin,
1042 false,
1043 )
1044
1045 s.Require().Nil(err)
1046 entity, err := repo.GetEntity()
1047 s.Require().Nil(err)
1048 err = s.Store.AddEntityEvent(s.adminCtx, entity, params.StatusEvent, params.EventInfo, "this is a test", 20)
1049 s.Require().Nil(err)
1050
1051 repo, err = s.Store.GetRepositoryByID(s.adminCtx, repo.ID)
1052 s.Require().Nil(err)
1053 s.Require().Equal(1, len(repo.Events))
1054 s.Require().Equal(params.StatusEvent, repo.Events[0].EventType)
1055 s.Require().Equal(params.EventInfo, repo.Events[0].EventLevel)
1056 s.Require().Equal("this is a test", repo.Events[0].Message)
1057}
1058
1059func TestRepoTestSuite(t *testing.T) {
1060 suite.Run(t, new(RepoTestSuite))

Callers

nothing calls this directly

Calls 4

CreateRepositoryMethod · 0.65
GetEntityMethod · 0.65
AddEntityEventMethod · 0.65
GetRepositoryByIDMethod · 0.65

Tested by

no test coverage detected