fix hubtest for waap

This commit is contained in:
Sebastien Blot 2023-12-04 10:07:16 +01:00
parent 872e218b31
commit d9355e8c3a
No known key found for this signature in database
GPG key ID: DFC2902F40449F6A
2 changed files with 4 additions and 4 deletions

View file

@ -20,12 +20,12 @@ type Coverage struct {
}
func (h *HubTest) GetWaapCoverage() ([]Coverage, error) {
if _, ok := h.HubIndex.Items[cwhub.WAAP_RULES]; !ok {
if len(h.HubIndex.GetItemMap(cwhub.WAAP_RULES)) == 0 {
return nil, fmt.Errorf("no waap rules in hub index")
}
// populate from hub, iterate in alphabetical order
pkeys := sortedMapKeys(h.HubIndex.Items[cwhub.WAAP_RULES])
pkeys := sortedMapKeys(h.HubIndex.GetItemMap(cwhub.WAAP_RULES))
coverage := make([]Coverage, len(pkeys))
for i, name := range pkeys {
@ -165,7 +165,7 @@ func (h *HubTest) GetParsersCoverage() ([]Coverage, error) {
}
func (h *HubTest) GetScenariosCoverage() ([]Coverage, error) {
if len(h.HubIndex.GetItemMap(cwhub.SCENARIOS)) == 0 {
if len(h.HubIndex.GetItemMap(cwhub.SCENARIOS)) == 0 {
return nil, fmt.Errorf("no scenarios in hub index")
}

View file

@ -320,7 +320,7 @@ func (t *HubTestItem) InstallHub() error {
continue
}
if hubWaapRule, ok := t.HubIndex.Items[cwhub.WAAP_RULES][waaprule]; ok {
if hubWaapRule, ok := t.HubIndex.GetItemMap(cwhub.WAAP_RULES)[waaprule]; ok {
waapRuleSource, err := filepath.Abs(filepath.Join(t.HubPath, hubWaapRule.RemotePath))
if err != nil {
return fmt.Errorf("can't get absolute path of '%s': %s", waapRuleSource, err)