Files
greptimedb/tests-integration
dennis zhuang c2a66803ff fix(mito2): read narthex tables partitioned on a non-tag column (#10665)
* fix(mito2): report one identity for a narthex series across regions

Prepared narthex reads with explicit labels prefixed each series key with
the region id. The prefix dates from when identity was the (table_id, tsid)
hash and kept colliding series in different regions apart. Since #10330 the
key is the exact sparse key, so the prefix protects nothing, but it still
gives the fragments of one series in two regions different primary keys.
SeriesRepartitionExec groups raw chunks by primary key, so those fragments
never met in one owner: native PromQL returned duplicate series or failed
with "input repeated an exact series identity" on a time-partitioned table.

Use the exact key as the only candidate key and drop the separate merge
key. The storage-api and raw chunk docs now require the identity to be the
same in every region instead of allowing a region-qualified one.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix(mito2): filter narthex rows by a non-tag partition rule

A narthex scan applied the region's partition rule to series-index rows
during discovery. Those rows carry tags only, so a rule on any other
column, such as `PARTITION ON COLUMNS (ts)`, failed to compile against
them, and every read of such a region failed with "Failed to coerce
partition expr against the schema", in SQL and PromQL alike.

Keep series-level filtering for rules that reference tags only. Apply any
other rule to sample rows, with the series' own values for the tags the
rule references, since a file shared after repartition can hold rows of
both partitions within one series. Compaction reads without the region
predicate, so this filter is the only thing that keeps the other
partition's rows out of its output.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* test(promql): check native reads of a time-partitioned narthex table

Every series of a narthex table partitioned on the time index is split
across two regions. Native PromQL over it, and SQL, must answer like the
same rows held whole in one default-storage region, standalone and
distributed. This covers both the partition rule on sample rows and the
region-independent series identity that lets the frontend merge the
fragments.

The promql guide no longer claims that a series split across regions is
not merged.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix(mito2): value __table_id from the series in a sample partition rule

A partition rule that mixes `__table_id` with a non-tag column, which
repartitioning a metric table can produce, is evaluated on sample rows.
The filter looked `__table_id` up among the series' tag values, where the
series index never puts it, so every read of such a region failed with
"missing partition tag". Take it from the series' table ID instead.

The time-partition test now also covers a tag + time rule and a
`__table_id` + time rule.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* fix(promql): say which sample conflicts across regions and why

A raw merge that finds two different samples of one series at one
timestamp now names the series and the timestamp, and gives the likely
cause: a table partitioned on a non-tag column, with the sample written
on both sides of a partition bound, so each region kept one version.
Behavior is unchanged; the query still fails.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-11-27 12:10:37 +00:00
..

Setup tests for multiple storage backend

To run the integration test, please copy .env.example to .env in the project root folder and change the values on need.

Take s3 for example. You need to set your S3 bucket, access key id and secret key:

# Settings for s3 test
GT_S3_BUCKET=S3 bucket
GT_S3_REGION=S3 region
GT_S3_ACCESS_KEY_ID=S3 access key id
GT_S3_ACCESS_KEY=S3 secret access key

Run

Execute the following command in the project root folder:

cargo test integration

Test s3 storage:

cargo test s3

Test oss storage:

cargo test oss

Test azblob storage:

cargo test azblob

Setup tests with Kafka wal

To run the integration test, please copy .env.example to .env in the project root folder and change the values on need.

GT_KAFKA_ENDPOINTS = localhost:9092

Setup kafka standalone

cd tests-integration/fixtures

docker compose -f docker-compose.yml up kafka

Setup tests with etcd TLS

This guide explains how to set up and test TLS-enabled etcd connections in GreptimeDB integration tests.

Quick Start

TLS certificates are already at tests-integration/fixtures/etcd-tls-certs/.

  1. Start TLS-enabled etcd:

    cd tests-integration/fixtures
    docker compose up etcd-tls -d
    
  2. Start all services (including etcd-tls):

    cd tests-integration/fixtures
    docker compose up -d --wait
    

Certificate Details

The checked-in certificates include:

  • ca.crt - Certificate Authority certificate
  • server.crt / server-key.pem - Server certificate for etcd-tls service
  • client.crt / client-key.pem - Client certificate for connecting to etcd-tls

The server certificate includes SANs for localhost, etcd-tls, 127.0.0.1, and ::1.

Regenerating Certificates (Optional)

If you need to regenerate the etcd certificates:

# Regenerate certificates (overwrites existing ones)
./scripts/generate-etcd-tls-certs.sh

# Or generate in custom location
./scripts/generate-etcd-tls-certs.sh /path/to/cert/directory

If you need to regenerate the mysql and postgres certificates:

# Regenerate certificates (overwrites existing ones)
./scripts/generate_certs.sh

# Or generate in custom location
./scripts/generate_certs.sh /path/to/cert/directory

Note: The checked-in certificates are for testing purposes only and should never be used in production.