Back to Blog
Time-Series DatabasesDistributed SystemsChaos EngineeringResilience Testing

Time-Series Databases Don't Need Functional Tests. They Need Chaos

Testing a high-performance distributed time-series database like openGemini with traditional functional assertions is a waste of cycles. The only meaningful quality metric for such systems is their resilience to failure and their ability to maintain data integrity under extreme duress, not whether a single query returns the right value in isolation.

November 5, 2026
8 min read
RS
Raju Shanigarapu

The biggest mistake QA teams make with distributed time-series databases like openGemini is applying a traditional application-testing mindset. They write tests verifying correct data ingestion and retrieval, focusing on "happy path" functionality. This approach completely misses the point: the core value proposition of a distributed TSDB isn't its basic CRUD operations, but its ability to reliably store and serve data at scale, under pressure, and through failure. You're not testing a single endpoint; you're verifying a complex system's resilience.

Your SELECT * Tests Are Useless Here

Verifying that an INSERT followed by a SELECT returns the expected data is a trivial exercise for any database, distributed or not. For a system like openGemini, designed for high concurrency and massive data volumes, such tests offer almost zero value. They confirm the most basic, least interesting aspect of the system. What they fail to address are the real-world scenarios: network partitions, node crashes, disk saturation, out-of-order writes, and the intricate dance of replication and eventual consistency.

When Mendix was building its platform, the real challenges came from understanding how data integrity held up when underlying services flaked out, not whether a basic API call worked. Your test suite for a distributed time-series database should spend less time on functional assertions and more time on introducing controlled chaos. If a system claims high availability and fault tolerance, prove it by actively injecting faults, not by running a green-path script.

The Illusion of Performance Benchmarks

Most QA teams define performance testing as running a load generator against a stable cluster and measuring throughput or latency. This generates impressive graphs, but it's a deceptive exercise. A single, isolated performance benchmark on a pristine openGemini cluster tells you nothing about its behavior when a data node suddenly restarts, or when the network experiences transient packet loss, or when a compaction process kicks off under heavy write load. These are the real performance characteristics that impact production.

The true performance test for a distributed system is its ability to maintain its service level objectives (SLOs) while undergoing various failure modes. It's about consistent query times when half the cluster is recovering, or ingestion rates holding steady during a rolling upgrade. Anything less is just benchmarking a laboratory setup, not a production-ready system. As someone who spent years testing broadband devices at Liberty Global, I've seen firsthand how a system can pass every "performance" test in isolation and still crumble under real-world, unpredictable conditions.

Data Integrity Under Duress, Not Just Consistency

When dealing with distributed systems, especially those handling time-series data where order and timestamps are critical, data integrity takes on new dimensions. It's not just about eventual consistency; it's about what happens to data when consistency temporarily breaks down. Can openGemini handle out-of-order writes gracefully? What if a series of writes arrives during a network split, and then the partitions merge? Will data be silently dropped, duplicated, or corrupted?

Traditional assertion-based testing cannot fully verify this. Instead, you need to generate a known dataset, inject faults, and then perform deep validation checks on the entire dataset. This involves more than just querying recent points; it means statistical analysis of the stored data, checksums, and cross-referencing against the expected input stream. You need to verify that all data, not just the easily accessible data, remains intact and accurate.

Building Chaos Into the Test Loop

Integrating chaos engineering principles into your QA strategy for openGemini is non-negotiable. This isn't about running ad-hoc experiments; it's about repeatable, automated fault injection as part of your CI/CD pipeline. Tools like Chaos Mesh or LitmusChaos offer powerful ways to introduce network latency, pod failures, or resource exhaustion. The goal is to make these failures commonplace during testing, so the system is constantly proving its resilience.

Consider a Python-based test that uses Docker Compose to spin up an openGemini cluster, injects data, restarts a data node, and then verifies data integrity and query performance. Here's a simplified example of how you might script a node restart and data verification:

import docker
import time
import subprocess
import json

# Ensure openGemini is set up with docker-compose for this example
# docker-compose.yml might look like:
# version: '3.8'
# services:
#   meta:
#     image: openGemini/openGemini:latest
#     command: ["/usr/bin/openGemini", "run", "-config", "/etc/openGemini/meta.conf"]
#     ports:
#       - "8088:8088"
#   data:
#     image: openGemini/openGemini:latest
#     command: ["/usr/bin/openGemini", "run", "-config", "/etc/openGemini/data.conf"]
#     ports:
#       - "8086:8086"
#       - "8081:8081"
#     depends_on:
#       - meta

def run_command(cmd, check_result=True, capture_output=False):
    """Helper to run shell commands."""
    print(f"Running command: {' '.join(cmd)}")
    result = subprocess.run(cmd, capture_output=capture_output, text=True, check=check_result)
    if capture_output:
        return result.stdout.strip()
    return result

def setup_opengaemini_cluster():
    """Starts the openGemini cluster using docker-compose."""
    print("Setting up openGemini cluster...")
    run_command(["docker-compose", "up", "-d"])
    time.sleep(15) # Give services time to start
    print("openGemini cluster started.")

def inject_data(num_points=1000):
    """Injects sample time-series data into openGemini."""
    print(f"Injecting {num_points} data points...")
    # Using openGemini's HTTP API for simplicity
    # Assumes 'data' service is accessible on 8086
    data_points = []
    for i in range(num_points):
        timestamp = int(time.time() * 1000000000) - (num_points - i) * 1000000000 # Decreasing timestamp for demo
        data_points.append(f"cpu,host=server01 value={i} {timestamp}")
    
    payload = "\n".join(data_points)
    
    cmd = [
        "curl", "-s", "-i", "-XPOST", "http://localhost:8086/write?db=telegraf",
        "--data-binary", payload
    ]
    run_command(cmd)
    print("Data injection complete.")
    time.sleep(5) # Give time for data to be written

def query_data(db_name="telegraf"):
    """Queries all data from a specified database."""
    print(f"Querying data from {db_name}...")
    cmd = [
        "curl", "-G", "http://localhost:8086/query",
        "--data-urlencode", "db=telegraf",
        "--data-urlencode", "q=SELECT * FROM cpu"
    ]
    response = run_command(cmd, capture_output=True)
    try:
        data = json.loads(response)
        series = data.get("results", [])[0].get("series", [])
        if not series:
            return []
        
        # Extract values for verification
        # Assuming 'time', 'host', 'value' columns
        points = []
        for s in series:
            columns = s['columns']
            values = s['values']
            for row in values:
                point = dict(zip(columns, row))
                points.append(point)
        return points
    except json.JSONDecodeError:
        print(f"Failed to decode JSON: {response}")
        return []

def restart_data_node():
    """Restarts the 'data' service container."""
    print("Restarting openGemini 'data' node...")
    run_command(["docker-compose", "restart", "data"])
    time.sleep(20) # Give time for node to restart and rejoin cluster
    print("openGemini 'data' node restarted.")

def teardown_cluster():
    """Stops and removes the openGemini cluster."""
    print("Tearing down openGemini cluster...")
    run_command(["docker-compose", "down", "-v"])
    print("openGemini cluster torn down.")

if __name__ == "__main__":
    try:
        setup_opengaemini_cluster()
        initial_data_count = 100
        inject_data(num_points=initial_data_count)
        
        # Verify initial data
        retrieved_data_before_restart = query_data()
        assert len(retrieved_data_before_restart) == initial_data_count, \
               f"FAIL: Expected {initial_data_count} points before restart, got {len(retrieved_data_before_restart)}"
        print(f"Initial data verification passed: {len(retrieved_data_before_restart)} points found.")

        restart_data_node()

        # After restart, inject more data to test ongoing operation
        additional_data_count = 50
        inject_data(num_points=additional_data_count) # Inject more data after restart
        
        # Verify data after restart and additional injection
        retrieved_data_after_restart = query_data()
        
        expected_total_data = initial_data_count + additional_data_count
        assert len(retrieved_data_after_restart) == expected_total_data, \
               f"FAIL: Expected {expected_total_data} points after restart, got {len(retrieved_data_after_restart)}"
        print(f"Post-restart data verification passed: {len(retrieved_data_after_restart)} points found.")

        # Additional check: verify specific values if possible
        # For simplicity, just checking count here. In real world, you'd compare actual values.
        
        print("\nAll tests passed successfully: openGemini handled node restart and maintained data integrity.")

    except Exception as e:
        print(f"\nAn error occurred: {e}")
        import traceback
        traceback.print_exc()
        exit(1)
    finally:
        teardown_cluster()

This script demonstrates a basic integration of fault injection with data verification. The docker-compose.yml for openGemini would need to be in the same directory. This is a runnable example (assuming docker and docker-compose are installed, and curl is available), and it directly interacts with the openGemini services, simulating a common failure scenario.

Beyond Assertions: The Observability of Failure

For distributed systems, a simple assert statement in a test script is insufficient. You need to observe the system's internal state during and after fault injection. This means leveraging comprehensive monitoring tools like Prometheus and Grafana, which are natively supported by many time-series databases, including aspects of openGemini. Your tests shouldn't just pass or fail; they should generate metrics and logs that reveal how the system responded.

Monitor metrics like replication lag, compaction rates, disk I/O, CPU utilization, and query latencies during your chaos experiments. A test might pass its assert on data count, but if the recovery process caused a 5-minute spike in query latency or a temporary loss of write availability that went unnoticed, you've missed a critical quality defect. QA engineers who can't interpret these operational metrics are flying blind. Your CI/CD dashboard should show more than green checks; it should display the system's vital signs under stress.

Where This Breaks Down

This aggressive, chaos-oriented testing approach is not a silver bullet. It requires a significantly higher investment in infrastructure, scripting, and analytical skills within the QA team. Setting up a reliable, repeatable distributed environment for fault injection is complex, and debugging failures in such an environment can be extremely time-consuming. Furthermore, the sheer volume of data involved in time-series systems means that deep data integrity checks can be computationally expensive, potentially slowing down CI loops. It also presumes that the system under test, like openGemini, provides sufficient internal observability to make sense of the chaos. Without robust metrics and logging, chaos testing becomes a blind exercise in breaking things without understanding why or how they broke.

One Actionable Step This Week

Identify one critical component of your openGemini (or similar TSDB) deployment – perhaps a single data node. This week, write an automated test that simulates the graceful restart of that node, then immediately verifies the consistency and availability of recently written data. Don't just check for errors; check for data loss and latency spikes during the recovery period using Prometheus metrics. This is the bare minimum for proving resilience.

Want to build systems that work this way?

I work with QA engineers and engineering teams on automation architecture, framework audits, and AI-powered quality systems.

Get posts like this in your inbox

No fluff. Sharp takes on QA, AI, and engineering — once a week.

Sent with MailerLite. See the privacy policy.