Skip to content
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

[CI] [Don't merge yet] Integration tests regrouping #6349

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
21 changes: 15 additions & 6 deletions .buildkite/bk.integration.pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ steps:
matrix:
- default
- fleet
- fleet-endpoint-security
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ordering in these matrix lists looks arbitrary. Is there a reason for the ordering, or should we have them sorted alphabetically?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, there are no ordering rules. Just placed fleet groups together

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you going to sort them? If the order doesn't matter, I think it'd be a better user experience when engineers are scrolling through the results of a BK job to have them alphabetical. Plus it would make these lists more easily maintainable (until we figure out making the groups/matrix dynamic).

- fleet-privileged
- standalone-upgrade
- upgrade
- install-uninstall

- label: "Win2022:non-sudo:{{matrix}}"
command: |
Expand Down Expand Up @@ -89,15 +92,18 @@ steps:
image: "family/platform-ingest-elastic-agent-ubuntu-2404"
matrix:
- default
- standalone-upgrade
- install-uninstall
- container
- fleet-upgrade-to-pr-build
- upgrade
- fleet
- fqdn
- deb
- fleet-endpoint-security
- fleet-airgapped
- fleet-privileged
- fleet-airgapped-privileged
- fleet-privileged
- fleet-upgrade-to-pr-build
- fqdn
- deb

- label: "arm:sudo: {{matrix}}"
skip: true
Expand All @@ -113,15 +119,18 @@ steps:
instanceType: "m6g.2xlarge"
matrix:
- default
- standalone-upgrade
- install-uninstall
- container
- fleet-upgrade-to-pr-build
- upgrade
- fleet
- fqdn
- deb
- fleet-endpoint-security
- fleet-airgapped
- fleet-privileged
- fleet-airgapped-privileged
- fqdn
- deb

- label: "arm:non-sudo: {{matrix}}"
skip: true
Expand Down
18 changes: 9 additions & 9 deletions testing/integration/endpoint_security_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ var protectionTests = []struct {
// test automatically.
func TestInstallAndCLIUninstallWithEndpointSecurity(t *testing.T) {
info := define.Require(t, define.Requirements{
Group: Fleet,
Group: FleetEndpointSecurity,
Stack: &define.Stack{},
Local: false, // requires Agent installation
Sudo: true, // requires Agent installation
Expand All @@ -96,7 +96,7 @@ func TestInstallAndCLIUninstallWithEndpointSecurity(t *testing.T) {
// but at this point endpoint is already uninstalled.
func TestInstallAndUnenrollWithEndpointSecurity(t *testing.T) {
info := define.Require(t, define.Requirements{
Group: Fleet,
Group: FleetEndpointSecurity,
Stack: &define.Stack{},
Local: false, // requires Agent installation
Sudo: true, // requires Agent installation
Expand Down Expand Up @@ -124,7 +124,7 @@ func TestInstallAndUnenrollWithEndpointSecurity(t *testing.T) {
// but at this point endpoint should be already uninstalled.
func TestInstallWithEndpointSecurityAndRemoveEndpointIntegration(t *testing.T) {
info := define.Require(t, define.Requirements{
Group: Fleet,
Group: FleetEndpointSecurity,
Stack: &define.Stack{},
Local: false, // requires Agent installation
Sudo: true, // requires Agent installation
Expand Down Expand Up @@ -399,7 +399,7 @@ type agentPolicyUpdateRequest struct {
// path other than default
func TestEndpointSecurityNonDefaultBasePath(t *testing.T) {
info := define.Require(t, define.Requirements{
Group: Fleet,
Group: FleetEndpointSecurity,
Stack: &define.Stack{},
Local: false, // requires Agent installation
Sudo: true, // requires Agent installation
Expand Down Expand Up @@ -470,7 +470,7 @@ func TestEndpointSecurityNonDefaultBasePath(t *testing.T) {
// Tests that install of Elastic Defend fails if Agent is installed unprivileged.
func TestEndpointSecurityUnprivileged(t *testing.T) {
info := define.Require(t, define.Requirements{
Group: Fleet,
Group: FleetEndpointSecurity,
Stack: &define.Stack{},
Local: false, // requires Agent installation
Sudo: true, // requires Agent installation
Expand Down Expand Up @@ -550,7 +550,7 @@ func TestEndpointSecurityUnprivileged(t *testing.T) {
// Tests that trying to switch from privileged to unprivileged with Elastic Defend fails.
func TestEndpointSecurityCannotSwitchToUnprivileged(t *testing.T) {
info := define.Require(t, define.Requirements{
Group: Fleet,
Group: FleetEndpointSecurity,
Stack: &define.Stack{},
Local: false, // requires Agent installation
Sudo: true, // requires Agent installation
Expand Down Expand Up @@ -620,7 +620,7 @@ func TestEndpointSecurityCannotSwitchToUnprivileged(t *testing.T) {
// TestEndpointLogsAreCollectedInDiagnostics tests that diagnostics archive contain endpoint logs
func TestEndpointLogsAreCollectedInDiagnostics(t *testing.T) {
info := define.Require(t, define.Requirements{
Group: Fleet,
Group: FleetEndpointSecurity,
Stack: &define.Stack{},
Local: false, // requires Agent installation
Sudo: true, // requires Agent installation
Expand Down Expand Up @@ -838,7 +838,7 @@ func agentIsHealthyNoEndpoint(t *testing.T, ctx context.Context, agentClient cli
// when an installed agent is running a policy with tamper protection enabled fails.
func TestForceInstallOverProtectedPolicy(t *testing.T) {
info := define.Require(t, define.Requirements{
Group: Fleet,
Group: FleetEndpointSecurity,
Stack: &define.Stack{},
Local: false, // requires Agent installation
Sudo: true, // requires Agent installation
Expand Down Expand Up @@ -904,7 +904,7 @@ func TestForceInstallOverProtectedPolicy(t *testing.T) {

func TestInstallDefendWithMTLSandEncCertKey(t *testing.T) {
stack := define.Require(t, define.Requirements{
Group: Fleet,
Group: FleetEndpointSecurity,
Stack: &define.Stack{},
Local: false, // requires Agent installation
Sudo: true, // requires Agent installation
Expand Down
9 changes: 9 additions & 0 deletions testing/integration/groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,18 @@ const (
// Upgrade group of tests. Used for testing upgrades.
Upgrade = "upgrade"

// StandaloneUpgrade group of tests. Used for TestStandaloneUpgrade.
StandaloneUpgrade = "standalone-upgrade"

// Deb group of tests. Used for testing .deb packages install & upgrades
Deb = "deb"

// RPM group of tests. Used for testing .rpm packages install & upgrades
RPM = "rpm"

// InstallUninstall group of tests. Used for testing repeated install & uninstall scenarios
InstallUninstall = "install-uninstall"

// FleetInstall group of tests. Used for the long running fleet-related "TestInstall..." tests.
FleetEndpointSecurity = "fleet-endpoint-security"
)
12 changes: 9 additions & 3 deletions testing/integration/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ func testUninstallAuditUnenroll(ctx context.Context, fixture *atesting.Fixture,
// into Fleet. Current testing shows each iteration takes around 16 seconds.
func TestRepeatedInstallUninstallFleet(t *testing.T) {
info := define.Require(t, define.Requirements{
Group: Fleet,
Group: InstallUninstall,
Stack: &define.Stack{}, // needs a fleet-server.
// We require sudo for this test to run
// `elastic-agent install` (even though it will
Expand Down Expand Up @@ -499,8 +499,7 @@ func TestRepeatedInstallUninstallFleet(t *testing.T) {
require.NoError(t, err)

maxRunTime := 2 * time.Minute
iterations := 100
for i := 0; i < iterations; i++ {
for i := 0; i < iterations(); i++ {
successful := t.Run(fmt.Sprintf("%s-%d", t.Name(), i), func(t *testing.T) {
ctx, cancel := testcontext.WithDeadline(t, context.Background(), time.Now().Add(maxRunTime))
defer cancel()
Expand Down Expand Up @@ -540,6 +539,13 @@ func TestRepeatedInstallUninstallFleet(t *testing.T) {
}
}

func iterations() int {
if os.Getenv("BUILDKITE_PULL_REQUEST") != "" {
return 50
}
Comment on lines +544 to +546
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This deserves a comment in my opinion.

return 100
}

func randStr(length int) string {
var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")

Expand Down
2 changes: 1 addition & 1 deletion testing/integration/upgrade_standalone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

func TestStandaloneUpgrade(t *testing.T) {
define.Require(t, define.Requirements{
Group: Upgrade,
Group: StandaloneUpgrade,
Local: false, // requires Agent installation
Sudo: true, // requires Agent installation
})
Expand Down
Loading