-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run system tests in parallel #1909
Changes from 41 commits
ecfe60c
bc822c7
ef1383c
85eb196
4e928a0
7719ea8
cfb1905
a68f6fd
ac95e8b
fa31ae5
4c926bf
ae89c2e
c36f4bd
3213751
06d5b77
74bdd72
b50f5cd
37f8d44
f608d06
e642460
6107bca
d6113ba
2cdeacf
5c8f500
b84c8dc
a8e1ee1
80c231c
37ee89a
c933c0d
9758666
1c4b9cf
419f8ea
d579fb7
d8a16e9
94b533f
7b52032
a3c7288
3cc537d
e891842
5f04b26
59f7ef9
ec7cb78
8d8fb5d
9a228b9
a47379e
f9ffd44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -370,29 +370,33 @@ func (p *Project) WaitForHealthy(ctx context.Context, opts CommandOptions) error | |
} | ||
|
||
for _, containerDescription := range descriptions { | ||
logger.Debugf("Container status: %s", containerDescription.String()) | ||
|
||
// No healthcheck defined for service | ||
if containerDescription.State.Status == "running" && containerDescription.State.Health == nil { | ||
logger.Debugf("Container %s status: %s (no health status)", containerDescription.ID, containerDescription.State.Status) | ||
continue | ||
} | ||
|
||
// Service is up and running and it's healthy | ||
if containerDescription.State.Status == "running" && containerDescription.State.Health.Status == "healthy" { | ||
logger.Debugf("Container %s status: %s (health: %s)", containerDescription.ID, containerDescription.State.Status, containerDescription.State.Health.Status) | ||
continue | ||
} | ||
|
||
// Container started and finished with exit code 0 | ||
if containerDescription.State.Status == "exited" && containerDescription.State.ExitCode == 0 { | ||
logger.Debugf("Container %s status: %s (exit code: %d)", containerDescription.ID, containerDescription.State.Status, containerDescription.State.ExitCode) | ||
continue | ||
} | ||
|
||
// Container exited with code > 0 | ||
if containerDescription.State.Status == "exited" && containerDescription.State.ExitCode > 0 { | ||
logger.Debugf("Container %s status: %s (exit code: %d)", containerDescription.ID, containerDescription.State.Status, containerDescription.State.ExitCode) | ||
return fmt.Errorf("container (ID: %s) exited with code %d", containerDescription.ID, containerDescription.State.ExitCode) | ||
} | ||
|
||
// Any different status is considered unhealthy | ||
logger.Debugf("Container %s status: unhealthy", containerDescription.ID) | ||
Comment on lines
+376
to
+399
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Examples of logs withthese changes:
Previously:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe these logs are too verbose? But we can leave them and update later when/if we add the trace debug level. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean to keep the previous log messages ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean to leave it as is now in the PR, and reduce later when we have more log levels. |
||
healthy = false | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,7 +118,8 @@ func (c *Client) waitUntilPolicyAssigned(ctx context.Context, a Agent, p Policy) | |
if err != nil { | ||
return fmt.Errorf("can't get the agent: %w", err) | ||
} | ||
logger.Debugf("Agent data: %s", agent.String()) | ||
logger.Debugf("Agent %s (Host: %s): Policy ID %s LogLevel: %s Status: %s", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably it could be improved better these logs (removing some field?) Example of new logs:
Previously:
|
||
agent.ID, agent.LocalMetadata.Host.Name, agent.PolicyID, agent.LocalMetadata.Elastic.Agent.LogLevel, agent.Status) | ||
|
||
if agent.PolicyID == p.ID && agent.PolicyRevision >= p.Revision { | ||
logger.Debugf("Policy revision assigned to the agent (ID: %s)...", a.ID) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License; | ||
// you may not use this file except in compliance with the Elastic License. | ||
|
||
package testrunner | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/elastic/go-ucfg" | ||
"github.com/elastic/go-ucfg/yaml" | ||
) | ||
|
||
type globalTestConfig struct { | ||
Asset GlobalRunnerTestConfig `config:"asset"` | ||
Pipeline GlobalRunnerTestConfig `config:"pipeline"` | ||
Policy GlobalRunnerTestConfig `config:"policy"` | ||
Static GlobalRunnerTestConfig `config:"static"` | ||
System GlobalRunnerTestConfig `config:"system"` | ||
} | ||
|
||
type GlobalRunnerTestConfig struct { | ||
Parallel bool `config:"parallel"` | ||
SkippableConfig `config:",inline"` | ||
} | ||
|
||
func ReadGlobalTestConfig(packageRootPath string) (*globalTestConfig, error) { | ||
configFilePath := filepath.Join(packageRootPath, "_dev", "test", "config.yml") | ||
|
||
data, err := os.ReadFile(configFilePath) | ||
if errors.Is(err, os.ErrNotExist) { | ||
return &globalTestConfig{}, nil | ||
} | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to read %s: %w", configFilePath, err) | ||
} | ||
|
||
var c globalTestConfig | ||
cfg, err := yaml.NewConfig(data, ucfg.PathSep(".")) | ||
if err != nil { | ||
return nil, fmt.Errorf("unable to load global test configuration file: %s: %w", configFilePath, err) | ||
} | ||
if err := cfg.Unpack(&c); err != nil { | ||
return nil, fmt.Errorf("unable to unpack global test configuration file: %s: %w", configFilePath, err) | ||
} | ||
|
||
return &c, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If package has enabled system tests in parallel, those tests will be triggered using 3 routines as maximum.