Skip to content

Commit

Permalink
feat(categories): added categories in init check
Browse files Browse the repository at this point in the history
  • Loading branch information
StanGirard committed Sep 27, 2022
1 parent 497442a commit 69c7afb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 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, check.Category)
checkTmp.InitCheck(check.Name, check.Description, check.Id, check.Categories)
for _, result := range check.Results {
if !IsIgnored(c, result, check) {
checkTmp.AddResult(result)
Expand Down
2 changes: 1 addition & 1 deletion plugins/commons/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type Check struct {
Description string `yaml:"description"` // Description of the check
Status string `yaml:"status"` // Status of the check - OK, FAIL
Id string `yaml:"id"` // ID of the check - unique identifier for the check - AWS_IAM_001
Category string `yaml:"category"` // Category of the check - Security, Cost, Performance, Fault Tolerance, Operational Excellence, etc ...
Categories []string `yaml:"categories"` // Category of the check - Security, Cost, Performance, Fault Tolerance, Operational Excellence, etc ...
Results []Result `yaml:"results"` // Results of the check
Duration time.Duration `yaml:"duration"` // Duration of the check
StartTime time.Time
Expand Down
4 changes: 2 additions & 2 deletions plugins/commons/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ func (c *Check) AddResult(result Result) {
}

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

Expand Down
3 changes: 2 additions & 1 deletion plugins/commons/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ 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, "test")
categories := []string{"test"}
c.InitCheck(tt.args.name, tt.args.description, tt.args.id, categories)
if c.Name != tt.args.name {
t.Errorf("Name is not %s", tt.args.name)
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func RunPlugin(pluginInput commons.Plugin, c *commons.Config) []commons.Tests {
// This prevents users from executing bad plugins or executing a plugin
// directory. It is a UX feature, not a security feature.
var handshakeConfig = plugin.HandshakeConfig{
ProtocolVersion: 1,
ProtocolVersion: 2,
MagicCookieKey: "BASIC_PLUGIN",
MagicCookieValue: "hello",
}
Expand Down

0 comments on commit 69c7afb

Please sign in to comment.