Skip to content

Commit

Permalink
Enable compliance test about synthetic source (#798)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrodm authored Sep 10, 2024
1 parent 630127b commit 0c3f196
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 6 additions & 2 deletions compliance/compliance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,16 @@ func findTestPackage(packageName string) (string, error) {
}

func aPolicyIsCreatedWithPackage(packageName string) error {
const version = "1.0.0" // TODO: Add support for package and version
const version = "1.0.0"
return aPolicyIsCreatedWithPackageAndVersion(packageName, version)
}

func aPolicyIsCreatedWithPackageAndVersion(packageName, packageVersion string) error {
kibana, err := NewKibanaClient()
if err != nil {
return err
}
_, err = kibana.CreatePolicyForPackage(packageName, version)
_, err = kibana.CreatePolicyForPackage(packageName, packageVersion)
if err != nil {
return err
}
Expand Down Expand Up @@ -215,6 +218,7 @@ func InitializeScenario(ctx *godog.ScenarioContext) {
ctx.Step(`^index template "([^"]*)" has a field "([^"]*)" with "([^"]*)"$`, indexTemplateHasAFieldWith)
ctx.Step(`^the "([^"]*)" package is installed$`, thePackageIsInstalled)
ctx.Step(`^a policy is created with "([^"]*)" package$`, aPolicyIsCreatedWithPackage)
ctx.Step(`^a policy is created with "([^"]*)" package and "([^"]*)" version$`, aPolicyIsCreatedWithPackageAndVersion)
ctx.Step(`^a policy is created with "([^"]*)" package, "([^"]*)" template, "([^"]*)" input, "([^"]*)" input type and dataset "([^"]*)"$`, aPolicyIsCreatedWithPackageInputAndDataset)
ctx.Step(`^there is an index template "([^"]*)" with pattern "([^"]*)"$`, thereIsAnIndexTemplateWithPattern)
ctx.Step(`^there is a transform "([^"]*)"$`, thereIsATransform)
Expand Down
3 changes: 1 addition & 2 deletions compliance/elasticpackage.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (ep *ElasticPackage) Close() error {

// Install installs the package in the given path.
func (ep *ElasticPackage) Install(packagePath string) error {
cmd := exec.Command("go", "run", elasticPackageImportPath, "install")
cmd := exec.Command("go", "run", elasticPackageImportPath, "-C", packagePath, "install")
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
cmd.Env = append(os.Environ(),
Expand All @@ -51,7 +51,6 @@ func (ep *ElasticPackage) Install(packagePath string) error {
elasticPackageGetEnv("ELASTICSEARCH_USERNAME"),
elasticPackageGetEnv("KIBANA_HOST"),
)
cmd.Dir = packagePath
err := cmd.Run()
if err != nil {
return fmt.Errorf("elastic-package failed: %w", err)
Expand Down
5 changes: 1 addition & 4 deletions compliance/features/synthetic-source.feature
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
Feature: Synthetic source
Support synthetic source

# Requires a new elastic-package release to be able to use -C flag to run tests
# of a package located in another directory (https://github.com/elastic/elastic-package/pull/1914)
@skip
@3.2.0
Scenario: Installer leverages source true
Given the "logs_synthetic_mode" package is installed
And a policy is created with "logs_synthetic_mode" package
And a policy is created with "logs_synthetic_mode" package and "1.0.0-beta1" version
Then index template "logs-logs_synthetic_mode.synthetic" has a field "decision_id" with "store:true"

0 comments on commit 0c3f196

Please sign in to comment.