Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions internal/benchrunner/runners/common/packages.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package common

import "path/filepath"

func DataStreamPath(packageRoot, dataStream string) string {
return filepath.Join(packageRoot, "data_stream", dataStream)
}
11 changes: 11 additions & 0 deletions internal/benchrunner/runners/common/runid.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package common

import "github.com/google/uuid"

func NewRunID() string {
return uuid.New().String()
}
14 changes: 3 additions & 11 deletions internal/benchrunner/runners/rally/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (

"github.com/elastic/elastic-package/internal/stack"

"github.com/google/uuid"
"gopkg.in/yaml.v3"

"github.com/elastic/elastic-integration-corpus-generator-tool/pkg/genlib"
Expand All @@ -36,6 +35,7 @@ import (

"github.com/elastic/elastic-package/internal/benchrunner"
"github.com/elastic/elastic-package/internal/benchrunner/reporters"
"github.com/elastic/elastic-package/internal/benchrunner/runners/common"
"github.com/elastic/elastic-package/internal/configuration/locations"
"github.com/elastic/elastic-package/internal/elasticsearch"
"github.com/elastic/elastic-package/internal/logger"
Expand Down Expand Up @@ -244,7 +244,7 @@ func (r *runner) setUp() error {
rallyCorpusDir := locationManager.RallyCorpusDir()
r.ctxt.Logs.Folder.Local = rallyCorpusDir
r.ctxt.Logs.Folder.Agent = RallyCorpusAgentDir
r.ctxt.Test.RunID = createRunID()
r.ctxt.Test.RunID = common.NewRunID()

outputDir, err := servicedeployer.CreateOutputDir(locationManager, r.ctxt.Test.RunID)
if err != nil {
Expand Down Expand Up @@ -282,7 +282,7 @@ func (r *runner) setUp() error {

dataStreamManifest, err := packages.ReadDataStreamManifest(
filepath.Join(
getDataStreamPath(r.options.PackageRootPath, r.scenario.DataStream.Name),
common.DataStreamPath(r.options.PackageRootPath, r.scenario.DataStream.Name),
packages.DataStreamManifestFile,
),
)
Expand Down Expand Up @@ -1188,14 +1188,6 @@ func waitUntilTrue(fn func() (bool, error), timeout time.Duration) (bool, error)
}
}

func createRunID() string {
return uuid.New().String()
}

func getDataStreamPath(packageRoot, dataStream string) string {
return filepath.Join(packageRoot, "data_stream", dataStream)
}

func generateRallyTrack(dataStream, indexTemplateBody, corpusFileName string, corpusDocsCount uint64, isTSDB bool) ([]byte, error) {
t := template.New("rallytrack")

Expand Down
14 changes: 3 additions & 11 deletions internal/benchrunner/runners/stream/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (

"github.com/elastic/elastic-package/internal/packages/installer"

"github.com/google/uuid"
"gopkg.in/yaml.v3"

"github.com/elastic/elastic-integration-corpus-generator-tool/pkg/genlib"
Expand All @@ -29,6 +28,7 @@ import (

"github.com/elastic/elastic-package/internal/benchrunner"
"github.com/elastic/elastic-package/internal/benchrunner/reporters"
"github.com/elastic/elastic-package/internal/benchrunner/runners/common"
"github.com/elastic/elastic-package/internal/elasticsearch"
"github.com/elastic/elastic-package/internal/logger"
"github.com/elastic/elastic-package/internal/multierror"
Expand Down Expand Up @@ -107,7 +107,7 @@ func (r *runner) setUp() error {

r.runtimeDataStreams = make(map[string]string)

r.ctxt.Test.RunID = createRunID()
r.ctxt.Test.RunID = common.NewRunID()

pkgManifest, err := packages.ReadPackageManifestFromPackageRoot(r.options.PackageRootPath)
if err != nil {
Expand All @@ -133,7 +133,7 @@ func (r *runner) setUp() error {
var err error
dataStreamManifest, err := packages.ReadDataStreamManifest(
filepath.Join(
getDataStreamPath(r.options.PackageRootPath, scenario.DataStream.Name),
common.DataStreamPath(r.options.PackageRootPath, scenario.DataStream.Name),
packages.DataStreamManifestFile,
),
)
Expand Down Expand Up @@ -629,11 +629,3 @@ func waitUntilTrue(fn func() (bool, error), timeout time.Duration) (bool, error)
}
}
}

func createRunID() string {
return uuid.New().String()
}

func getDataStreamPath(packageRoot, dataStream string) string {
return filepath.Join(packageRoot, "data_stream", dataStream)
}
14 changes: 3 additions & 11 deletions internal/benchrunner/runners/system/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"strings"
"time"

"github.com/google/uuid"
"gopkg.in/yaml.v3"

"github.com/elastic/elastic-integration-corpus-generator-tool/pkg/genlib"
Expand All @@ -26,6 +25,7 @@ import (

"github.com/elastic/elastic-package/internal/benchrunner"
"github.com/elastic/elastic-package/internal/benchrunner/reporters"
"github.com/elastic/elastic-package/internal/benchrunner/runners/common"
"github.com/elastic/elastic-package/internal/configuration/locations"
"github.com/elastic/elastic-package/internal/elasticsearch"
"github.com/elastic/elastic-package/internal/kibana"
Expand Down Expand Up @@ -136,7 +136,7 @@ func (r *runner) setUp() error {
serviceLogsDir := locationManager.ServiceLogDir()
r.ctxt.Logs.Folder.Local = serviceLogsDir
r.ctxt.Logs.Folder.Agent = ServiceLogsAgentDir
r.ctxt.Test.RunID = createRunID()
r.ctxt.Test.RunID = common.NewRunID()

outputDir, err := servicedeployer.CreateOutputDir(locationManager, r.ctxt.Test.RunID)
if err != nil {
Expand Down Expand Up @@ -173,7 +173,7 @@ func (r *runner) setUp() error {
logger.Debug("deleting old data in data stream...")
dataStreamManifest, err := packages.ReadDataStreamManifest(
filepath.Join(
getDataStreamPath(r.options.PackageRootPath, r.scenario.DataStream.Name),
common.DataStreamPath(r.options.PackageRootPath, r.scenario.DataStream.Name),
packages.DataStreamManifestFile,
),
)
Expand Down Expand Up @@ -994,11 +994,3 @@ func waitUntilTrue(fn func() (bool, error), timeout time.Duration) (bool, error)
}
}
}

func createRunID() string {
return uuid.New().String()
}

func getDataStreamPath(packageRoot, dataStream string) string {
return filepath.Join(packageRoot, "data_stream", dataStream)
}