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
89 changes: 89 additions & 0 deletions ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Azure Pipeline for net-questdb-client
# Triggers on pull requests to main branch

trigger: none

pr:
branches:
include:
- main

variables:
buildConfiguration: 'Release'
dotnetVersion: '9.0.x'

strategy:
matrix:
Linux:
vmImage: 'ubuntu-latest'
osName: 'Linux'
Windows:
vmImage: 'windows-latest'
osName: 'Windows'
macOS:
vmImage: 'macOS-latest'
osName: 'macOS'

pool:
vmImage: $(vmImage)

steps:
- checkout: self
submodules: true
displayName: 'Checkout code with submodules'

- task: UseDotNet@2
displayName: 'Install .NET 6.0 SDK'
inputs:
packageType: 'sdk'
version: '6.0.x'
installationPath: $(Agent.ToolsDirectory)/dotnet

- task: UseDotNet@2
displayName: 'Install .NET 7.0 SDK'
inputs:
packageType: 'sdk'
version: '7.0.x'
installationPath: $(Agent.ToolsDirectory)/dotnet

- task: UseDotNet@2
displayName: 'Install .NET 8.0 SDK'
inputs:
packageType: 'sdk'
version: '8.0.x'
installationPath: $(Agent.ToolsDirectory)/dotnet

- task: UseDotNet@2
displayName: 'Install .NET 9.0 SDK'
inputs:
packageType: 'sdk'
version: $(dotnetVersion)
installationPath: $(Agent.ToolsDirectory)/dotnet

- task: DotNetCoreCLI@2
displayName: 'Restore dependencies'
inputs:
command: 'restore'
projects: 'net-questdb-client.sln'

- task: DotNetCoreCLI@2
displayName: 'Build solution'
inputs:
command: 'build'
projects: 'net-questdb-client.sln'
arguments: '--configuration $(buildConfiguration) --no-restore'

- task: DotNetCoreCLI@2
displayName: 'Run tests on $(osName)'
inputs:
command: 'test'
projects: 'src/net-questdb-client-tests/net-questdb-client-tests.csproj'
arguments: '--configuration $(buildConfiguration) --framework net9.0 --no-build --verbosity normal --logger trx --collect:"XPlat Code Coverage"'
publishTestResults: true

- task: PublishCodeCoverageResults@2
displayName: 'Publish code coverage'
inputs:
summaryFileLocation: '$(Agent.TempDirectory)/**/coverage.cobertura.xml'
codecoverageTool: 'cobertura'
condition: succeededOrFailed()
32 changes: 0 additions & 32 deletions ci/run_tests_pipeline.yaml

This file was deleted.

3 changes: 2 additions & 1 deletion src/dummy-http-server/DummyHttpServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@


using System.Diagnostics;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Text;
using FastEndpoints;
Expand Down Expand Up @@ -236,7 +237,7 @@ public string PrintBuffer()
case 16:
sb.Remove(sb.Length - 1, 1);
var doubleValue = MemoryMarshal.Cast<byte, double>(bytes.AsSpan().Slice(++i, 8));
sb.Append(doubleValue[0]);
sb.Append(doubleValue[0].ToString(CultureInfo.InvariantCulture));
i += 8;
i--;
break;
Expand Down
38 changes: 31 additions & 7 deletions src/net-questdb-client-tests/HttpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ await ls.Table("neg name")
}

[Test]
public async Task SerialiseDoubles()
public async Task SerialiseDoublesV2()
{
using var srv = new DummyHttpServer();
await srv.StartAsync(HttpPort);
Expand All @@ -728,7 +728,32 @@ await ls.Table("doubles")
await ls.SendAsync();

var expected =
"doubles d0=0,dm0=-0,d1=1,dE100=1E+100,d0000001=1E-06,dNaN=NaN,dInf=∞,dNInf=-∞ 86400000000000\n";
"doubles d0=0,dm0=-0,d1=1,dE100=1E+100,d0000001=1E-06,dNaN=NaN,dInf=Infinity,dNInf=-Infinity 86400000000000\n";
Assert.That(srv.PrintBuffer(), Is.EqualTo(expected));
}

[Test]
public async Task SerialiseDoublesV1()
{
using var srv = new DummyHttpServer();
await srv.StartAsync(HttpPort);

using var ls = Sender.New($"http::addr={Host}:{HttpPort};auto_flush=off;protocol_version=1;");

await ls.Table("doubles")
.Column("d0", 0.0)
.Column("dm0", -0.0)
.Column("d1", 1.0)
.Column("dE100", 1E100)
.Column("d0000001", 0.000001)
.Column("dNaN", double.NaN)
.Column("dInf", double.PositiveInfinity)
.Column("dNInf", double.NegativeInfinity)
.AtAsync(86400000000000);
await ls.SendAsync();

var expected =
"doubles d0=0,dm0=-0,d1=1,dE100=1E+100,d0000001=1E-06,dNaN=NaN,dInf=Infinity,dNInf=-Infinity 86400000000000\n";
Assert.That(srv.PrintBuffer(), Is.EqualTo(expected));
}

Expand Down Expand Up @@ -886,7 +911,7 @@ public async Task InvalidNames()
await senderLim127.AtAsync(new DateTime(1970, 1, 1));
await senderLim127.SendAsync();

var expected = "abcd.csv,b\\ \\ \\ \\ c=12 000\n";
var expected = "abcd.csv,b\\ \\ \\ \\ c=12 0\n";
Assert.That(srv.PrintBuffer(), Is.EqualTo(expected));
}

Expand Down Expand Up @@ -1193,15 +1218,14 @@ public async Task TransactionMultipleTypes()
await sender.Transaction("tableName").Symbol("foo", "bah").AtAsync(86400000000000);
await sender.Column("foo", 123).AtAsync(86400000000000);
await sender.Column("foo", 123d).AtAsync(86400000000000);
await sender.Column("foo", new DateTime(1970, 1, 1)).AtAsync(86400000000000);
await sender.Column("foo", new DateTimeOffset(new DateTime(1970, 1, 1))).AtAsync(86400000000000);
await sender.Column("foo", new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).AtAsync(86400000000000);
await sender.Column("foo", new DateTimeOffset(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc))).AtAsync(86400000000000);
await sender.Column("foo", false).AtAsync(86400000000000);


await sender.CommitAsync();

var expected =
"tableName,foo=bah 86400000000000\ntableName foo=123i 86400000000000\ntableName foo=123 86400000000000\ntableName foo=0n 86400000000000\ntableName foo=-3600000000000n 86400000000000\ntableName foo=f 86400000000000\n";
"tableName,foo=bah 86400000000000\ntableName foo=123i 86400000000000\ntableName foo=123 86400000000000\ntableName foo=0n 86400000000000\ntableName foo=0n 86400000000000\ntableName foo=f 86400000000000\n";
Assert.That(srv.PrintBuffer(), Is.EqualTo(expected));
}

Expand Down
6 changes: 3 additions & 3 deletions src/net-questdb-client-tests/SenderOptionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ public void BindConfigFileToOptions()
[Test]
public void UseOffInAutoFlushSettings()
{
var sender =
Sender.New(
var senderOptions =
new SenderOptions(
"http::addr=localhost:9000;auto_flush=on;auto_flush_rows=off;auto_flush_bytes=off;auto_flush_interval=off;");

Assert.That(sender.Options.ToString(),
Assert.That(senderOptions.ToString(),
Is.EqualTo(
"http::addr=localhost:9000;auth_timeout=15000;auto_flush=on;auto_flush_bytes=-1;auto_flush_interval=-1;auto_flush_rows=-1;init_buf_size=65536;max_buf_size=104857600;max_name_len=127;pool_timeout=120000;protocol_version=Auto;request_min_throughput=102400;request_timeout=10000;retry_timeout=10000;tls_verify=on;"));
}
Expand Down
5 changes: 4 additions & 1 deletion src/net-questdb-client-tests/SenderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace net_questdb_client_tests;
public class SenderTests
{
[Test]
[Explicit]
public void PostConfStrInitialisation()
{
var confStr = "http::addr=localhost:9000;";
Expand All @@ -27,6 +28,7 @@ public void PostConfStrInitialisation()
public void SenderWithPrebuiltOptions()
{
var options = new SenderOptions();
options.protocol_version = ProtocolVersion.V1;
var sender = Sender.New(options);
Assert.That(
sender.Options.ToString(),
Expand All @@ -38,7 +40,8 @@ public void SenderWithPrebuiltOptions()
public void SenderWithNullOptions()
{
var options = new SenderOptions();
var sender = Sender.New();
options.protocol_version = ProtocolVersion.V1;
var sender = Sender.Configure($"http::addr=localhost:9000;protocol_version=1;").Build();
Assert.That(
sender.Options.ToString(),
Is.EqualTo(options.ToString())
Expand Down
2 changes: 1 addition & 1 deletion src/net-questdb-client-tests/TcpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ public async Task InvalidNames()
await senderLim127.AtAsync(new DateTime(1970, 1, 1));
await senderLim127.SendAsync();

var expected = "abcd.csv,b\\ \\ \\ \\ c=12 000\n";
var expected = "abcd.csv,b\\ \\ \\ \\ c=12 0\n";
WaitAssert(srv, expected);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<RootNamespace>net_questdb_client_tests</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down