Skip to content

Commit c003116

Browse files
committed
Use full path to sqldb file
Signed-off-by: Victor Chang <[email protected]>
1 parent 98fbec2 commit c003116

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

tests/Integration.Test/Drivers/EfDataProvider.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
using Ardalis.GuardClauses;
1718
using Microsoft.EntityFrameworkCore;
1819
using Monai.Deploy.InformaticsGateway.Api.Rest;
1920
using Monai.Deploy.InformaticsGateway.Database.EntityFramework;
@@ -38,12 +39,21 @@ public EfDataProvider(ISpecFlowOutputHelper outputHelper, Configurations configu
3839
_outputHelper = outputHelper ?? throw new ArgumentNullException(nameof(outputHelper));
3940
_configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
4041

42+
connectionString = ConvertToFullPath(connectionString);
4143
_outputHelper.WriteLine($"Connecting to EF based database using {connectionString}");
4244
var builder = new DbContextOptionsBuilder<InformaticsGatewayContext>();
4345
builder.UseSqlite(connectionString);
4446
_dbContext = new InformaticsGatewayContext(builder.Options);
4547
}
4648

49+
private string ConvertToFullPath(string connectionString)
50+
{
51+
Guard.Against.NullOrWhiteSpace(connectionString);
52+
53+
string absolute = Path.GetFullPath("./");
54+
return connectionString.Replace("=./", $"={absolute}");
55+
}
56+
4757
public void ClearAllData()
4858
{
4959
_dbContext.Database.EnsureCreated();

tests/Integration.Test/Hooks/TestHooks.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ public TestHooks(IObjectContainer objectContainer)
6060
_objectContainer = objectContainer;
6161
}
6262

63-
/// <summary>
64-
/// Runs before all tests to create static implementions of Rabbit and Mongo clients as well as starting the WorkflowManager using WebApplicationFactory.
65-
/// </summary>
6663
[BeforeTestRun(Order = 0)]
6764
public static void Init(ISpecFlowOutputHelper outputHelper)
6865
{

tests/Integration.Test/appsettings.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"ConnectionStrings": {
3-
"Type": "mongodb",
4-
"InformaticsGatewayDatabase": "mongodb://root:rootpassword@localhost:27017",
5-
"DatabaseName": "InformaticsGateway"
3+
"Type": "sqlite",
4+
"InformaticsGatewayDatabase": "Data Source=./mig.db"
65
},
76
"InformaticsGateway": {
87
"dicom": {

0 commit comments

Comments
 (0)