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

Commit 0d72131

Browse files
test: Added separate .env file for the integration tests
1 parent 5774d67 commit 0d72131

4 files changed

Lines changed: 54 additions & 8 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Database
2+
DATABASE_USER=SA
3+
DATABASE_PASSWORD=YourStrong@Passw0rd
4+
DATABASE_NAME=ServiceLayer
5+
DATABASE_HOST=db
6+
DatabaseConnectionString=Server=${DATABASE_HOST};Database=${DATABASE_NAME};User Id=${DATABASE_USER};Password=${DATABASE_PASSWORD};TrustServerCertificate=True
7+
8+
# MESH
9+
MeshSharedKey=TestKey
10+
MeshPassword=password
11+
NbssMailboxId=X26ABC1
12+
MeshApiBaseUrl=http://localhost:8700/messageexchange
13+
14+
# Other
15+
ASPNETCORE_ENVIRONMENT=Development
16+
FileDiscoveryTimerExpression=*/5 * * * * * # Every 5 seconds so that the test doesn't have to wait too long
17+
MeshHandshakeTimerExpression=0 0 0 * * * # Midnight
18+
FileRetryTimerExpression=0 0 * * * *
19+
FileExtractQueueName=file-extract
20+
FileTransformQueueName=file-transform
21+
StaleHours=12
22+
MeshBlobContainerName=incoming-mesh-files
23+
API_PORT=7071
24+
MESH_INGEST_PORT=7072
25+
26+
# Event Grid
27+
EVENT_GRID_TOPIC_URL=https://localhost:60101/api/events
28+
EVENT_GRID_TOPIC_KEY=TheLocal+DevelopmentKey=
29+
30+
# Azurite
31+
AZURITE_ACCOUNT_KEY=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw== # Standard default Azurite key
32+
AZURITE_CONNECTION_STRING=DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=${AZURITE_ACCOUNT_KEY};BlobEndpoint=http://azurite:10000/devstoreaccount1;QueueEndpoint=http://azurite:10001/devstoreaccount1;TableEndpoint=http://azurite/devstoreaccount1
33+
AZURITE_BLOB_PORT=10000
34+
AZURITE_QUEUE_PORT=10001
35+
AZURITE_TABLE_PORT=10002

tests/ServiceLayer.IntegrationTests/IntegrationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public async Task InitializeAsync()
150150
var startInfo = new ProcessStartInfo
151151
{
152152
FileName = "docker",
153-
Arguments = "compose up -d svclyr-mesh-ingest mesh-sandbox azurite db db-migrations",
153+
Arguments = "compose --env-file .env.tests up -d svclyr-mesh-ingest mesh-sandbox azurite db db-migrations",
154154
RedirectStandardOutput = true,
155155
RedirectStandardError = true,
156156
UseShellExecute = false,

tests/ServiceLayer.IntegrationTests/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
Provide the values for all environment variables when running the integration tests, e.g.
1+
The integration tests require the following environment variables to run:
2+
- AZURITE_ACCOUNT_KEY
3+
- AZURITE_ACCOUNT_NAME
4+
- AZURITE_BLOB_PORT
5+
- MESH_INGEST_PORT
6+
- MESH_SANDBOX_PORT
7+
- MESH_BLOB_CONTAINER_NAME
8+
- DATABASE_CONNECTION_STRING
29

10+
They can be passed as arguments like so
311
```sh
412
dotnet test \
513
-e AZURITE_ACCOUNT_KEY="Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" \
@@ -10,5 +18,3 @@ dotnet test \
1018
-e MESH_BLOB_CONTAINER_NAME=incoming-mesh-files \
1119
-e DATABASE_CONNECTION_STRING="Server=localhost;Database=ServiceLayer;User Id=SA;Password=YourStrong@Passw0rd;TrustServerCertificate=True"
1220
```
13-
14-
Also, remember to set the FileDiscoveryTimerExpression to a shorter interval e.g. every 5 seconds (*/5 * * * * *)

tests/ServiceLayer.IntegrationTests/ServiceLayer.IntegrationTests.csproj

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,14 @@
2626
<Using Include="Xunit" />
2727
</ItemGroup>
2828
<ItemGroup>
29-
<None Update="TestData\*.*">
30-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
31-
</None>
32-
</ItemGroup>
29+
<None Update="TestData\*.*">
30+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
31+
</None>
32+
</ItemGroup>
33+
<ItemGroup>
34+
<None Update=".env.tests">
35+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
36+
</None>
37+
</ItemGroup>
3338

3439
</Project>

0 commit comments

Comments
 (0)