From 508bafced3b616c90f64a64610e20d3407c54850 Mon Sep 17 00:00:00 2001 From: Hui Wang Date: Mon, 25 Nov 2024 18:43:50 +0800 Subject: [PATCH] vmalert-tool: exit immediately with error message if no test file found in `-files` (#7627) --- app/vmalert-tool/unittest/unittest.go | 3 +-- docs/changelog/CHANGELOG.md | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/vmalert-tool/unittest/unittest.go b/app/vmalert-tool/unittest/unittest.go index 17b9b8cc7..a4d4140ac 100644 --- a/app/vmalert-tool/unittest/unittest.go +++ b/app/vmalert-tool/unittest/unittest.go @@ -74,8 +74,7 @@ func UnitTest(files []string, disableGroupLabel bool, externalLabels []string, e logger.Fatalf("failed to load test files %q: %v", files, err) } if len(testfiles) == 0 { - fmt.Println("no test file found") - return false + logger.Fatalf("no test file found") } labels := make(map[string]string) diff --git a/docs/changelog/CHANGELOG.md b/docs/changelog/CHANGELOG.md index afaabdec6..0dec70f48 100644 --- a/docs/changelog/CHANGELOG.md +++ b/docs/changelog/CHANGELOG.md @@ -28,6 +28,7 @@ See also [LTS releases](https://docs.victoriametrics.com/lts-releases/). * BUGFIX: [vmsingle](https://docs.victoriametrics.com/single-server-victoriametrics/), `vmselect` in [VictoriaMetrics cluster](https://docs.victoriametrics.com/cluster-victoriametrics/): properly return result for binary operation `^` aka pow at query requests for `NaN` values. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7359) for details. * BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): fix rendering of isolated data points on the graph that are not connected to other points. * BUGFIX: [vmalert](https://docs.victoriametrics.com/vmalert): improve the correctness of alert [state restoration](https://docs.victoriametrics.com/vmalert/#alerts-state-on-restarts). Previously, it could result in false-positive alerts if alert was resolved shortly before vmalert restart. +* BUGFIX: [vmalert-tool](https://docs.victoriametrics.com/vmalert-tool/): exit immediately with error message if no test file is found under specified `-files`. ## [v1.106.1](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.106.1)