@@ -18,6 +18,8 @@ import (
1818 "sync"
1919 "testing"
2020
21+ "github.com/stretchr/testify/require"
22+
2123 "github.com/gofrs/uuid/v5"
2224
2325 "github.com/elastic/elastic-agent-libs/kibana"
@@ -83,13 +85,13 @@ func Version() string {
8385// NewFixtureFromLocalBuild returns a new Elastic Agent testing fixture with a LocalFetcher and
8486// the agent logging to the test logger.
8587func NewFixtureFromLocalBuild (t * testing.T , version string , opts ... atesting.FixtureOpt ) (* atesting.Fixture , error ) {
86- return NewFixtureWithBinary (t , version , "elastic-agent" , buildsDir (), false , opts ... )
88+ return NewFixtureWithBinary (t , version , "elastic-agent" , buildsDir (t ), false , opts ... )
8789}
8890
8991// NewFixtureFromLocalFIPSBuild returns a new FIPS-capable Elastic Agent testing fixture with a LocalFetcher
9092// and the agent logging to the test logger.
9193func NewFixtureFromLocalFIPSBuild (t * testing.T , version string , opts ... atesting.FixtureOpt ) (* atesting.Fixture , error ) {
92- return NewFixtureWithBinary (t , version , "elastic-agent" , buildsDir (), true , opts ... )
94+ return NewFixtureWithBinary (t , version , "elastic-agent" , buildsDir (t ), true , opts ... )
9395}
9496
9597// NewFixtureWithBinary returns a new Elastic Agent testing fixture with a LocalFetcher and
@@ -300,13 +302,13 @@ func getKibanaClient() (*kibana.Client, error) {
300302 return c , nil
301303}
302304
303- func buildsDir () string {
305+ func buildsDir (t * testing.T ) string {
306+ t .Helper ()
307+
304308 buildsDir := os .Getenv ("AGENT_BUILD_DIR" )
305309 if buildsDir == "" {
306310 projectDir , err := findProjectRoot ()
307- if err != nil {
308- return nil , err
309- }
311+ require .NoError (t , err )
310312 buildsDir = filepath .Join (projectDir , "build" , "distributions" )
311313 }
312314
0 commit comments