[v11.2.x] Chore: Update tests to use go-workspace script (#92323)

* Chore: Update tests to use go-workspace script (#91746)

(cherry picked from commit 13703de67e)

* Chore: Fix requires_buildifier typo (#91747)

* Chore: Revert drone go workspace change to tests (#91762)

---------

Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com>
pull/92359/head
grafana-delivery-bot[bot] 1 year ago committed by GitHub
parent 312471f3e5
commit db912c8722
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 35
      .drone.yml
  2. 3
      Makefile
  3. 6
      scripts/drone/steps/lib.star
  4. 2
      scripts/drone/steps/lib_windows.star
  5. 11
      scripts/go-workspace/test-includes.sh

@ -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
...

@ -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

@ -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 = {

@ -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/...",
],
}

@ -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}"
Loading…
Cancel
Save