Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/e2e-1c1d.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ on:

jobs:
e2e-1c1d:
name: E2E Test with 1 ConfigNode and 1 DataNode
name: E2E 1C1D (iotdb ${{ matrix.iotdb-version }})
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
iotdb-version: ["2.0.6", "2.0.10"]

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -31,6 +35,8 @@ jobs:
run: mkdir -p test-results

- name: Start IoTDB with Docker Compose
env:
IOTDB_VERSION: ${{ matrix.iotdb-version }}
run: |
docker compose -f docker-compose-1c1d.yml up -d
echo "Waiting for IoTDB to be ready..."
Expand Down Expand Up @@ -80,5 +86,5 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-test-results-1c1d
name: e2e-test-results-1c1d-iotdb-${{ matrix.iotdb-version }}
path: test-results/
12 changes: 9 additions & 3 deletions .github/workflows/e2e-1c3d.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ on:

jobs:
e2e-1c3d:
name: E2E Test with 1 ConfigNode and 3 DataNodes
name: E2E 1C3D (iotdb ${{ matrix.iotdb-version }})
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
iotdb-version: ["2.0.6", "2.0.10"]

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -31,6 +35,8 @@ jobs:
run: mkdir -p test-results

- name: Start IoTDB Cluster with Docker Compose
env:
IOTDB_VERSION: ${{ matrix.iotdb-version }}
run: |
docker compose -f docker-compose-1c3d.yml up -d
echo "Waiting for IoTDB cluster to be ready..."
Expand Down Expand Up @@ -93,5 +99,5 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-test-results-1c3d
name: e2e-test-results-1c3d-iotdb-${{ matrix.iotdb-version }}
path: test-results/
4 changes: 2 additions & 2 deletions docker-compose-1c1d.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
iotdb-datanode:
image: apache/iotdb:2.0.6-datanode
image: apache/iotdb:${IOTDB_VERSION:-2.0.6}-datanode
container_name: iotdb-datanode
restart: always
depends_on:
Expand All @@ -24,7 +24,7 @@ services:
- CONFIGNODE_JMX_OPTS=-Xms384M -Xmx384M -XX:MaxDirectMemorySize=192M

iotdb-confignode:
image: apache/iotdb:2.0.6-confignode
image: apache/iotdb:${IOTDB_VERSION:-2.0.6}-confignode
container_name: iotdb-confignode
restart: always
healthcheck:
Expand Down
8 changes: 4 additions & 4 deletions docker-compose-1c3d.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
# ConfigNode (single instance for metadata management)
iotdb-confignode:
image: apache/iotdb:2.0.6-confignode
image: apache/iotdb:${IOTDB_VERSION:-2.0.6}-confignode
container_name: iotdb-confignode
restart: always
healthcheck:
Expand All @@ -23,7 +23,7 @@ services:

# DataNode 1
iotdb-datanode-1:
image: apache/iotdb:2.0.6-datanode
image: apache/iotdb:${IOTDB_VERSION:-2.0.6}-datanode
container_name: iotdb-datanode-1
restart: always
healthcheck:
Expand Down Expand Up @@ -51,7 +51,7 @@ services:

# DataNode 2
iotdb-datanode-2:
image: apache/iotdb:2.0.6-datanode
image: apache/iotdb:${IOTDB_VERSION:-2.0.6}-datanode
container_name: iotdb-datanode-2
restart: always
healthcheck:
Expand Down Expand Up @@ -79,7 +79,7 @@ services:

# DataNode 3
iotdb-datanode-3:
image: apache/iotdb:2.0.6-datanode
image: apache/iotdb:${IOTDB_VERSION:-2.0.6}-datanode
container_name: iotdb-datanode-3
restart: always
healthcheck:
Expand Down
53 changes: 35 additions & 18 deletions tests/e2e/Redirection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,33 @@ describe("Redirection E2E Tests", () => {
let tablePool: TableSessionPool;
let isConnected = false;

// Rows written through redirects land on different DataNodes; with
// data_replication_factor=2 the last write may not be visible to an
// immediate query yet. Poll briefly instead of asserting right away.
async function countRowsWithRetry(
pool: SessionPool | TableSessionPool,
sql: string,
minRows: number,
attempts = 5,
delayMs = 1000,
): Promise<number> {
let rowCount = 0;
for (let attempt = 0; attempt < attempts; attempt++) {
const dataSet = await pool.executeQueryStatement(sql);
rowCount = 0;
while (await dataSet.hasNext()) {
dataSet.next();
rowCount++;
}
await dataSet.close();
if (rowCount >= minRows) {
return rowCount;
}
await new Promise((resolve) => setTimeout(resolve, delayMs));
}
return rowCount;
}

beforeAll(async () => {
// Skip redirection tests if not in multi-node environment
if (!IS_MULTI_NODE) {
Expand Down Expand Up @@ -175,17 +202,12 @@ describe("Redirection E2E Tests", () => {
}

// Verify data was written successfully by querying
const dataSet = await treePool.executeQueryStatement(
"SELECT * FROM root.test_redirect.**"
const rowCount = await countRowsWithRetry(
treePool,
"SELECT * FROM root.test_redirect.**",
5,
);

let rowCount = 0;
while (await dataSet.hasNext()) {
dataSet.next();
rowCount++;
}
await dataSet.close();

// We should have at least 5 rows (one per device)
expect(rowCount).toBeGreaterThanOrEqual(5);
});
Expand Down Expand Up @@ -287,17 +309,12 @@ describe("Redirection E2E Tests", () => {
}

// Verify data was written successfully
const dataSet = await tablePool.executeQueryStatement(
"SELECT * FROM sensor_data"
const rowCount = await countRowsWithRetry(
tablePool,
"SELECT * FROM sensor_data",
5,
);

let rowCount = 0;
while (await dataSet.hasNext()) {
dataSet.next();
rowCount++;
}
await dataSet.close();

expect(rowCount).toBeGreaterThanOrEqual(5);
});
});
Expand Down
Loading