Skip to content

Commit

Permalink
Adding a regression test for #761
Browse files Browse the repository at this point in the history
  • Loading branch information
ElteHupkes committed Aug 29, 2019
1 parent 52eb23c commit 3826756
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/ConcurrencyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,28 @@ public void TestLoad()
}
}


/// <summary>
/// Test for issue #761. Because the nature of this test is a race condition,
/// it is not guaranteed to fail if the issue is present. It does appear to
/// fail most of the time, though.
/// </summary>
[Test]
public void TestInsertCommandCreation ()
{
using (var dbConnection =
new DbConnection (SQLiteOpenFlags.FullMutex | SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create)) {
var obj1 = new TestObj ();
var obj2 = new TestObj ();
var taskA = Task.Run (() => {
dbConnection.Insert (obj1);
});
var taskB = Task.Run (() => {
dbConnection.Insert (obj2);
});

Task.WhenAll (taskA, taskB).Wait ();
}
}
}
}

0 comments on commit 3826756

Please sign in to comment.