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
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
dotnet-version: '9.0.x'
- name: Restore dependencies
run: dotnet restore "src/Apache.IoTDB/Apache.IoTDB.csproj"
- name: Check License Header
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/e2e-multinode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: E2E Tests in MultiNode IoTDB

on:
push:
branches: [ main, dev/* ]
pull_request:
branches: [ main ]

jobs:

build:
name: e2e test in MultiNode IoTDB
runs-on: ubuntu-latest
steps:

- name: Check out code into the CSharp module directory
uses: actions/checkout@v4

- name: Set Docker & Run Test
run: |
docker compose -f docker-compose-2c2d.yml up --build --abort-on-container-exit --remove-orphans

- name: Clean IoTDB & Shut Down Docker
run: |
docker compose -f docker-compose-2c2d.yml down
133 changes: 133 additions & 0 deletions docker-compose-2c2d.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
version: "3"
services:

# ConfigNode 1
confignode-1:
image: apache/iotdb:2.0.1-beta-standalone
command: ["bash", "-c", "entrypoint.sh confignode"]
restart: always
healthcheck:
test: ["CMD", "ls", "/iotdb/data"]
interval: 3s
timeout: 5s
retries: 30
start_period: 30s
environment:
- cn_internal_address=127.0.0.1
- cn_internal_port=10710
- cn_consensus_port=10720
- cn_seed_config_node=127.0.0.1:10710
- schema_replication_factor=2
- data_replication_factor=2
privileged: true
volumes:
- ./iotdb/confignode-1/data:/iotdb/data
- ./iotdb/confignode-1/logs:/iotdb/logs
network_mode: host

# ConfigNode 2
confignode-2:
image: apache/iotdb:2.0.1-beta-standalone
command: ["bash", "-c", "entrypoint.sh confignode"]
restart: always
healthcheck:
test: ["CMD", "ls", "/iotdb/data"]
interval: 3s
timeout: 5s
retries: 30
start_period: 30s
environment:
- cn_internal_address=127.0.0.1
- cn_internal_port=10711
- cn_consensus_port=10721
- cn_seed_config_node=127.0.0.1:10710
- schema_replication_factor=2
- data_replication_factor=2
privileged: true
volumes:
- ./iotdb/confignode-2/data:/iotdb/data
- ./iotdb/confignode-2/logs:/iotdb/logs
network_mode: host

# DataNode 1
datanode-1:
image: apache/iotdb:2.0.1-beta-standalone
command: ["bash", "-c", "entrypoint.sh datanode"]
restart: always
healthcheck:
test: ["CMD", "ls", "/iotdb/data/datanode/system"]
interval: 10s
timeout: 60s
retries: 30
start_period: 30s
depends_on:
confignode-1:
condition: service_healthy
environment:
- dn_rpc_address=127.0.0.1
- dn_internal_address=127.0.0.1
- dn_seed_config_node=127.0.0.1:10710
- dn_rpc_port=6667
- dn_internal_port=10730
- dn_mpp_data_exchange_port=10740
- dn_schema_region_consensus_port=10750
- dn_data_region_consensus_port=10760
- schema_replication_factor=2
- data_replication_factor=2
privileged: true
volumes:
- ./iotdb/datanode-1/data:/iotdb/data
- ./iotdb/datanode-1/logs:/iotdb/logs
network_mode: host

# DataNode 2
datanode-2:
image: apache/iotdb:2.0.1-beta-standalone
command: ["bash", "-c", "entrypoint.sh datanode"]
restart: always
healthcheck:
test: ["CMD", "ls", "/iotdb/data/datanode/system"]
interval: 10s
timeout: 60s
retries: 30
start_period: 30s
depends_on:
confignode-1:
condition: service_healthy
confignode-2:
condition: service_healthy
environment:
- dn_rpc_address=127.0.0.1
- dn_internal_address=127.0.0.1
- dn_seed_config_node=127.0.0.1:10710
- dn_rpc_port=6668
- dn_internal_port=10731
- dn_mpp_data_exchange_port=10741
- dn_schema_region_consensus_port=10751
- dn_data_region_consensus_port=10761
- schema_replication_factor=2
- data_replication_factor=2
privileged: true
volumes:
- ./iotdb/datanode-2/data:/iotdb/data
- ./iotdb/datanode-2/logs:/iotdb/logs
network_mode: host

# C# Client
apache.iotdb.samples:
image: ${DOCKER_REGISTRY-}apacheiotdbsamples
depends_on:
confignode-1:
condition: service_healthy
confignode-2:
condition: service_healthy
datanode-1:
condition: service_healthy
datanode-2:
condition: service_healthy
build:
context: .
dockerfile: samples/Apache.IoTDB.Samples/Dockerfile
command: ["--multi", "localhost:6667", "localhost:6668"]
# command: ["sleep", "infinity"]
network_mode: host
15 changes: 0 additions & 15 deletions docker-compose.dcproj

This file was deleted.

1 change: 0 additions & 1 deletion docker-compose.override.yml

This file was deleted.

1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
build:
context: .
dockerfile: samples/Apache.IoTDB.Samples/Dockerfile
command: ["--single", "iotdb"]
networks:
iotdb-network:
ipv4_address: 172.18.0.2
Expand Down
3 changes: 2 additions & 1 deletion samples/Apache.IoTDB.Samples/Apache.IoTDB.Samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>
Expand All @@ -19,6 +19,7 @@
<PackageReference Include="ConsoleTableExt" Version="3.2.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.0.1" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions samples/Apache.IoTDB.Samples/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base
FROM mcr.microsoft.com/dotnet/runtime:9.0 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY ["samples/Apache.IoTDB.Samples/Apache.IoTDB.Samples.csproj", "samples/Apache.IoTDB.Samples/"]
COPY ["src/Apache.IoTDB/Apache.IoTDB.csproj", "src/Apache.IoTDB/"]
Expand Down
47 changes: 45 additions & 2 deletions samples/Apache.IoTDB.Samples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,64 @@

using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using System;
using System.Threading.Tasks;
using System.CommandLine;
using System.Collections.Generic;
using System;

namespace Apache.IoTDB.Samples
{
public static class Program
{
public static async Task Main(string[] args)
{
var singleOption = new Option<string>(
"--single",
() => "localhost",
description: "Use single endpoint (e.g. --single localhost)");

var multiOption = new Option<List<string>>(
"--multi",
description: "Use multiple endpoints (e.g. --multi localhost:6667 localhost:6668)")
{
AllowMultipleArgumentsPerToken = true
};

var rootCommand = new RootCommand
{
singleOption,
multiOption
};

rootCommand.SetHandler(async (string single, List<string> multi) =>
{
var utilsTest = new UtilsTest();
utilsTest.TestParseEndPoint();
var sessionPoolTest = new SessionPoolTest("iotdb");

SessionPoolTest sessionPoolTest;

if (!string.IsNullOrEmpty(single) && (multi == null || multi.Count == 0))
{
sessionPoolTest = new SessionPoolTest(single);
}
else if (multi != null && multi.Count != 0)
{
sessionPoolTest = new SessionPoolTest(multi);
}
else
{
Console.WriteLine("Please specify either --single or --multi endpoints.");
return;
}

await sessionPoolTest.Test();

var tableSessionPoolTest = new TableSessionPoolTest(sessionPoolTest);
await tableSessionPoolTest.Test();

}, singleOption, multiOption);

await rootCommand.InvokeAsync(args);
}

public static void OpenDebugMode(this SessionPool session)
Expand Down
Loading
Loading