[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. 19
      .drone.yml
  2. 3
      Makefile
  3. 2
      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 name: wire-install
- commands: - commands:
- apk add --update build-base shared-mime-info shared-mime-info-lang - 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 - go list -f '{{.Dir}}/...' -m | xargs go test -short -covermode=atomic -timeout=5m
-timeout=5m
depends_on: depends_on:
- wire-install - wire-install
image: golang:1.22.4-alpine image: golang:1.22.4-alpine
@ -1776,8 +1775,7 @@ steps:
name: wire-install name: wire-install
- commands: - commands:
- apk add --update build-base shared-mime-info shared-mime-info-lang - 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 - go list -f '{{.Dir}}/...' -m | xargs go test -short -covermode=atomic -timeout=5m
-timeout=5m
depends_on: depends_on:
- wire-install - wire-install
image: golang:1.22.4-alpine image: golang:1.22.4-alpine
@ -2974,8 +2972,7 @@ steps:
name: wire-install name: wire-install
- commands: - commands:
- apk add --update build-base shared-mime-info shared-mime-info-lang - 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 - go list -f '{{.Dir}}/...' -m | xargs go test -short -covermode=atomic -timeout=5m
-timeout=5m
depends_on: depends_on:
- wire-install - wire-install
image: golang:1.22.4-alpine image: golang:1.22.4-alpine
@ -4360,8 +4357,7 @@ steps:
name: wire-install name: wire-install
- commands: - commands:
- apk add --update build-base shared-mime-info shared-mime-info-lang - 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 - go list -f '{{.Dir}}/...' -m | xargs go test -short -covermode=atomic -timeout=5m
-timeout=5m
depends_on: depends_on:
- wire-install - wire-install
image: golang:1.22.4-alpine image: golang:1.22.4-alpine
@ -4782,8 +4778,7 @@ steps:
name: wire-install name: wire-install
- commands: - commands:
- apk add --update build-base shared-mime-info shared-mime-info-lang - 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 - go list -f '{{.Dir}}/...' -m | xargs go test -short -covermode=atomic -timeout=5m
-timeout=5m
depends_on: depends_on:
- wire-install - wire-install
image: golang:1.22.4-alpine image: golang:1.22.4-alpine
@ -5207,7 +5202,7 @@ steps:
image: golang:1.22.4-windowsservercore-1809 image: golang:1.22.4-windowsservercore-1809
name: wire-install name: wire-install
- commands: - commands:
- go test -tags requires_buildifer -short -covermode=atomic -timeout=5m ./pkg/... - go test -short -covermode=atomic -timeout=5m ./pkg/...
depends_on: depends_on:
- wire-install - wire-install
image: golang:1.22.4-windowsservercore-1809 image: golang:1.22.4-windowsservercore-1809
@ -6079,6 +6074,6 @@ kind: secret
name: gcr_credentials name: gcr_credentials
--- ---
kind: signature kind: signature
hmac: 3ec8f984961a401ed9785c3f537a725e1ba3912b713e1796561634d9c99f93ba hmac: d35eadf9a166f68973ffd6df85f165bbda468d422d5debe416ec6a5af6ead84a
... ...

@ -10,6 +10,7 @@ include .bingo/Variables.mk
GO = go GO = go
GO_VERSION = 1.22.4 GO_VERSION = 1.22.4
GO_LINT_FILES ?= $(shell ./scripts/go-workspace/golangci-lint-includes.sh) 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) SH_FILES ?= $(shell find ./scripts -name *.sh)
GO_RACE := $(shell [ -n "$(GO_RACE)" -o -e ".go-race-enabled-locally" ] && echo 1 ) GO_RACE := $(shell [ -n "$(GO_RACE)" -o -e ".go-race-enabled-locally" ] && echo 1 )
GO_RACE_FLAG := $(if $(GO_RACE),-race) GO_RACE_FLAG := $(if $(GO_RACE),-race)
@ -235,7 +236,7 @@ test-go: test-go-unit test-go-integration
.PHONY: test-go-unit .PHONY: test-go-unit
test-go-unit: ## Run unit tests for backend with flags. test-go-unit: ## Run unit tests for backend with flags.
@echo "test backend unit tests" @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 $(GO) test $(GO_RACE_FLAG) -short -covermode=atomic -timeout=30m
.PHONY: test-go-integration .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 # shared-mime-info and shared-mime-info-lang is used for exactly 1 test for the
# mime.TypeByExtension function. # mime.TypeByExtension function.
"apk add --update build-base shared-mime-info shared-mime-info-lang", "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",
], ],
} }

@ -156,7 +156,7 @@ def test_backend_step_windows():
"wire-install", "wire-install",
], ],
"commands": [ "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