mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2026-05-17 00:26:36 +03:00
Makefile: fix synctest tests
The `synctest` experiment has been removed in go 1.26. This causes the test build targets to fail. To fix that, this commit removes the `GOEXPERIMENT=synctest` env var from the build rule recipes. This forces the go tests to expect different synctest method names and function signatures. Thus, the synctest tests also have been fixed. VictoriaMetrics code uses `lib/fasttime` to get the current time. This does not work with synctest tests since they require `time.Now()` to properly override the current time. On the other hand, the rest of the tests (and especially benchmarks) want to continue using `lib/fasttime`. Therefore the `synctest` build label is used to link modified version of `lib/fasttime` when the synctest tests need to be run. Signed-off-by: Artem Fetishev <rtm@victoriametrics.com>
This commit is contained in:
18
Makefile
18
Makefile
@@ -443,7 +443,7 @@ fmt:
|
||||
gofmt -l -w -s ./apptest
|
||||
|
||||
vet:
|
||||
GOEXPERIMENT=synctest go vet ./lib/...
|
||||
go vet -tags=synctest ./lib/...
|
||||
go vet ./app/...
|
||||
go vet ./apptest/...
|
||||
|
||||
@@ -452,19 +452,19 @@ check-all: fmt vet golangci-lint govulncheck
|
||||
clean-checkers: remove-golangci-lint remove-govulncheck
|
||||
|
||||
test:
|
||||
GOEXPERIMENT=synctest go test ./lib/... ./app/...
|
||||
go test -tags=synctest ./lib/... ./app/...
|
||||
|
||||
test-race:
|
||||
GOEXPERIMENT=synctest go test -race ./lib/... ./app/...
|
||||
go test -tags=synctest -race ./lib/... ./app/...
|
||||
|
||||
test-pure:
|
||||
GOEXPERIMENT=synctest CGO_ENABLED=0 go test ./lib/... ./app/...
|
||||
CGO_ENABLED=0 go test -tags=synctest ./lib/... ./app/...
|
||||
|
||||
test-full:
|
||||
GOEXPERIMENT=synctest go test -coverprofile=coverage.txt -covermode=atomic ./lib/... ./app/...
|
||||
go test -tags=synctest -coverprofile=coverage.txt -covermode=atomic ./lib/... ./app/...
|
||||
|
||||
test-full-386:
|
||||
GOEXPERIMENT=synctest GOARCH=386 go test -coverprofile=coverage.txt -covermode=atomic ./lib/... ./app/...
|
||||
GOARCH=386 go test -tags=synctest -coverprofile=coverage.txt -covermode=atomic ./lib/... ./app/...
|
||||
|
||||
integration-test:
|
||||
$(MAKE) apptest
|
||||
@@ -490,11 +490,11 @@ integration-test-legacy: victoria-metrics vmbackup vmrestore
|
||||
go test ./apptest/tests -run="^TestLegacySingle.*"
|
||||
|
||||
benchmark:
|
||||
GOEXPERIMENT=synctest go test -bench=. ./lib/...
|
||||
go test -bench=. ./lib/...
|
||||
go test -bench=. ./app/...
|
||||
|
||||
benchmark-pure:
|
||||
GOEXPERIMENT=synctest CGO_ENABLED=0 go test -bench=. ./lib/...
|
||||
CGO_ENABLED=0 go test -bench=. ./lib/...
|
||||
CGO_ENABLED=0 go test -bench=. ./app/...
|
||||
|
||||
vendor-update:
|
||||
@@ -524,7 +524,7 @@ install-qtc:
|
||||
|
||||
|
||||
golangci-lint: install-golangci-lint
|
||||
GOEXPERIMENT=synctest golangci-lint run
|
||||
golangci-lint run --build-tags=synctest
|
||||
|
||||
install-golangci-lint:
|
||||
which golangci-lint && (golangci-lint --version | grep -q $(GOLANGCI_LINT_VERSION)) || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v$(GOLANGCI_LINT_VERSION)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//go:build !goexperiment.synctest
|
||||
//go:build !synctest
|
||||
|
||||
package fasttime
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//go:build goexperiment.synctest
|
||||
//go:build synctest
|
||||
|
||||
package fasttime
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//go:build goexperiment.synctest
|
||||
//go:build synctest
|
||||
|
||||
package storage
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
func TestSearch_metricNamesIndifferentIndexDBs(t *testing.T) {
|
||||
defer testRemoveAll(t)
|
||||
|
||||
synctest.Run(func() {
|
||||
synctest.Test(t, func(t *testing.T) {
|
||||
const numSeries = 10
|
||||
tr := TimeRange{
|
||||
MinTimestamp: time.Now().UnixMilli(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//go:build goexperiment.synctest
|
||||
//go:build synctest
|
||||
|
||||
package storage
|
||||
|
||||
@@ -289,7 +289,7 @@ func TestStorageRotateIndexDBPrefill(t *testing.T) {
|
||||
f := func(t *testing.T, opts OpenOptions, prefillStart time.Duration) {
|
||||
t.Helper()
|
||||
|
||||
synctest.Run(func() {
|
||||
synctest.Test(t, func(t *testing.T) {
|
||||
// Prefill of the next partition indexDB happens during the
|
||||
// (nextMonth-prefillStart, nextMonth] time interval.
|
||||
// Advance current time right before the the beginning of that interval.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//go:build goexperiment.synctest
|
||||
//go:build synctest
|
||||
|
||||
package streamaggr
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
func TestAggregatorsSuccess(t *testing.T) {
|
||||
f := func(inputMetrics []string, interval time.Duration, outputMetricsExpected, config, matchIdxsStrExpected string) {
|
||||
t.Helper()
|
||||
synctest.Run(func() {
|
||||
synctest.Test(t, func(t *testing.T) {
|
||||
var matchIdxs []uint32
|
||||
var tssOutput []prompb.TimeSeries
|
||||
var tssOutputLock sync.Mutex
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//go:build goexperiment.synctest
|
||||
//go:build synctest
|
||||
|
||||
package workingsetcache
|
||||
|
||||
|
||||
Reference in New Issue
Block a user