openzipkin/zipkin · info · TestAbortedException

Could not connect to storage, skipping test

Error message

Could not connect to storage, skipping test: {}

What it means

ITStorage.checkStorage throws TestAbortedException ('Could not connect to storage, skipping test') when storage.check() reports a failure. This is Zipkin's integration-test harness: when the backing store (MySQL, Cassandra, Elasticsearch, ...) is unreachable, tests are skipped as aborted rather than failed, so CI without the storage dependency still passes.

Solutions

  1. Start the storage backend first (docker-compose up, Testcontainers, or a local MySQL/Cassandra/ES) and confirm you can connect with the same credentials.
  2. Set the connection env vars the module expects (e.g. MYSQL_HOST, CASSANDRA_CONTACT_POINTS, STORAGE_TYPE) before running the tests.
  3. If startup is slow, increase the readiness wait so checkStorage runs only after the port actually accepts connections.

Example fix

# before: storage not running, tests abort
mvn test -pl zipkin-storage/zipkin-mysql

# after: start storage, then run tests
docker run -d -p 3306:3306 -e MYSQL_USER=zipkin -e MYSQL_PASSWORD=zipkin mysql:8
mvn test -pl zipkin-storage/zipkin-mysql
Defensive patterns

Strategy: fallback

Validate before calling

// before running ITs, verify the storage endpoint is reachable
try (Socket s = new Socket()) { s.connect(new InetSocketAddress(host, port), 2000); }

Try / catch

catch (TestAbortedException e) { /* storage unavailable: log and mark build as unstable rather than failed */ }

Prevention

When it happens

Trigger: Running an IT- prefixed integration test (e.g. ITMySQLStorage) while the storage container/database is not running, credentials are wrong, or the storage is not yet ready (race at container startup).

Common situations: Docker daemon not running so the test container never starts; the database takes longer to accept connections than the test's startup wait; wrong host/port env vars; a new storage version that changes the health-check handshake.

Related errors


AI-assisted analysis of openzipkin/zipkin@878ce2a1fa (2026-08-14). Data as JSON: /api/errors/5bf51b47c8d7ed64. Report an issue: GitHub.

Appendix: source

Thrown at zipkin-tests/src/main/java/zipkin2/storage/ITStorage.java:55

    if (!initializeStoragePerTest()) return;
    doInitializeStorage(testInfo);
  }

  void doInitializeStorage(TestInfo testInfo) {
    StorageComponent.Builder builder = newStorageBuilder(testInfo);
    configureStorageForTest(builder);
    // TODO(anuraaga): It wouldn't be difficult to allow storage builders to be parameterized by
    // their storage type.
    @SuppressWarnings("unchecked")
    T storage = (T) builder.build();
    this.storage = storage;
    checkStorage();
  }

  protected void checkStorage() {
    CheckResult check = storage.check();
    if (!check.ok()) {
      throw new TestAbortedException("Could not connect to storage, skipping test: "
        + check.error().getMessage(), check.error());
    }
  }

  @AfterAll void closeStorage() throws Exception {
    if (initializeStoragePerTest()) return;
    storage.close();
  }

  @AfterEach void closeStorageForTest() throws Exception {
    if (!initializeStoragePerTest()) return;
    storage.close();
  }

  @AfterEach void clearStorage() throws Exception {
    clear();
  }

View on GitHub (pinned to 878ce2a1fa)