Skip to content

Commit 2657ada

Browse files
committed
Fix Fleet log level integration test
1 parent 4973844 commit 2657ada

File tree

2 files changed

+211
-189
lines changed

2 files changed

+211
-189
lines changed

pkg/testing/fixture.go

+10
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,16 @@ func (f *Fixture) PrepareAgentCommand(ctx context.Context, args []string, opts .
665665
return nil, fmt.Errorf("failed to prepare before exec: %w", err)
666666
}
667667

668+
// prepare a client if it's not already set
669+
if f.c == nil {
670+
cAddr, err := control.AddressFromPath(f.operatingSystem, f.workDir)
671+
if err != nil {
672+
return nil, fmt.Errorf("failed to get control protcol address: %w", err)
673+
}
674+
agentClient := client.New(client.WithAddress(cAddr))
675+
f.setClient(agentClient)
676+
}
677+
668678
// #nosec G204 -- Not so many ways to support variadic arguments to the elastic-agent command :(
669679
cmd := exec.CommandContext(ctx, f.binaryPath(), args...)
670680
for _, o := range opts {

0 commit comments

Comments
 (0)