Skip to content

Commit

Permalink
test: cleanup systemtest init (#12448)
Browse files Browse the repository at this point in the history
we don't need to upload apmpackage so we can cleanup the init code.
Avoid cleaning es during init, it should be cleaned in specific tests to
support the -count flag.
  • Loading branch information
kruskall authored Jun 14, 2024
1 parent 7c920ea commit a1657d5
Showing 1 changed file with 3 additions and 37 deletions.
40 changes: 3 additions & 37 deletions systemtest/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,49 +18,15 @@
package systemtest

import (
"fmt"
"log"
"os"
"testing"

"golang.org/x/sync/errgroup"
)

func TestMain(m *testing.M) {
var errg errgroup.Group

errg.Go(func() error {
log.Println("INFO: starting stack containers...")
if err := StartStackContainers(); err != nil {
return fmt.Errorf("failed to start stack containers: %w", err)
}
return nil
})

if err := errg.Wait(); err != nil {
log.Fatal(err)
}

errg.Go(func() error {
log.Println("INFO: cleaning up Elasticsearch...")
if err := cleanupElasticsearch(); err != nil {
return fmt.Errorf("failed to cleanup Elasticsearch: %w", err)
}

return nil
})

errg.Go(func() error {
log.Println("INFO: setting up fleet...")
if err := InitFleet(); err != nil {
return fmt.Errorf("failed to setup fleet: %w", err)
}

return nil
})

if err := errg.Wait(); err != nil {
log.Fatal(err)
log.Println("INFO: starting stack containers...")
if err := StartStackContainers(); err != nil {
log.Fatalf("failed to start stack containers: %v", err)
}

log.Println("INFO: running system tests...")
Expand Down

0 comments on commit a1657d5

Please sign in to comment.