Skip to content

Commit

Permalink
feat(checks): update init check method to add new category initialisa…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
StanGirard committed Sep 27, 2022
1 parent c26942a commit 87c0230
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func RemoveIgnored(c *commons.Config, tests []commons.Tests) []commons.Tests {
for _, check := range test.Checks {
checkTmp := check
checkTmp.Results = []commons.Result{}
checkTmp.InitCheck(check.Name, check.Description, check.Id)
checkTmp.InitCheck(check.Name, check.Description, check.Id, check.Category)
for _, result := range check.Results {
if !IsIgnored(c, result, check) {
checkTmp.AddResult(result)
Expand Down
3 changes: 2 additions & 1 deletion plugins/commons/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ func (c *Check) AddResult(result Result) {
}

// Initialise a check
func (c *Check) InitCheck(name, description, id string) {
func (c *Check) InitCheck(name, description, id string, category string) {
c.Name = name
c.Description = description
c.Status = "OK"
c.Id = id
c.Category = category
c.StartTime = time.Now()
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/commons/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func TestCheck_InitCheck(t *testing.T) {
Id: tt.fields.Id,
Results: tt.fields.Results,
}
c.InitCheck(tt.args.name, tt.args.description, tt.args.id)
c.InitCheck(tt.args.name, tt.args.description, tt.args.id, "test")
if c.Name != tt.args.name {
t.Errorf("Name is not %s", tt.args.name)
}
Expand Down

0 comments on commit 87c0230

Please sign in to comment.