mirror of https://github.com/nicolargo/glances.git
Upgrade export test with InfluxDB 1.12
This commit is contained in:
parent
bcfb3675a6
commit
8a748d15e3
|
|
@ -12,7 +12,7 @@
|
|||
# How to test ?
|
||||
#
|
||||
# 1) docker run -d -e COUCHDB_USER=admin -e COUCHDB_PASSWORD=admin -p 5984:5984 --name my-couchdb couchdb
|
||||
# 2) ./venv/bin/python -m glances -C ./conf/glances.conf --export couchdb --quiet
|
||||
# 2) .venv/bin/python -m glances -C ./conf/glances.conf --export couchdb --quiet
|
||||
# 3) Result can be seen at: http://127.0.0.1:5984/_utils
|
||||
#
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ hash -r
|
|||
You must run the following command from the `glances/outputs/static/` directory.
|
||||
|
||||
```bash
|
||||
./venv/bin/python ./generate_webui_conf.py > ./glances/outputs/static/js/uiconfig.json
|
||||
.venv/bin/python ./generate_webui_conf.py > ./glances/outputs/static/js/uiconfig.json
|
||||
cd glances/outputs/static/
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!./venv/bin/python
|
||||
#!.venv/bin/python
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ def glances_stats_no_history():
|
|||
|
||||
@pytest.fixture(scope="session")
|
||||
def glances_webserver():
|
||||
if os.path.isfile('./venv/bin/python'):
|
||||
cmdline = "./venv/bin/python"
|
||||
if os.path.isfile('.venv/bin/python'):
|
||||
cmdline = ".venv/bin/python"
|
||||
else:
|
||||
cmdline = "python"
|
||||
cmdline += f" -m glances -B 0.0.0.0 -w --browser -p {SERVER_PORT} -C ./conf/glances.conf"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ set -e
|
|||
# This will run synchronously now since we're using --stop-after
|
||||
echo "Glances starts to export system stats to CSV file /tmp/glances.csv (duration: ~ 20 seconds)"
|
||||
rm -f /tmp/glances.csv
|
||||
./venv/bin/python -m glances --export csv --export-csv-file /tmp/glances.csv --stop-after 10 --quiet
|
||||
.venv/bin/python -m glances --export csv --export-csv-file /tmp/glances.csv --stop-after 10 --quiet
|
||||
|
||||
echo "Checking CSV file..."
|
||||
./venv/bin/python ./tests-data/tools/csvcheck.py -i /tmp/glances.csv -l 9
|
||||
.venv/bin/python ./tests-data/tools/csvcheck.py -i /tmp/glances.csv -l 9
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ rm -f /tmp/glances.db
|
|||
# Run glances with export to DuckDB, stopping after 10 writes
|
||||
# This will run synchronously now since we're using --stop-after
|
||||
echo "Glances to export system stats to DuckDB (duration: ~ 20 seconds)"
|
||||
./venv/bin/python -m glances --config ./conf/glances.conf --export duckdb --stop-after 10 --quiet
|
||||
.venv/bin/python -m glances --config ./conf/glances.conf --export duckdb --stop-after 10 --quiet
|
||||
|
||||
echo "Checking DuckDB database..."
|
||||
./venv/bin/python ./tests-data/tools/duckdbcheck.py -i /tmp/glances.db -l 9
|
||||
.venv/bin/python ./tests-data/tools/duckdbcheck.py -i /tmp/glances.db -l 9
|
||||
|
||||
echo "Script completed successfully!"
|
||||
|
|
@ -9,7 +9,7 @@ set -e
|
|||
echo "Starting InfluxDB version 1 container..."
|
||||
docker run -d --name influxdb-v1-for-glances \
|
||||
-p 8086:8086 \
|
||||
influxdb:1.11
|
||||
influxdb:1.12
|
||||
|
||||
# Wait for InfluxDB to be ready (retry for up to 30 seconds)
|
||||
echo "Waiting for InfluxDB to start..."
|
||||
|
|
@ -38,7 +38,7 @@ docker exec influxdb-v1-for-glances influx -execute 'CREATE DATABASE glances'
|
|||
# Run glances with export to InfluxDB, stopping after 10 writes
|
||||
# This will run synchronously now since we're using --stop-after
|
||||
echo "Glances to export system stats to InfluxDB (duration: ~ 20 seconds)"
|
||||
./venv/bin/python -m glances --export influxdb --stop-after 10 --quiet
|
||||
.venv/bin/python -m glances --export influxdb --stop-after 10 --quiet
|
||||
|
||||
echo "Checking if Glances data was successfully exported to InfluxDB..."
|
||||
# Query to check if data exists in the glances database
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ TABLES_INIT_COUNT=$(echo "$TABLES_INIT" | jq length)
|
|||
# Run glances with export to InfluxDB, stopping after 10 writes
|
||||
# This will run synchronously now since we're using --stop-after
|
||||
echo "Glances to export system stats to InfluxDB (duration: ~ 20 seconds)"
|
||||
./venv/bin/python -m glances --config /tmp/glances.conf --export influxdb3 --stop-after 10 --quiet
|
||||
.venv/bin/python -m glances --config /tmp/glances.conf --export influxdb3 --stop-after 10 --quiet
|
||||
|
||||
echo "Checking if Glances data was successfully exported to InfluxDB..."
|
||||
# Query to check if data exists in the glances database
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ set -e
|
|||
# This will run synchronously now since we're using --stop-after
|
||||
echo "Glances starts to export system stats to JSON file /tmp/glances.json (duration: ~ 10 seconds)"
|
||||
rm -f /tmp/glances.json
|
||||
./venv/bin/python -m glances --export json --export-json-file /tmp/glances.json --stop-after 3 --quiet
|
||||
.venv/bin/python -m glances --export json --export-json-file /tmp/glances.json --stop-after 3 --quiet
|
||||
|
||||
echo "Checking JSON file..."
|
||||
jq . /tmp/glances.json
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ set -e
|
|||
# Run glances with export to Prometheus, stopping after 10 writes
|
||||
# This will run synchronously now since we're using --stop-after
|
||||
echo "Glances to export system stats to Prometheus"
|
||||
./venv/bin/python -m glances --config ./conf/glances.conf --export prometheus --stop-after 10 --quiet &
|
||||
.venv/bin/python -m glances --config ./conf/glances.conf --export prometheus --stop-after 10 --quiet &
|
||||
# Get the PID of the last background command
|
||||
GLANCES_PID=$!
|
||||
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@ docker exec timescaledb-for-glances psql -d "postgres://postgres:password@localh
|
|||
# Run glances with export to TimescaleDB, stopping after 10 writes
|
||||
# This will run synchronously now since we're using --stop-after
|
||||
echo "Glances to export system stats to TimescaleDB (duration: ~ 20 seconds)"
|
||||
./venv/bin/python -m glances --config ./conf/glances.conf --export timescaledb --stop-after 10 --quiet
|
||||
.venv/bin/python -m glances --config ./conf/glances.conf --export timescaledb --stop-after 10 --quiet
|
||||
|
||||
|
||||
docker exec timescaledb-for-glances psql -d "postgres://postgres:password@localhost/glances" -c "SELECT * from cpu;" --csv > /tmp/timescaledb-for-glances_cpu.csv
|
||||
./venv/bin/python ./tests-data/tools/csvcheck.py -i /tmp/timescaledb-for-glances_cpu.csv -l 9
|
||||
.venv/bin/python ./tests-data/tools/csvcheck.py -i /tmp/timescaledb-for-glances_cpu.csv -l 9
|
||||
|
||||
# Stop and remove the TimescaleDB container
|
||||
echo "Stopping and removing TimescaleDB container..."
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ class TestGlances(unittest.TestCase):
|
|||
global pid
|
||||
|
||||
print('INFO: [TEST_000] Start the Glances Web Server API')
|
||||
if os.path.isfile('./venv/bin/python'):
|
||||
cmdline = "./venv/bin/python"
|
||||
if os.path.isfile('.venv/bin/python'):
|
||||
cmdline = ".venv/bin/python"
|
||||
else:
|
||||
cmdline = "python"
|
||||
cmdline += f" -m glances -B 0.0.0.0 -w --browser -p {SERVER_PORT} --disable-webui -C ./conf/glances.conf"
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ class TestGlances(unittest.TestCase):
|
|||
global pid
|
||||
|
||||
print('INFO: [TEST_000] Start the Glances Web Server')
|
||||
if os.path.isfile('./venv/bin/python'):
|
||||
cmdline = "./venv/bin/python"
|
||||
if os.path.isfile('.venv/bin/python'):
|
||||
cmdline = ".venv/bin/python"
|
||||
else:
|
||||
cmdline = "python"
|
||||
cmdline += f" -m glances -B localhost -s -p {SERVER_PORT}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue