Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Commit 69fa7cf

Browse files
adam-stokesmergify-bot
authored andcommitted
v2 refactor (#1008)
* Move kibana into internals, update fleet test suite * migrate docker-compose related code to internal layout * move docker related code to internal layout * move git related code to internal layout * move common attributes into internal common file system layout * move elasticsearch specifics into its own filesystem layout * move installer based code to internal layout * move shell related code to internal layout * move sanitizer code to internal layout * move io related code to internal layout * move utils into internal layout * Update package integration querying/altering * move curl to internal layout * move helm to internal layout * move kubectl into internal layout * move state internal filesystem * cleanup config in stand-alone * remove unused files * Uniquify the stand-alone step for checking agent status (#993) There were 2 steps identical in both the stand-alone and fleet test suites. Running the stand-alone test suite was picking up the step from the fleet test suite and trying to reference the FleetTestSuite structure which did not hold any of the agent information (like the hostname) for the stand alone tests. This fixes it so that the standalone test step is being referenced in the correct test suite. * Remove the agent config file parameters for stand alone (#983) * Update helm/metricbeat tests to use new layout * Fix policy endpoint update * fix panic on helm init * Fix step reference as this being merged seperately * Update function call to correct standalone step * Fix merge conflict * update ProfileEnv query/set for KibanaVersion * More fixes to agent endpoint security checks * update backend feature to call out endpoint in step * use common.TimeoutFactor in docker checkprocess state * Update adding endpoint integration * enable features for fleet server * not necessary to enroll after install * wait for filebeat/metricbeat before restarts * clear out fts.CurrentToken during beforeScenario * attach system integration on deploy * enroll if rpm * dont store fleet policy * update kibana config for latest fleet server * Update e2e/_suites/fleet/fleet.go * Update e2e/_suites/fleet/fleet.go * Update e2e/_suites/fleet/fleet.go * Update .pre-commit-config.yaml * Update e2e/Makefile * rename apt -> deb for installer type * execute docker start/stop with timeout between * fixes fleet_server scenario * Utilize fleet server in all tests * Fix enrollment url for fleet server * Query elasticsearch logs for endpoint security event changes * Increase search result size for ES * Fix issue with fleet server restarting continuously * unpin kibana pr now that most major breakage is resolved * force unenroll * for new fleet bootstrap on re-enrollment * Fix unenrollment * Add timeout safeguard to elastic-agent execution In some cases such as attempting to re-enroll with a revoked token, the elastic-agent will retry indefinitely. This fix adds a safeguard utilizing 'timeout' command prepended to the elastic-agent command so that it will timeout after TimeoutFactor Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com> (cherry picked from commit 5f59670) # Conflicts: # e2e/Makefile # e2e/_suites/fleet/ingest_manager_test.go # e2e/_suites/fleet/stand-alone.go # e2e/_suites/fleet/world.go
1 parent 6fad7eb commit 69fa7cf

62 files changed

Lines changed: 3789 additions & 2928 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cli/cmd/deploy.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"context"
99

1010
"github.com/elastic/e2e-testing/cli/config"
11-
"github.com/elastic/e2e-testing/cli/services"
11+
"github.com/elastic/e2e-testing/internal/compose"
1212
log "github.com/sirupsen/logrus"
1313

1414
"github.com/spf13/cobra"
@@ -63,7 +63,7 @@ func buildDeployServiceCommand(srv string) *cobra.Command {
6363
Short: `Deploys a ` + srv + ` service`,
6464
Long: `Deploys a ` + srv + ` service, adding it to a running profile, identified by its name`,
6565
Run: func(cmd *cobra.Command, args []string) {
66-
serviceManager := services.NewServiceManager()
66+
serviceManager := compose.NewServiceManager()
6767

6868
env := map[string]string{}
6969
env = config.PutServiceEnvironment(env, srv, versionToRun)
@@ -85,7 +85,7 @@ func buildUndeployServiceCommand(srv string) *cobra.Command {
8585
Short: `Undeploys a ` + srv + ` service`,
8686
Long: `Undeploys a ` + srv + ` service, removing it from a running profile, identified by its name`,
8787
Run: func(cmd *cobra.Command, args []string) {
88-
serviceManager := services.NewServiceManager()
88+
serviceManager := compose.NewServiceManager()
8989

9090
env := map[string]string{}
9191
env = config.PutServiceEnvironment(env, srv, versionToRun)

cli/cmd/run.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"strings"
1010

1111
"github.com/elastic/e2e-testing/cli/config"
12-
"github.com/elastic/e2e-testing/cli/services"
12+
"github.com/elastic/e2e-testing/internal/compose"
1313
log "github.com/sirupsen/logrus"
1414

1515
"github.com/spf13/cobra"
@@ -63,7 +63,7 @@ func buildRunServiceCommand(srv string) *cobra.Command {
6363
Short: `Runs a ` + srv + ` service`,
6464
Long: `Runs a ` + srv + ` service, spinning up a Docker container for it and exposing its internal configuration so that you are able to connect to it in an easy manner`,
6565
Run: func(cmd *cobra.Command, args []string) {
66-
serviceManager := services.NewServiceManager()
66+
serviceManager := compose.NewServiceManager()
6767

6868
env := config.PutServiceEnvironment(map[string]string{}, srv, versionToRun)
6969

@@ -91,7 +91,7 @@ func buildRunProfileCommand(key string, profile config.Profile) *cobra.Command {
9191
Short: `Runs the ` + profile.Name + ` profile`,
9292
Long: `Runs the ` + profile.Name + ` profile, spinning up the Services that compound it`,
9393
Run: func(cmd *cobra.Command, args []string) {
94-
serviceManager := services.NewServiceManager()
94+
serviceManager := compose.NewServiceManager()
9595

9696
env := map[string]string{
9797
"profileVersion": versionToRun,

cli/cmd/stop.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"context"
99

1010
"github.com/elastic/e2e-testing/cli/config"
11-
"github.com/elastic/e2e-testing/cli/services"
11+
"github.com/elastic/e2e-testing/internal/compose"
1212
log "github.com/sirupsen/logrus"
1313

1414
"github.com/spf13/cobra"
@@ -55,7 +55,7 @@ func buildStopServiceCommand(srv string) *cobra.Command {
5555
Short: `Stops a ` + srv + ` service`,
5656
Long: `Stops a ` + srv + ` service, stoppping its Docker container`,
5757
Run: func(cmd *cobra.Command, args []string) {
58-
serviceManager := services.NewServiceManager()
58+
serviceManager := compose.NewServiceManager()
5959

6060
err := serviceManager.StopCompose(context.Background(), false, []string{srv})
6161
if err != nil {
@@ -73,7 +73,7 @@ func buildStopProfileCommand(key string, profile config.Profile) *cobra.Command
7373
Short: `Stops the ` + profile.Name + ` profile`,
7474
Long: `Stops the ` + profile.Name + ` profile, stopping the Services that compound it`,
7575
Run: func(cmd *cobra.Command, args []string) {
76-
serviceManager := services.NewServiceManager()
76+
serviceManager := compose.NewServiceManager()
7777

7878
err := serviceManager.StopCompose(context.Background(), true, []string{key})
7979
if err != nil {

cli/cmd/sync.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import (
1313
"strings"
1414

1515
"github.com/elastic/e2e-testing/cli/config"
16-
git "github.com/elastic/e2e-testing/cli/internal"
17-
io "github.com/elastic/e2e-testing/cli/internal"
18-
"github.com/elastic/e2e-testing/cli/services"
16+
git "github.com/elastic/e2e-testing/internal/git"
17+
io "github.com/elastic/e2e-testing/internal/io"
18+
"github.com/elastic/e2e-testing/internal/sanitizer"
1919
log "github.com/sirupsen/logrus"
2020
"github.com/spf13/cobra"
2121

@@ -197,7 +197,7 @@ func copyIntegrationsComposeFiles(beats git.Project, pattern string, target stri
197197
}
198198

199199
type service interface{}
200-
type compose struct {
200+
type composeFile struct {
201201
Version string `yaml:"version"`
202202
Services map[string]service `yaml:"services"`
203203
}
@@ -212,7 +212,7 @@ func sanitizeComposeFile(composeFilePath string, targetFilePath string) error {
212212
return err
213213
}
214214

215-
c := compose{}
215+
c := composeFile{}
216216
err = yaml.Unmarshal(bytes, &c)
217217
if err != nil {
218218
log.WithFields(log.Fields{
@@ -276,7 +276,7 @@ func sanitizeConfigurationFile(serviceName string, configFilePath string) error
276276
// prepend modules header
277277
content = "metricbeat.modules:\n" + content
278278

279-
serviceSanitizer := services.GetConfigSanitizer(serviceName)
279+
serviceSanitizer := sanitizer.GetConfigSanitizer(serviceName)
280280
content = serviceSanitizer.Sanitize(content)
281281

282282
log.WithFields(log.Fields{

cli/cmd/sync_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"testing"
77

88
"github.com/Flaque/filet"
9-
io "github.com/elastic/e2e-testing/cli/internal"
9+
"github.com/elastic/e2e-testing/internal/io"
1010
"github.com/stretchr/testify/assert"
1111
"gopkg.in/yaml.v2"
1212
)
@@ -28,7 +28,7 @@ func TestSanitizeComposeFile_Multiple(t *testing.T) {
2828
bytes, err := io.ReadFile(target)
2929
assert.Nil(t, err)
3030

31-
c := compose{}
31+
c := composeFile{}
3232
err = yaml.Unmarshal(bytes, &c)
3333
assert.Nil(t, err)
3434

@@ -73,7 +73,7 @@ func TestSanitizeComposeFile_Single(t *testing.T) {
7373
bytes, err := io.ReadFile(target)
7474
assert.Nil(t, err)
7575

76-
c := compose{}
76+
c := composeFile{}
7777
err = yaml.Unmarshal(bytes, &c)
7878
assert.Nil(t, err)
7979

cli/config/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
"path/filepath"
1212
"strings"
1313

14-
io "github.com/elastic/e2e-testing/cli/internal"
15-
shell "github.com/elastic/e2e-testing/cli/shell"
14+
io "github.com/elastic/e2e-testing/internal/io"
15+
shell "github.com/elastic/e2e-testing/internal/shell"
1616

1717
packr "github.com/gobuffalo/packr/v2"
1818
homedir "github.com/mitchellh/go-homedir"

cli/config/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"strings"
1212
"testing"
1313

14-
io "github.com/elastic/e2e-testing/cli/internal"
14+
"github.com/elastic/e2e-testing/internal/io"
1515

1616
"github.com/Flaque/filet"
1717
"github.com/sirupsen/logrus"

0 commit comments

Comments
 (0)