Skip to content

Commit

Permalink
ROX-25477: Exercise integration tests on large nodes (#1763)
Browse files Browse the repository at this point in the history
A node with large number of CPU cores is an important edge case for
Collector. Run integration tests on such a setup if requested
explicitely or by schedule.

Add a new integration test, which when invoked on a machine with large
number of CPU cores will test the ring buffer adjustment, in particular
that the final adjusted value land in an allowed interval of power of
two.
  • Loading branch information
erthalion authored Aug 22, 2024
1 parent 0eea6ea commit 18fbe60
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ on:
tests
type: boolean
default: false
large-box:
description: |
Marker for workflows that suppose to run tests on nodes with large
number of CPU cores.
type: boolean
default: false

jobs:
amd64-integration-tests:
Expand Down Expand Up @@ -64,6 +70,25 @@ jobs:
collector-repo: ${{ inputs.collector-repo }}
secrets: inherit

amd64-integration-tests-large-box:
uses: ./.github/workflows/integration-tests-vm-type.yml
if: contains(github.event.pull_request.labels.*.name, 'large-box-integration-tests') || inputs.large-box
strategy:
# ensure that if one part of the matrix fails, the
# rest will continue
fail-fast: false
matrix:
vm_type:
- fedora-coreos-large-node
with:
vm_type: ${{ matrix.vm_type }}
collector-tag: ${{ inputs.collector-tag }}
collector-qa-tag: ${{ inputs.collector-qa-tag }}
collector-tests-tag: ${{ inputs.collector-tests-tag }}
job-tag: ${{ inputs.job-tag }}
collector-repo: ${{ inputs.collector-repo }}
secrets: inherit

arm64-integration-tests:
uses: ./.github/workflows/integration-tests-vm-type.yml
if: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Main collector CI
on:
schedule:
- cron: 0 6 * * *
- cron: 0 0 * * 0 # for infrequent tests on a large box
push:
branches:
- master
Expand Down Expand Up @@ -96,6 +97,7 @@ jobs:
collector-tag: ${{ needs.init.outputs.collector-tag }}
collector-qa-tag: ${{ needs.init.outputs.collector-qa-tag }}
collector-tests-tag: ${{ needs.build-test-containers.outputs.collector-tests-tag }}
large-box: ${{ github.event.schedule == '0 0 * * 0' }}
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-integration-tests') }}
needs:
- init
Expand Down
7 changes: 7 additions & 0 deletions ansible/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ virtual_machines:
families:
- fedora-coreos-stable

fedora-coreos-large-node:
project: fedora-coreos-cloud
machine_type: n2-standard-128
username: core
families:
- fedora-coreos-stable

# This should be 'fedora-coreos-arm64', but because of
# GCP VM name length restrictions, we need it to be shorter
fcarm:
Expand Down
4 changes: 4 additions & 0 deletions ansible/group_vars/platform_fedora_coreos_large_node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
ansible_user: core

needs_selinux_permissive: true
4 changes: 4 additions & 0 deletions integration-tests/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,3 +530,7 @@ func TestPerfEvent(t *testing.T) {
func TestGperftools(t *testing.T) {
suite.Run(t, new(suites.GperftoolsTestSuite))
}

func TestRingBuffer(t *testing.T) {
suite.Run(t, new(suites.RingBufferTestSuite))
}
31 changes: 31 additions & 0 deletions integration-tests/suites/ringbuf.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package suites

import "github.com/stackrox/collector/integration-tests/pkg/collector"

type RingBufferTestSuite struct {
IntegrationTestSuiteBase
}

func (s *RingBufferTestSuite) SetupSuite() {
// Set the totall allowed ring buffer size to 400Mb. On a box with 128 CPU
// cores this should trigger an adjustment making the singular ring buffer
// size 2Mb (without the power-of-two alignment it would be an invalid
// value of 3Mb)
collectorOptions := collector.StartupOptions{
Env: map[string]string{
"ROX_COLLECTOR_SINSP_TOTAL_BUFFER_SIZE": "419430400",
},
}

s.StartCollector(false, &collectorOptions)
}

func (s *RingBufferTestSuite) TearDownSuite() {
s.StopCollector()
}

func (s *RingBufferTestSuite) TestCollectorRunning() {
running, err := s.executor.IsContainerRunning("collector")
s.Require().NoError(err)
s.Require().True(running)
}

0 comments on commit 18fbe60

Please sign in to comment.