VictoriaMetrics/apptest
Guillem Jover 1d8b7faf71
spelling and grammar fixes via codespell ()
### Describe Your Changes

Fix many spelling errors and some grammar, including misspellings in
filenames.

The change also fixes a typo in metric `vm_mmaped_files` to `vm_mmapped_files`.
While this is a breaking change, this metric isn't used in alerts or dashboards.
So it seems to have low impact on users.

The change also deprecates `cspell` as it is much heavier and less usable.
---------

Co-authored-by: Andrii Chubatiuk <achubatiuk@victoriametrics.com>
Co-authored-by: Andrii Chubatiuk <andrew.chubatiuk@gmail.com>

(cherry picked from commit 76d205feae)
Signed-off-by: hagen1778 <roman@victoriametrics.com>
2025-03-17 16:38:11 +01:00
..
tests spelling and grammar fixes via codespell () 2025-03-17 16:38:11 +01:00
app.go spelling and grammar fixes via codespell () 2025-03-17 16:38:11 +01:00
client.go spelling and grammar fixes via codespell () 2025-03-17 16:38:11 +01:00
model.go app/vmselect: properly cancel multitenant query request 2025-03-14 00:51:08 +01:00
README.md spelling and grammar fixes via codespell () 2025-03-17 16:38:11 +01:00
testcase.go lib/storage: Rewrite deduplication integration test with forced merge and retries 2025-03-13 18:09:33 +01:00
vmauth.go app/vmauth: allow to serve internal API and different address 2025-02-06 13:44:34 +01:00
vminsert.go app/vmselect: add query resource limits priority 2025-02-19 18:14:54 +01:00
vmselect.go lib/storage: add tracker for time series metric names statistics 2025-03-06 22:10:41 +01:00
vmsingle.go apptest: Add the support of forced merge to vmsingle and vmstorage 2025-03-13 18:09:33 +01:00
vmstorage.go apptest: Add the support of forced merge to vmsingle and vmstorage 2025-03-13 18:09:33 +01:00

App Integration Tests

The apptest package contains the integration tests for the VictoriaMetrics applications (such as vmstorage, vminsert, and vmselect).

An integration test aims at verifying the behavior of an application as a whole, as apposed to a unit test that verifies the behavior of a building block of an application.

To achieve that an integration test starts an application in a separate process and then issues HTTP requests to it and verifies the responses, examines the metrics the app exposes and/or files it creates, etc.

Note that an object of testing may be not just a single app, but several apps working together. A good example is VictoriaMetrics cluster. An integration test may reproduce an arbitrary cluster configuration and verify how the components work together as a system.

The package provides a collection of helpers to start applications and make queries to them:

  • app.go - contains the generic code for staring an application and should not be used by integration tests directly.
  • {vmstorage,vminsert,etc}.go - build on top of app.go and provide the code for staring a specific application.
  • client.go - provides helper functions for sending HTTP requests to applications.

The integration tests themselves reside in tests/*_test.go files. Apart from having the _test suffix, there are no strict rules of how to name a file, but the name should reflect the prevailing purpose of the tests located in that file. For example, sharding_test.go aims at testing data sharding.

Since integration tests start applications in a separate process, they require the application binary files to be built and put into the bin directory. The build rule used for running integration tests, make integration-test, accounts for that, it builds all application binaries before running the tests. But if you want to run the tests without make, i.e. by executing go test ./app/apptest, you will need to build the binaries first (for example, by executing make all).

Not all binaries can be built from master branch, cluster binaries can be built only from cluster branch. Hence, not all test cases suitable to run in both branches:

  • If test is using binaries from cluster branch, then test name should be prefixed with TestCluster word
  • If test is using binaries from master branch, then test name should be prefixed with TestSingle word.