Skip to content

Commit ba60da8

Browse files
committed
Playing with failing tests on AppVeyor
1 parent 098e808 commit ba60da8

File tree

5 files changed

+14
-25
lines changed

5 files changed

+14
-25
lines changed

NETProvider/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbConnectionInternal.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,10 +524,10 @@ private DatabaseParameterBuffer BuildDpb(IDatabase db, FbConnectionString option
524524
{
525525
dpb.Append(IscCodes.isc_dpb_no_db_triggers, 1);
526526
}
527-
if (options.NoGarbageCollect)
528-
{
529-
dpb.Append(IscCodes.isc_dpb_no_garbage_collect, (byte)0);
530-
}
527+
if (options.NoGarbageCollect)
528+
{
529+
dpb.Append(IscCodes.isc_dpb_no_garbage_collect, (byte)0);
530+
}
531531

532532
return dpb;
533533
}

NETProvider/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbConnectionPoolManager.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public FbConnectionInternal GetConnection(FbConnection owner)
105105

106106
var connection = _available.Any()
107107
? _available.Pop().Connection
108-
: CreateNewConnectionIfPossibleImpl(_connectionString, owner);
108+
: CreateNewConnectionIfPossibleImpl(_connectionString);
109109
connection.SetOwningConnection(owner);
110110
_busy.Add(connection);
111111
return connection;
@@ -160,10 +160,9 @@ public void ClearPool()
160160
}
161161
}
162162

163-
static FbConnectionInternal CreateNewConnection(FbConnectionString connectionString, FbConnection owner)
163+
static FbConnectionInternal CreateNewConnection(FbConnectionString connectionString)
164164
{
165165
var result = new FbConnectionInternal(connectionString);
166-
result.SetOwningConnection(owner);
167166
result.Connect();
168167
return result;
169168
}
@@ -196,11 +195,11 @@ void CheckDisposedImpl()
196195
throw new ObjectDisposedException(typeof(Pool).Name);
197196
}
198197

199-
FbConnectionInternal CreateNewConnectionIfPossibleImpl(FbConnectionString connectionString, FbConnection owner)
198+
FbConnectionInternal CreateNewConnectionIfPossibleImpl(FbConnectionString connectionString)
200199
{
201200
if (_busy.Count() + 1 > connectionString.MaxPoolSize)
202201
throw new InvalidOperationException("Connection pool is full.");
203-
return CreateNewConnection(connectionString, owner);
202+
return CreateNewConnection(connectionString);
204203
}
205204
}
206205

NETProvider/src/FirebirdSql.Data.UnitTests/FbConnectionTests.cs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using System.Configuration;
2323
using System.Data;
2424
using System.IO;
25+
using System.Linq;
2526
using System.Reflection;
2627
using System.Threading;
2728
using FirebirdSql.Data.FirebirdClient;
@@ -220,7 +221,6 @@ public void ConnectionPoolingLifeTimeTest()
220221

221222
Thread.Sleep(TimeSpan.FromSeconds(csb.ConnectionLifeTime * 2));
222223
Assert.AreEqual(active, GetActiveConnections());
223-
224224
}
225225

226226
[Test]
@@ -234,36 +234,26 @@ public void ConnectionPoolingMaxPoolSizeTest()
234234
string cs = csb.ToString();
235235

236236
var connections = new List<FbConnection>();
237-
var thrown = false;
238237
try
239238
{
240239
for (int i = 0; i <= csb.MaxPoolSize; i++)
241240
{
242241
var connection = new FbConnection(cs);
242+
connections.Add(connection);
243243
if (i == csb.MaxPoolSize)
244244
{
245-
try
246-
{
247-
connection.Open();
248-
}
249-
catch (InvalidOperationException)
250-
{
251-
thrown = true;
252-
}
245+
Assert.Throws<InvalidOperationException>(() => connection.Open());
253246
}
254247
else
255248
{
256249
Assert.DoesNotThrow(() => connection.Open());
257250
}
258-
connections.Add(connection);
259251
}
260252
}
261253
finally
262254
{
263255
connections.ForEach(x => x.Dispose());
264256
}
265-
266-
Assert.IsTrue(thrown);
267257
}
268258

269259
[Test]
@@ -283,8 +273,8 @@ public void ConnectionPoolingMinPoolSizeTest()
283273
for (int i = 0; i < csb.MinPoolSize * 2; i++)
284274
{
285275
var connection = new FbConnection(cs);
286-
Assert.DoesNotThrow(() => connection.Open());
287276
connections.Add(connection);
277+
Assert.DoesNotThrow(() => connection.Open());
288278
}
289279
}
290280
finally

NETProvider/src/FirebirdSql.Data.UnitTests/TestsBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ public virtual void SetUp()
9292
InsertTestData(cs);
9393
this.connection = new FbConnection(cs);
9494
this.connection.Open();
95-
9695
if (this.withTransaction)
9796
{
9897
this.transaction = this.connection.BeginTransaction();
@@ -128,6 +127,7 @@ public virtual void TearDown()
128127
connection.Dispose();
129128
}
130129
DeleteAllData(cs);
130+
FbConnection.ClearAllPools();
131131
}
132132

133133
#endregion

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ build:
2121
verbosity: minimal
2222
test_script:
2323
- ps: cd $testsDir
24-
- ps: nunit-console FirebirdSql.Data.UnitTests.dll /framework:net-4.0 /exclude=Local /nodots /noshadow
24+
- ps: nunit-console FirebirdSql.Data.UnitTests.dll /framework:net-4.0 /exclude:Local /nodots /noshadow
2525
artifacts:
2626
- path: NETProvider\src\FirebirdSql.Data.FirebirdClient\bin\$(Configuration)\FirebirdSql.Data.FirebirdClient.dll
2727
- path: NETProvider\src\FirebirdSql.Data.FirebirdClient\bin\$(Configuration)\FirebirdSql.Data.FirebirdClient.pdb

0 commit comments

Comments
 (0)