Skip to content
This repository was archived by the owner on Jun 22, 2025. It is now read-only.

Commit 46c1ac5

Browse files
authored
More regression versions
1 parent 2ea18c1 commit 46c1ac5

14 files changed

+104
-15
lines changed

.github/workflows/tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,15 @@ jobs:
123123
- 'yandex/clickhouse-server:20.3'
124124
- 'yandex/clickhouse-server:20.6'
125125
- 'yandex/clickhouse-server:20.9'
126+
- 'yandex/clickhouse-server:20.12'
126127
- 'clickhouse/clickhouse-server:21.3'
128+
- 'clickhouse/clickhouse-server:21.7'
127129
- 'clickhouse/clickhouse-server:21.9'
130+
- 'clickhouse/clickhouse-server:21.12'
128131
- 'clickhouse/clickhouse-server:22.3'
132+
- 'clickhouse/clickhouse-server:22.6'
133+
- 'clickhouse/clickhouse-server:22.9'
134+
- 'clickhouse/clickhouse-server:22.12'
129135
services:
130136
clickhouse:
131137
image: ${{ matrix.tag }}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using System;
2+
using NUnit.Framework;
3+
using NUnit.Framework.Interfaces;
4+
using NUnit.Framework.Internal;
5+
6+
namespace ClickHouse.Client.Tests.Attributes;
7+
8+
/// <summary>
9+
/// Ignores test if launched on specific ClickHouse version
10+
/// </summary>
11+
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
12+
public class IgnoreInVersionAttribute : NUnitAttribute, IApplyToTest
13+
{
14+
int major;
15+
int minor;
16+
int build;
17+
int revision;
18+
19+
public IgnoreInVersionAttribute(int major, int minor = -1, int build = -1, int revision = -1)
20+
{
21+
this.major = major;
22+
this.minor = minor;
23+
this.build = build;
24+
this.revision = revision;
25+
}
26+
27+
public void ApplyToTest(Test test)
28+
{
29+
if (test.RunState == RunState.NotRunnable)
30+
return;
31+
32+
var server = TestUtilities.ServerVersion;
33+
34+
if (server == null)
35+
return; // 'latest' version
36+
37+
if (major != server.Major)
38+
return;
39+
if (minor != -1 && minor != server.Minor)
40+
return;
41+
if (build != -1 && minor != server.Minor)
42+
return;
43+
if (revision != -1 && revision != server.Revision)
44+
return;
45+
46+
test.RunState = RunState.Ignored;
47+
test.MakeTestResult().RecordAssertion(new AssertionResult(AssertionStatus.Inconclusive, $"Test ignored in ClickHouse version {server}", null));
48+
}
49+
}

ClickHouse.Client.Tests/RequiredFeatureAttribute.cs renamed to ClickHouse.Client.Tests/Attributes/RequiredFeatureAttribute.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using NUnit.Framework.Interfaces;
55
using NUnit.Framework.Internal;
66

7-
namespace ClickHouse.Client.Tests;
7+
namespace ClickHouse.Client.Tests.Attributes;
88

99
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
1010
public class RequiredFeatureAttribute : NUnitAttribute, IApplyToTest
@@ -19,9 +19,7 @@ public RequiredFeatureAttribute(Feature feature)
1919
public void ApplyToTest(Test test)
2020
{
2121
if (test.RunState == RunState.NotRunnable)
22-
{
2322
return;
24-
}
2523

2624
if (!TestUtilities.SupportedFeatures.HasFlag(feature))
2725
{

ClickHouse.Client.Tests/BulkCopyTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Threading.Tasks;
88
using ClickHouse.Client.ADO;
99
using ClickHouse.Client.Copy;
10+
using ClickHouse.Client.Tests.Attributes;
1011
using ClickHouse.Client.Utility;
1112
using NUnit.Framework;
1213

ClickHouse.Client.Tests/DefaultSettingsTests.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
using ClickHouse.Client.ADO;
1+
using ClickHouse.Client.ADO;
72
using NUnit.Framework;
83

94
namespace ClickHouse.Client.Tests
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using ClickHouse.Client.Tests.Attributes;
7+
using NUnit.Framework;
8+
9+
namespace ClickHouse.Client.Tests;
10+
11+
public class IgnoreInVersionAttributeTests : AbstractConnectionTestFixture
12+
{
13+
[Test]
14+
[IgnoreInVersion(21)]
15+
public void ShouldNotRunInVersion21() => Assert.That(!connection.ServerVersion.StartsWith("21"));
16+
17+
[Test]
18+
[IgnoreInVersion(22)]
19+
public void ShouldNotRunInVersion22() => Assert.That(!connection.ServerVersion.StartsWith("22"));
20+
21+
[Test]
22+
[IgnoreInVersion(21)]
23+
[IgnoreInVersion(22)]
24+
public void ShouldNotRunInVersion21or22()
25+
{
26+
Assert.That(!connection.ServerVersion.StartsWith("21"));
27+
Assert.That(!connection.ServerVersion.StartsWith("22"));
28+
}
29+
30+
[Test]
31+
[IgnoreInVersion(22, 6)]
32+
public void ShouldNotRunInVersion22dot6() => Assert.That(!connection.ServerVersion.StartsWith("22.6"));
33+
}

ClickHouse.Client.Tests/Numerics/ClickHouseDecimalTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using ClickHouse.Client.ADO;
88
using ClickHouse.Client.Numerics;
99
using ClickHouse.Client.Utility;
10+
using ClickHouse.Client.Tests.Attributes;
1011

1112
namespace ClickHouse.Client.Tests.Numerics;
1213

ClickHouse.Client.Tests/Numerics/ClickHouseOldDecimalSqlTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Linq;
44
using System.Threading.Tasks;
55
using ClickHouse.Client.ADO;
6-
using ClickHouse.Client.Numerics;
76
using ClickHouse.Client.Types;
87
using ClickHouse.Client.Utility;
98
using NUnit.Framework;

ClickHouse.Client.Tests/ParameterizedInsertTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Threading.Tasks;
33
using ClickHouse.Client.ADO;
4+
using ClickHouse.Client.Tests.Attributes;
45
using ClickHouse.Client.Utility;
56
using NUnit.Framework;
67

ClickHouse.Client.Tests/SessionConnectionTest.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
using System.Data.Common;
33
using System.Threading.Tasks;
44
using ClickHouse.Client.ADO;
5+
using ClickHouse.Client.Tests.Attributes;
56
using ClickHouse.Client.Utility;
67
using NUnit.Framework;
78

89
namespace ClickHouse.Client.Tests;
910

1011
public class SessionConnectionTest
1112
{
12-
private DbConnection CreateConnection(bool useSession, string sessionId = null)
13+
private static DbConnection CreateConnection(bool useSession, string sessionId = null)
1314
{
1415
var builder = TestUtilities.GetConnectionStringBuilder();
1516
builder.UseSession = useSession;
@@ -37,7 +38,7 @@ public async Task TempTableShouldBeCreatedSuccessfullyIfSessionIdPassed()
3738
}
3839

3940
[Test]
40-
[Ignore("Broken in v23+")]
41+
[Ignore("Broken in v23")]
4142
public async Task TempTableShouldFailIfSessionDisabled()
4243
{
4344
using var connection = CreateConnection(false);
@@ -52,7 +53,7 @@ public async Task TempTableShouldFailIfSessionDisabled()
5253
}
5354

5455
[Test]
55-
[Ignore("Broken in v23+")]
56+
[Ignore("Broken in v23")]
5657
public async Task TempTableShouldFailIfSessionDisabledAndSessionIdPassed()
5758
{
5859
using var connection = CreateConnection(false, "ASD");

0 commit comments

Comments
 (0)