mirror of
https://github.com/grafana/grafana.git
synced 2025-07-25 16:13:18 +08:00
Chore: Update tests to use go-workspace script (#91746)
This commit is contained in:
54
.drone.yml
54
.drone.yml
@ -397,8 +397,8 @@ 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
|
||||
- ./scripts/go-workspace/test-includes.sh | xargs go test -tags requires_buildifer
|
||||
-short -covermode=atomic -timeout=5m
|
||||
depends_on:
|
||||
- wire-install
|
||||
image: golang:1.22.4-alpine
|
||||
@ -1098,8 +1098,8 @@ steps:
|
||||
- commands:
|
||||
- apk add --update build-base
|
||||
- go clean -testcache
|
||||
- go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic
|
||||
-timeout=2m
|
||||
- ./scripts/go-workspace/test-includes.sh | xargs go test -run IntegrationRedis
|
||||
-covermode=atomic -timeout=2m
|
||||
depends_on:
|
||||
- wire-install
|
||||
- wait-for-redis
|
||||
@ -1114,8 +1114,8 @@ steps:
|
||||
- commands:
|
||||
- apk add --update build-base
|
||||
- go clean -testcache
|
||||
- go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic
|
||||
-timeout=2m
|
||||
- ./scripts/go-workspace/test-includes.sh | xargs go test -run IntegrationMemcached
|
||||
-covermode=atomic -timeout=2m
|
||||
depends_on:
|
||||
- wire-install
|
||||
- wait-for-memcached
|
||||
@ -1776,8 +1776,8 @@ 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
|
||||
- ./scripts/go-workspace/test-includes.sh | xargs go test -tags requires_buildifer
|
||||
-short -covermode=atomic -timeout=5m
|
||||
depends_on:
|
||||
- wire-install
|
||||
image: golang:1.22.4-alpine
|
||||
@ -2604,8 +2604,8 @@ steps:
|
||||
- commands:
|
||||
- apk add --update build-base
|
||||
- go clean -testcache
|
||||
- go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic
|
||||
-timeout=2m
|
||||
- ./scripts/go-workspace/test-includes.sh | xargs go test -run IntegrationRedis
|
||||
-covermode=atomic -timeout=2m
|
||||
depends_on:
|
||||
- wire-install
|
||||
- wait-for-redis
|
||||
@ -2620,8 +2620,8 @@ steps:
|
||||
- commands:
|
||||
- apk add --update build-base
|
||||
- go clean -testcache
|
||||
- go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic
|
||||
-timeout=2m
|
||||
- ./scripts/go-workspace/test-includes.sh | xargs go test -run IntegrationMemcached
|
||||
-covermode=atomic -timeout=2m
|
||||
depends_on:
|
||||
- wire-install
|
||||
- wait-for-memcached
|
||||
@ -2974,8 +2974,8 @@ 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
|
||||
- ./scripts/go-workspace/test-includes.sh | xargs go test -tags requires_buildifer
|
||||
-short -covermode=atomic -timeout=5m
|
||||
depends_on:
|
||||
- wire-install
|
||||
image: golang:1.22.4-alpine
|
||||
@ -3237,8 +3237,8 @@ steps:
|
||||
- commands:
|
||||
- apk add --update build-base
|
||||
- go clean -testcache
|
||||
- go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic
|
||||
-timeout=2m
|
||||
- ./scripts/go-workspace/test-includes.sh | xargs go test -run IntegrationRedis
|
||||
-covermode=atomic -timeout=2m
|
||||
depends_on:
|
||||
- wire-install
|
||||
- wait-for-redis
|
||||
@ -3253,8 +3253,8 @@ steps:
|
||||
- commands:
|
||||
- apk add --update build-base
|
||||
- go clean -testcache
|
||||
- go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic
|
||||
-timeout=2m
|
||||
- ./scripts/go-workspace/test-includes.sh | xargs go test -run IntegrationMemcached
|
||||
-covermode=atomic -timeout=2m
|
||||
depends_on:
|
||||
- wire-install
|
||||
- wait-for-memcached
|
||||
@ -4360,8 +4360,8 @@ 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
|
||||
- ./scripts/go-workspace/test-includes.sh | xargs go test -tags requires_buildifer
|
||||
-short -covermode=atomic -timeout=5m
|
||||
depends_on:
|
||||
- wire-install
|
||||
image: golang:1.22.4-alpine
|
||||
@ -4782,8 +4782,8 @@ 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
|
||||
- ./scripts/go-workspace/test-includes.sh | xargs go test -tags requires_buildifer
|
||||
-short -covermode=atomic -timeout=5m
|
||||
depends_on:
|
||||
- wire-install
|
||||
image: golang:1.22.4-alpine
|
||||
@ -5391,8 +5391,8 @@ steps:
|
||||
- commands:
|
||||
- apk add --update build-base
|
||||
- go clean -testcache
|
||||
- go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationRedis -covermode=atomic
|
||||
-timeout=2m
|
||||
- ./scripts/go-workspace/test-includes.sh | xargs go test -run IntegrationRedis
|
||||
-covermode=atomic -timeout=2m
|
||||
depends_on:
|
||||
- wire-install
|
||||
- wait-for-redis
|
||||
@ -5407,8 +5407,8 @@ steps:
|
||||
- commands:
|
||||
- apk add --update build-base
|
||||
- go clean -testcache
|
||||
- go list -f '{{.Dir}}/...' -m | xargs go test -run IntegrationMemcached -covermode=atomic
|
||||
-timeout=2m
|
||||
- ./scripts/go-workspace/test-includes.sh | xargs go test -run IntegrationMemcached
|
||||
-covermode=atomic -timeout=2m
|
||||
depends_on:
|
||||
- wire-install
|
||||
- wait-for-memcached
|
||||
@ -6079,6 +6079,6 @@ kind: secret
|
||||
name: gcr_credentials
|
||||
---
|
||||
kind: signature
|
||||
hmac: 3ec8f984961a401ed9785c3f537a725e1ba3912b713e1796561634d9c99f93ba
|
||||
hmac: fa7d6043308457e09a7d952ef254d086eae29793c42de5139fde06f9cb574670
|
||||
|
||||
...
|
||||
|
3
Makefile
3
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
|
||||
|
@ -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",
|
||||
"./scripts/go-workspace/test-includes.sh | xargs go test -tags requires_buildifer -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",
|
||||
"./scripts/go-workspace/test-includes.sh | 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",
|
||||
"./scripts/go-workspace/test-includes.sh | xargs go test -run IntegrationMemcached -covermode=atomic -timeout=2m",
|
||||
]
|
||||
|
||||
environment = {
|
||||
|
11
scripts/go-workspace/test-includes.sh
Executable file
11
scripts/go-workspace/test-includes.sh
Executable file
@ -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}"
|
Reference in New Issue
Block a user