Skip to content

Commit

Permalink
more debug prints
Browse files Browse the repository at this point in the history
  • Loading branch information
faec committed Apr 2, 2024
1 parent ff4f331 commit 37a5cd2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
11 changes: 10 additions & 1 deletion dev-tools/mage/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,19 @@ func dockerInfo() (*DockerInfo, error) {
// HaveDockerCompose returns an error if docker-compose is not found on the
// PATH.
func HaveDockerCompose() error {
_, err := exec.LookPath("docker-compose")

path, err := exec.LookPath("docker")
if err != nil {
return fmt.Errorf("docker is not available")
} else {
fmt.Printf("hi fae, docker is at %v\n", path)
}

path, err = exec.LookPath("docker-compose")
if err != nil {
return fmt.Errorf("docker-compose is not available")
}
fmt.Printf("hi fae, docker compose is %v\n", path)
return nil
}

Expand Down
3 changes: 3 additions & 0 deletions dev-tools/mage/integtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ func NewIntegrationRunners(path string, passInEnv map[string]string) (Integratio

// NewDockerIntegrationRunner returns an integration runner configured only for docker.
func NewDockerIntegrationRunner(passThroughEnvVars ...string) (*IntegrationRunner, error) {
fmt.Printf("hi fae, NewDockerIntegrationRunner\n")
cwd, err := os.Getwd()
if err != nil {
return nil, err
Expand All @@ -223,9 +224,11 @@ func NewDockerIntegrationRunner(passThroughEnvVars ...string) (*IntegrationRunne
}

func initRunner(tester IntegrationTester, dir string, passInEnv map[string]string, passThroughEnvVars ...string) (*IntegrationRunner, error) {
fmt.Printf("hi fae, initRunner\n")
var runnerSteps IntegrationTestSteps
requirements := tester.StepRequirements()
if requirements != nil {
fmt.Printf("hi fae, requirements: %v\n", requirements.Name())
runnerSteps = append(runnerSteps, requirements...)
}

Expand Down
4 changes: 4 additions & 0 deletions dev-tools/mage/integtest_docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,15 @@ func (d *DockerIntegrationTester) Use(dir string) (bool, error) {

// HasRequirements ensures that the required docker and docker-compose are installed.
func (d *DockerIntegrationTester) HasRequirements() error {
fmt.Printf("hi fae, in DockerIntegrationTester.HasRequirements\n")
if err := HaveDocker(); err != nil {
return err
}
if err := HaveDockerCompose(); err != nil {
return err
}
fmt.Printf("everything passed\n")
os.Exit(1)
return nil
}

Expand All @@ -88,6 +91,7 @@ func (d *DockerIntegrationTester) StepRequirements() IntegrationTestSteps {
// Test performs the tests with docker-compose. The compose file must define a "beat" container,
// containing the beats development environment. The tests are executed from within this container.
func (d *DockerIntegrationTester) Test(dir string, mageTarget string, env map[string]string) error {
fmt.Printf("hi fae, DockerIntegrationTester.Test\n")
var err error
buildContainersOnce.Do(func() { err = BuildIntegTestContainers() })
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions metricbeat/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func GoIntegTest(ctx context.Context) error {
// Use PYTEST_ADDOPTS="-k pattern" to only run tests matching the specified pattern.
// Use any other PYTEST_* environment variable to influence the behavior of pytest.
func PythonIntegTest(ctx context.Context) error {
fmt.Printf("hi fae\n")
fmt.Printf("hi fae, starting PythonIntegTest\n")
if !devtools.IsInIntegTestEnv() {
fmt.Printf("!IsInIntegTestEnv\n")
mg.SerialDeps(Fields, Dashboards)
Expand All @@ -236,7 +236,7 @@ func PythonIntegTest(ctx context.Context) error {
[]string{"ELASTICSEARCH_VERSION", "KIBANA_VERSION", "BEAT_VERSION"},
devtools.ListMatchingEnvVars("PYTEST_")...,
)
fmt.Printf("env vars: %v\n", passThroughEnvVars)
fmt.Printf("hi fae, env vars: %v\n", passThroughEnvVars)
//os.Exit(1)
runner, err := devtools.NewDockerIntegrationRunner(passThroughEnvVars...)
if err != nil {
Expand Down

0 comments on commit 37a5cd2

Please sign in to comment.