1
+ using Xunit ;
1
2
using System . Diagnostics ;
2
3
3
4
namespace TrailBase ;
4
5
5
6
public static class Constants {
6
- public const int Port = 4007 ;
7
+ public static int Port = 4010 + System . Environment . Version . Major ;
7
8
}
8
9
9
10
class SimpleStrict {
@@ -113,9 +114,16 @@ public async Task RecordsTest() {
113
114
var api = client . Records ( "simple_strict_table" ) ;
114
115
115
116
var now = DateTimeOffset . Now . ToUnixTimeSeconds ( ) ;
117
+
118
+ // Dotnet runs tests for multiple target framework versions in parallel.
119
+ // Each test currently brings up its own server but pointing at the same
120
+ // underlying database file. We include the runtime version in the filter
121
+ // query to avoid a race between both tests. This feels a bit hacky.
122
+ // Ideally, we'd run the tests sequentially or with better isolation :/.
123
+ var suffix = $ "{ now } { System . Environment . Version } ";
116
124
List < string > messages = [
117
- $ "C# client test 0: { now } ",
118
- $ "C# client test 1: { now } ",
125
+ $ "C# client test 0: { suffix } ",
126
+ $ "C# client test 1: { suffix } ",
119
127
] ;
120
128
121
129
List < RecordId > ids = [ ] ;
@@ -136,15 +144,15 @@ public async Task RecordsTest() {
136
144
var recordsAsc = await api . List < SimpleStrict > (
137
145
null ,
138
146
[ "+text_not_null" ] ,
139
- [ $ "text_not_null[like]=%{ now } "]
147
+ [ $ "text_not_null[like]=%{ suffix } "]
140
148
) ! ;
141
149
Assert . Equal ( messages . Count , recordsAsc . Count ) ;
142
150
Assert . Equal ( messages , recordsAsc . ConvertAll ( ( e ) => e . text_not_null ) ) ;
143
151
144
152
var recordsDesc = await api . List < SimpleStrict > (
145
153
null ,
146
154
[ "-text_not_null" ] ,
147
- [ $ "text_not_null[like]=%{ now } "]
155
+ [ $ "text_not_null[like]=%{ suffix } "]
148
156
) ! ;
149
157
Assert . Equal ( messages . Count , recordsDesc . Count ) ;
150
158
recordsDesc . Reverse ( ) ;
@@ -179,7 +187,7 @@ public async Task RecordsTest() {
179
187
var records = await api . List < SimpleStrict > (
180
188
null ,
181
189
null ,
182
- [ $ "text_not_null[like]=%{ now } "]
190
+ [ $ "text_not_null[like]=%{ suffix } "]
183
191
) ! ;
184
192
185
193
Assert . Single ( records ) ;
0 commit comments