From 87c0230b38c898e081737b30e04a5ccecb3f9223 Mon Sep 17 00:00:00 2001 From: Stan Girard Date: Tue, 27 Sep 2022 12:02:27 +0200 Subject: [PATCH] feat(checks): update init check method to add new category initialisation --- internal/report/report.go | 2 +- plugins/commons/types.go | 3 ++- plugins/commons/types_test.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/report/report.go b/internal/report/report.go index 4d8f195..dc11f12 100644 --- a/internal/report/report.go +++ b/internal/report/report.go @@ -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) diff --git a/plugins/commons/types.go b/plugins/commons/types.go index b72be62..b08cb28 100644 --- a/plugins/commons/types.go +++ b/plugins/commons/types.go @@ -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() } diff --git a/plugins/commons/types_test.go b/plugins/commons/types_test.go index efd1d2a..687dd73 100644 --- a/plugins/commons/types_test.go +++ b/plugins/commons/types_test.go @@ -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) }