Skip to content

Commit

Permalink
add use to 'systemd-journal' group before running integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
belimawr committed Oct 29, 2024
1 parent 0eb87ab commit 49e5076
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 58 deletions.
31 changes: 1 addition & 30 deletions .buildkite/filebeat/filebeat-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,38 +98,10 @@ steps:
context: "filebeat: Ubuntu x86_64 Unit Tests"

- label: ":ubuntu: Filebeat: Go Integration Tests"
command: |
cd filebeat
mage goIntegTest
retry:
automatic:
- limit: 1
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "${GCP_HI_PERF_MACHINE_TYPE}"
artifact_paths:
- "filebeat/build/*.xml"
- "filebeat/build/*.json"
- "filebeat/build/integration-tests/*"
- "filebeat/build/integration-tests/Test*/*"
- "filebeat/build/integration-tests/Test*/data/**/*"
plugins:
- test-collector#v1.10.2:
files: "filebeat/build/TEST-*.xml"
format: "junit"
branches: "main"
debug: true
notify:
- github_commit_status:
context: "filebeat: Go Integration Tests"

- label: ":ubuntu: Filebeat: Integration tests as Root"
command: |
sudo usermod -a -G systemd-journal $$USER
cd filebeat
go test -v -count=1 -tags=integration -run=TestSystemLogs ./tests/integration
go go test -v -count=1 -tags=integration -run=TestDebugBuildKite ./tests/integration
mage goIntegTest
retry:
automatic:
- limit: 1
Expand All @@ -140,7 +112,6 @@ steps:
artifact_paths:
- "filebeat/build/*.xml"
- "filebeat/build/*.json"
- "filebeat/build/integration-tests/*"
- "filebeat/build/integration-tests/Test*/*"
- "filebeat/build/integration-tests/Test*/data/**/*"
plugins:
Expand Down
27 changes: 0 additions & 27 deletions filebeat/tests/integration/systemlogs_all_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"io"
"os"
"path/filepath"
"strconv"
"testing"
"time"

Expand All @@ -52,32 +51,6 @@ func copyModulesDir(t *testing.T, dst string) {
}
}

//nolint:unused,nolintlint // necessary on Linux
func skipOnBuildKite(t *testing.T) {
val, isSet := os.LookupEnv("BUILDKITE")
if !isSet {
// if the envvar BUILDKITE is not set, we're not on BuildKite,
// so return false (do not skip any test)
return
}

buildkite, err := strconv.ParseBool(val)
if err != nil {
t.Fatalf("cannot parse '%s' as bool: %s", val, err)
}

if !buildkite {
// We're not on BuildKite, do not skip any test
return
}

// os.Geteuid() == 0 means we're root.
// If we're not root, skip the test
if os.Geteuid() != 0 {
t.Skip("this test can only run on BuildKite as root")
}
}

//nolint:unused,nolintlint // necessary on Linux
func writeToFile(t *testing.T, data []byte, name string) {
if err := os.MkdirAll(filepath.Join("../", "../", "build", "integration-tests"), 0750); err != nil {
Expand Down
1 change: 0 additions & 1 deletion filebeat/tests/integration/systemlogs_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
// correctly choose and start a journald input when the globs defined in
// var.paths do not resolve to any file.
func TestSystemLogsCanUseJournaldInput(t *testing.T) {
skipOnBuildKite(t)
filebeat := integration.NewBeat(
t,
"filebeat",
Expand Down

0 comments on commit 49e5076

Please sign in to comment.