simplify a bit

This commit is contained in:
bui 2023-11-17 15:15:29 +01:00
parent 55491be528
commit 9af30e2a3d

View file

@ -19,6 +19,8 @@ type HubTest struct {
TemplateConfigPath string TemplateConfigPath string
TemplateProfilePath string TemplateProfilePath string
TemplateSimulationPath string TemplateSimulationPath string
TemplateAcquisPath string
TemplateWaapProfilePath string
HubIndex *cwhub.Hub HubIndex *cwhub.Hub
Tests []*HubTestItem Tests []*HubTestItem
} }
@ -27,6 +29,8 @@ const (
templateConfigFile = "template_config.yaml" templateConfigFile = "template_config.yaml"
templateSimulationFile = "template_simulation.yaml" templateSimulationFile = "template_simulation.yaml"
templateProfileFile = "template_profiles.yaml" templateProfileFile = "template_profiles.yaml"
templateAcquisFile = "template_acquis.yaml"
templateWaapProfilePath = "template_waap-profile.yaml"
) )
func NewHubTest(hubPath string, crowdsecPath string, cscliPath string) (HubTest, error) { func NewHubTest(hubPath string, crowdsecPath string, cscliPath string) (HubTest, error) {
@ -70,19 +74,17 @@ func NewHubTest(hubPath string, crowdsecPath string, cscliPath string) (HubTest,
return HubTest{}, fmt.Errorf("unable to load hub: %s", err) return HubTest{}, fmt.Errorf("unable to load hub: %s", err)
} }
templateConfigFilePath := filepath.Join(HubTestPath, templateConfigFile)
templateProfilePath := filepath.Join(HubTestPath, templateProfileFile)
templateSimulationPath := filepath.Join(HubTestPath, templateSimulationFile)
return HubTest{ return HubTest{
CrowdSecPath: crowdsecPath, CrowdSecPath: crowdsecPath,
CscliPath: cscliPath, CscliPath: cscliPath,
HubPath: hubPath, HubPath: hubPath,
HubTestPath: HubTestPath, HubTestPath: HubTestPath,
HubIndexFile: hubIndexFile, HubIndexFile: hubIndexFile,
TemplateConfigPath: templateConfigFilePath, TemplateConfigPath: filepath.Join(HubTestPath, templateConfigFile),
TemplateProfilePath: templateProfilePath, TemplateProfilePath: filepath.Join(HubTestPath, templateProfileFile),
TemplateSimulationPath: templateSimulationPath, TemplateSimulationPath: filepath.Join(HubTestPath, templateSimulationFile),
TemplateWaapProfilePath: filepath.Join(HubTestPath, templateWaapProfilePath),
TemplateAcquisPath: filepath.Join(HubTestPath, templateAcquisFile),
HubIndex: hub, HubIndex: hub,
}, nil }, nil
} }