Skip to content

Update package name used in test folders - Asset runner #2517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2025
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
4 changes: 3 additions & 1 deletion internal/testrunner/runners/asset/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package asset

import (
"context"
"path/filepath"

"github.com/elastic/elastic-package/internal/kibana"
"github.com/elastic/elastic-package/internal/testrunner"
Expand Down Expand Up @@ -60,11 +61,12 @@ func (r *runner) TearDownRunner(ctx context.Context) error {
}

func (r *runner) GetTests(ctx context.Context) ([]testrunner.Tester, error) {
_, pkg := filepath.Split(r.packageRootPath)
testers := []testrunner.Tester{
NewAssetTester(AssetTesterOptions{
PackageRootPath: r.packageRootPath,
KibanaClient: r.kibanaClient,
TestFolder: testrunner.TestFolder{Package: r.packageRootPath},
TestFolder: testrunner.TestFolder{Package: pkg},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same change that it is applied in other test runners or testers:

for _, dataStream := range dataStreams {
folders = append(folders, TestFolder{
Path: filepath.Join(dataStreamsPath, dataStream, "_dev", "test", string(testType)),
Package: filepath.Base(packageRootPath),
DataStream: dataStream,
})
}

_, pkg := filepath.Split(packageRootPath)
for idx, p := range paths {
dataStream := ExtractDataStreamFromPath(p, packageRootPath)
folder := TestFolder{
Path: p,
Package: pkg,
DataStream: dataStream,
}
folders[idx] = folder
}

GlobalTestConfig: r.globalTestConfig,
WithCoverage: r.withCoverage,
CoverageType: r.coverageType,
Expand Down
2 changes: 1 addition & 1 deletion internal/testrunner/runners/asset/tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (r *tester) run(ctx context.Context) ([]testrunner.TestResult, error) {
for _, e := range expectedAssets {
rc := testrunner.NewResultComposer(testrunner.TestResult{
Name: fmt.Sprintf("%s %s is loaded", e.Type, e.ID),
Package: installedPackage.Name,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

installedPackage.Name is the name set in the manifest.yml , but this could be different from the package folder name. As it happens, for instance, with the sql_input package in the integrations repository (link):

  • Folder name: sql_input
  • Package name in the manifest: sql

Package: r.testFolder.Package,
DataStream: e.DataStream,
TestType: TestType,
})
Expand Down