mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix(test): Clear previous prometheus data for test
It could happen that test data is already generated by a previous test. (running in the same worker) Make sure we clear everything before performing our checks. Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
parent
5699e9bb41
commit
1433553c05
1 changed files with 6 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
import pytest
|
import pytest
|
||||||
from prometheus_client import REGISTRY, generate_latest
|
from prometheus_client import REGISTRY, generate_latest
|
||||||
|
|
||||||
from aurweb import cache, db, time
|
from aurweb import cache, db, prometheus, time
|
||||||
from aurweb.models import Package, PackageBase, PackageRequest
|
from aurweb.models import Package, PackageBase, PackageRequest
|
||||||
from aurweb.models.account_type import TRUSTED_USER_ID, USER_ID
|
from aurweb.models.account_type import TRUSTED_USER_ID, USER_ID
|
||||||
from aurweb.models.package_request import (
|
from aurweb.models.package_request import (
|
||||||
|
@ -140,6 +140,11 @@ def test_get_count_change(stats: Statistics, test_data):
|
||||||
|
|
||||||
|
|
||||||
def test_update_prometheus_metrics(test_data):
|
def test_update_prometheus_metrics(test_data):
|
||||||
|
# Make sure any previous data is cleared
|
||||||
|
prometheus.USERS.clear()
|
||||||
|
prometheus.PACKAGES.clear()
|
||||||
|
prometheus.REQUESTS.clear()
|
||||||
|
|
||||||
metrics = str(generate_latest(REGISTRY))
|
metrics = str(generate_latest(REGISTRY))
|
||||||
|
|
||||||
assert "aur_users{" not in metrics
|
assert "aur_users{" not in metrics
|
||||||
|
|
Loading…
Add table
Reference in a new issue