Skip to content

Commit

Permalink
[Elastic Agent] improve CI reporting (elastic#20780)
Browse files Browse the repository at this point in the history
The elastic agent used to be in his own repository and didn't have
access to the beats toolchains and setup like testings. This PR move the
custom mage test:unit implement to use the devtools' implementations.

This changes will allow CI to correctly generates reports for failures.

Fixes: elastic#19822
  • Loading branch information
ph authored Aug 25, 2020
1 parent 2b3f7d5 commit 930c5f1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions x-pack/elastic-agent/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package main

import (
"context"
"errors"
"fmt"
"os"
Expand Down Expand Up @@ -236,13 +237,10 @@ func (Test) All() {
}

// Unit runs all the unit tests.
func (Test) Unit() error {
func (Test) Unit(ctx context.Context) error {
mg.Deps(Prepare.Env, Build.TestBinaries)
raceFlag := ""
if os.Getenv("DEV_ARCH") == "amd64" {
raceFlag = "-race"
}
return RunGo("test", raceFlag, "-v", "-coverprofile", filepath.Join(buildDir, "coverage.out"), "./...")
params := devtools.DefaultGoTestUnitArgs()
return devtools.GoTest(ctx, params)
}

// Coverage takes the coverages report from running all the tests and display the results in the browser.
Expand Down

0 comments on commit 930c5f1

Please sign in to comment.