From 76930c201d9205c3256d0e06ba0dc767f396192d Mon Sep 17 00:00:00 2001 From: Roger Coll Date: Thu, 12 Dec 2024 11:36:45 +0100 Subject: [PATCH] fix: only run tests as sudo if contain Sudo --- Makefile.Common | 4 ++-- extension/cgroupruntimeextension/integration_test.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile.Common b/Makefile.Common index d4142ca74341..d587de5bfad4 100644 --- a/Makefile.Common +++ b/Makefile.Common @@ -30,10 +30,10 @@ GO_BUILD_LDFLAGS="-s -w" GOTEST_TIMEOUT?= 600s GOTEST_OPT?= -race -timeout $(GOTEST_TIMEOUT) -parallel 4 --tags=$(GO_BUILD_TAGS) GOTEST_INTEGRATION_OPT?= -race -timeout 360s -parallel 4 -GOTEST_INTEGRATION_OPT_SUDO= $(GOTEST_INTEGRATION_OPT) -exec sudo +GOTEST_INTEGRATION_OPT_SUDO= $(GOTEST_INTEGRATION_OPT) -exec sudo -run Sudo GOTEST_OPT_WITH_COVERAGE = $(GOTEST_OPT) -coverprofile=coverage.txt -covermode=atomic GOTEST_OPT_WITH_INTEGRATION=$(GOTEST_INTEGRATION_OPT) -tags=integration,$(GO_BUILD_TAGS) -GOTEST_OPT_WITH_INTEGRATION_SUDO=$(GOTEST_INTEGRATION_OPT_SUDO) -tags="integration sudo" +GOTEST_OPT_WITH_INTEGRATION_SUDO=$(GOTEST_INTEGRATION_OPT_SUDO) -tags=integration,$(GO_BUILD_TAGS) GOTEST_OPT_WITH_INTEGRATION_COVERAGE=$(GOTEST_OPT_WITH_INTEGRATION) -coverprofile=integration-coverage.txt -covermode=atomic GOCMD?= go GOOS=$(shell $(GOCMD) env GOOS) diff --git a/extension/cgroupruntimeextension/integration_test.go b/extension/cgroupruntimeextension/integration_test.go index 17aef3d69250..bcf96f198116 100644 --- a/extension/cgroupruntimeextension/integration_test.go +++ b/extension/cgroupruntimeextension/integration_test.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -//go:build integration && sudo -// +build integration,sudo +//go:build integration +// +build integration // Privileged access is required to set cgroup's memory and cpu max values @@ -63,7 +63,7 @@ func cgroupMaxCpu(filename string) (quota int64, period uint64, err error) { return quota, period, err } -func TestCgroupV2Integration(t *testing.T) { +func TestCgroupV2SudoIntegration(t *testing.T) { checkCgroupSystem(t) pointerInt64 := func(int int64) *int64 { return &int