Skip to content

Commit 84dfcc5

Browse files
committed
Use port 8800 for Cosmos emulator on Helix
Don't skip tests if emulator not available
1 parent cc8f34e commit 84dfcc5

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

eng/helix.proj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<EnableAzurePipelinesReporter>true</EnableAzurePipelinesReporter>
1414
<FailOnTestFailure>true</FailOnTestFailure>
1515
<SqlServerTests>$(RepoRoot)/test/EFCore.SqlServer.FunctionalTests/*.csproj;$(RepoRoot)/test/EFCore.SqlServer.HierarchyId.Tests/*.csproj;$(RepoRoot)/test/EFCore.OData.FunctionalTests/*.csproj;$(RepoRoot)/test/EFCore.AspNet.SqlServer.FunctionalTests/*.csproj;$(RepoRoot)/test/EFCore.VisualBasic.FunctionalTests/*.vbproj</SqlServerTests>
16+
<CosmosTests>$(RepoRoot)/test/EFCore.Cosmos.FunctionalTests/*.csproj;</CosmosTests>
1617
</PropertyGroup>
1718

1819
<PropertyGroup Condition = "'$(SYSTEM_ACCESSTOKEN)' == ''">
@@ -70,7 +71,14 @@
7071
<!-- Remove test projects which requires SqlServer from Ubuntu/OSX. -->
7172
<ItemGroup Condition = "'$(HelixTargetQueue.StartsWith(`OSX`))' OR '$(HelixTargetQueue)' == 'Ubuntu.2204.Amd64.Open' OR '$(HelixTargetQueue)' == 'Ubuntu.2204.Amd64'">
7273
<XUnitProject Remove="$(SqlServerTests)"/>
73-
</ItemGroup>
74+
</ItemGroup>
75+
76+
<!-- Set Cosmos emulator connection on Windows -->
77+
<ItemGroup Condition = "'$(HelixTargetQueue.StartsWith(`Windows`))'">
78+
<XUnitProject Update="$(CosmosTests)">
79+
<PreCommands>$(PreCommands);set Test__Cosmos__SkipConnectionCheck=true;set Test__Cosmos__DefaultConnection="https://localhost:8800"</PreCommands>
80+
</XUnitProject>
81+
</ItemGroup>
7482

7583
<PropertyGroup>
7684
<XUnitPublishTargetFramework>net10.0</XUnitPublishTargetFramework>

test/EFCore.Cosmos.FunctionalTests/TestUtilities/CosmosTestStore.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ public override DbContextOptionsBuilder AddProviderOptions(DbContextOptionsBuild
9696

9797
public static async ValueTask<bool> IsConnectionAvailableAsync()
9898
{
99+
if (TestEnvironment.SkipConnectionCheck)
100+
{
101+
return true;
102+
}
103+
99104
if (_connectionAvailable == null)
100105
{
101106
await _connectionSemaphore.WaitAsync();

test/EFCore.Cosmos.FunctionalTests/TestUtilities/TestEnvironment.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,6 @@ public static class TestEnvironment
4646
: Enum.Parse<AzureLocation>(Config["AzureLocation"]);
4747

4848
public static bool IsEmulator { get; } = !UseTokenCredential && (AuthToken == _emulatorAuthToken);
49+
50+
public static bool SkipConnectionCheck { get; } = Config["SkipConnectionCheck"] == "true";
4951
}

0 commit comments

Comments
 (0)