diff --git a/.drone.yml b/.drone.yml index ac3ccb9c97f..22b31b9b296 100644 --- a/.drone.yml +++ b/.drone.yml @@ -397,8 +397,7 @@ steps: name: wire-install - commands: - apk add --update build-base shared-mime-info shared-mime-info-lang - - go list -f '{{.Dir}}/...' -m | xargs go test -tags requires_buildifer -short -covermode=atomic - -timeout=5m + - go list -f '{{.Dir}}/...' -m | xargs go test -short -covermode=atomic -timeout=5m depends_on: - wire-install image: golang:1.22.4-alpine @@ -1098,7 +1097,7 @@ steps: - commands: - apk add --update build-base - go clean -testcache - - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic + - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic -timeout=2m depends_on: - wire-install @@ -1114,7 +1113,7 @@ steps: - commands: - apk add --update build-base - go clean -testcache - - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic + - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic -timeout=2m depends_on: - wire-install @@ -1776,8 +1775,7 @@ steps: name: wire-install - commands: - apk add --update build-base shared-mime-info shared-mime-info-lang - - go list -f '{{.Dir}}/...' -m | xargs go test -tags requires_buildifer -short -covermode=atomic - -timeout=5m + - go list -f '{{.Dir}}/...' -m | xargs go test -short -covermode=atomic -timeout=5m depends_on: - wire-install image: golang:1.22.4-alpine @@ -2604,7 +2602,7 @@ steps: - commands: - apk add --update build-base - go clean -testcache - - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic + - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic -timeout=2m depends_on: - wire-install @@ -2620,7 +2618,7 @@ steps: - commands: - apk add --update build-base - go clean -testcache - - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic + - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic -timeout=2m depends_on: - wire-install @@ -2974,8 +2972,7 @@ steps: name: wire-install - commands: - apk add --update build-base shared-mime-info shared-mime-info-lang - - go list -f '{{.Dir}}/...' -m | xargs go test -tags requires_buildifer -short -covermode=atomic - -timeout=5m + - go list -f '{{.Dir}}/...' -m | xargs go test -short -covermode=atomic -timeout=5m depends_on: - wire-install image: golang:1.22.4-alpine @@ -3237,7 +3234,7 @@ steps: - commands: - apk add --update build-base - go clean -testcache - - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic + - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic -timeout=2m depends_on: - wire-install @@ -3253,7 +3250,7 @@ steps: - commands: - apk add --update build-base - go clean -testcache - - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic + - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic -timeout=2m depends_on: - wire-install @@ -4360,8 +4357,7 @@ steps: name: wire-install - commands: - apk add --update build-base shared-mime-info shared-mime-info-lang - - go list -f '{{.Dir}}/...' -m | xargs go test -tags requires_buildifer -short -covermode=atomic - -timeout=5m + - go list -f '{{.Dir}}/...' -m | xargs go test -short -covermode=atomic -timeout=5m depends_on: - wire-install image: golang:1.22.4-alpine @@ -4782,8 +4778,7 @@ steps: name: wire-install - commands: - apk add --update build-base shared-mime-info shared-mime-info-lang - - go list -f '{{.Dir}}/...' -m | xargs go test -tags requires_buildifer -short -covermode=atomic - -timeout=5m + - go list -f '{{.Dir}}/...' -m | xargs go test -short -covermode=atomic -timeout=5m depends_on: - wire-install image: golang:1.22.4-alpine @@ -5207,7 +5202,7 @@ steps: image: golang:1.22.4-windowsservercore-1809 name: wire-install - commands: - - go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/... + - go test -short -covermode=atomic -timeout=5m ./pkg/... depends_on: - wire-install image: golang:1.22.4-windowsservercore-1809 @@ -5391,7 +5386,7 @@ steps: - commands: - apk add --update build-base - go clean -testcache - - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic + - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic -timeout=2m depends_on: - wire-install @@ -5407,7 +5402,7 @@ steps: - commands: - apk add --update build-base - go clean -testcache - - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic + - go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic -timeout=2m depends_on: - wire-install @@ -6079,6 +6074,6 @@ kind: secret name: gcr_credentials --- kind: signature -hmac: 3ec8f984961a401ed9785c3f537a725e1ba3912b713e1796561634d9c99f93ba +hmac: d35eadf9a166f68973ffd6df85f165bbda468d422d5debe416ec6a5af6ead84a ... diff --git a/Makefile b/Makefile index 01850e3e708..1424ea96ce0 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ include .bingo/Variables.mk GO = go GO_VERSION = 1.22.4 GO_LINT_FILES ?= $(shell ./scripts/go-workspace/golangci-lint-includes.sh) +GO_TEST_FILES ?= $(shell ./scripts/go-workspace/test-includes.sh) SH_FILES ?= $(shell find ./scripts -name *.sh) GO_RACE := $(shell [ -n "$(GO_RACE)" -o -e ".go-race-enabled-locally" ] && echo 1 ) GO_RACE_FLAG := $(if $(GO_RACE),-race) @@ -235,7 +236,7 @@ test-go: test-go-unit test-go-integration .PHONY: test-go-unit test-go-unit: ## Run unit tests for backend with flags. @echo "test backend unit tests" - go list -f '{{.Dir}}/...' -m | xargs \ + printf '$(GO_TEST_FILES)' | xargs \ $(GO) test $(GO_RACE_FLAG) -short -covermode=atomic -timeout=30m .PHONY: test-go-integration diff --git a/scripts/drone/steps/lib.star b/scripts/drone/steps/lib.star index bdc419324be..e07ae798698 100644 --- a/scripts/drone/steps/lib.star +++ b/scripts/drone/steps/lib.star @@ -553,7 +553,7 @@ def test_backend_step(): # shared-mime-info and shared-mime-info-lang is used for exactly 1 test for the # mime.TypeByExtension function. "apk add --update build-base shared-mime-info shared-mime-info-lang", - "go list -f '{{.Dir}}/...' -m | xargs go test -tags requires_buildifer -short -covermode=atomic -timeout=5m", + "go list -f '{{.Dir}}/...' -m | xargs go test -short -covermode=atomic -timeout=5m", ], } @@ -1056,7 +1056,7 @@ def mysql_integration_tests_steps(hostname, version): def redis_integration_tests_steps(): cmds = [ "go clean -testcache", - "go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic -timeout=2m", + "go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic -timeout=2m", ] environment = { @@ -1081,7 +1081,7 @@ def remote_alertmanager_integration_tests_steps(): def memcached_integration_tests_steps(): cmds = [ "go clean -testcache", - "go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic -timeout=2m", + "go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic -timeout=2m", ] environment = { diff --git a/scripts/drone/steps/lib_windows.star b/scripts/drone/steps/lib_windows.star index f9b11bcf85e..13e6b0d11af 100644 --- a/scripts/drone/steps/lib_windows.star +++ b/scripts/drone/steps/lib_windows.star @@ -156,7 +156,7 @@ def test_backend_step_windows(): "wire-install", ], "commands": [ - "go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/...", + "go test -short -covermode=atomic -timeout=5m ./pkg/...", ], } diff --git a/scripts/go-workspace/test-includes.sh b/scripts/go-workspace/test-includes.sh new file mode 100755 index 00000000000..6b9b2af8747 --- /dev/null +++ b/scripts/go-workspace/test-includes.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +DELIMITER="/... +" + +REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/../.. +go run scripts/go-workspace/main.go list-submodules --path "${REPO_ROOT}/go.work" --delimiter "${DELIMITER}"