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

Remove the agent config file parameters for stand alone #983

Merged
merged 2 commits into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions cli/config/compose/services/elastic-agent/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,3 @@ services:
platform: ${elasticAgentPlatform:-linux/amd64}
ports:
- "127.0.0.1:8220:8220"
volumes:
- "${elasticAgentConfigFile}:/usr/share/elastic-agent/elastic-agent.yml"
33 changes: 4 additions & 29 deletions e2e/_suites/fleet/stand-alone.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package main
import (
"context"
"fmt"
"os"
"strings"
"time"

Expand All @@ -22,10 +21,9 @@ import (

// StandAloneTestSuite represents the scenarios for Stand-alone-mode
type StandAloneTestSuite struct {
AgentConfigFilePath string
Cleanup bool
Hostname string
Image string
Cleanup bool
Hostname string
Image string
// date controls for queries
AgentStoppedDate time.Time
RuntimeDependenciesStartDate time.Time
Expand All @@ -45,21 +43,6 @@ func (sats *StandAloneTestSuite) afterScenario() {
} else {
log.WithField("service", serviceName).Info("Because we are running in development mode, the service won't be stopped")
}

if _, err := os.Stat(sats.AgentConfigFilePath); err == nil {
beatsLocalPath := shell.GetEnv("BEATS_LOCAL_PATH", "")
if beatsLocalPath == "" {
os.Remove(sats.AgentConfigFilePath)

log.WithFields(log.Fields{
"path": sats.AgentConfigFilePath,
}).Trace("Elastic Agent configuration file removed.")
} else {
log.WithFields(log.Fields{
"path": sats.AgentConfigFilePath,
}).Trace("Elastic Agent configuration file not removed because it's part of a repository.")
}
}
}

func (sats *StandAloneTestSuite) contributeSteps(s *godog.ScenarioContext) {
Expand Down Expand Up @@ -102,11 +85,6 @@ func (sats *StandAloneTestSuite) startAgent(image string, env map[string]string)
dockerImageTag += "-amd64"
}

configurationFilePath, err := steps.FetchBeatConfiguration(true, "elastic-agent", "elastic-agent.docker.yml")
mdelapenya marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return err
}

serviceManager := services.NewServiceManager()

profileEnv["elasticAgentDockerImageSuffix"] = ""
Expand All @@ -118,18 +96,15 @@ func (sats *StandAloneTestSuite) startAgent(image string, env map[string]string)

containerName := fmt.Sprintf("%s_%s_%d", FleetProfileName, ElasticAgentServiceName, 1)

sats.AgentConfigFilePath = configurationFilePath

profileEnv["elasticAgentContainerName"] = containerName
profileEnv["elasticAgentConfigFile"] = sats.AgentConfigFilePath
profileEnv["elasticAgentPlatform"] = "linux/amd64"
profileEnv["elasticAgentTag"] = dockerImageTag

for k, v := range env {
profileEnv[k] = v
}

err = serviceManager.AddServicesToCompose(context.Background(), FleetProfileName, []string{ElasticAgentServiceName}, profileEnv)
err := serviceManager.AddServicesToCompose(context.Background(), FleetProfileName, []string{ElasticAgentServiceName}, profileEnv)
if err != nil {
log.Error("Could not deploy the elastic-agent")
return err
Expand Down