Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions tests/Cosmos.Tests.Infrastructure/Emulator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,31 @@ let private isReachableAsync (cancellationToken : CancellationToken) : Task<bool
| :? TaskCanceledException when not cancellationToken.IsCancellationRequested -> return false
}

/// <summary>
/// The emulator that answers at <see cref="endpoint"/>.
/// </summary>
[<RequireQualifiedAccess>]
type Kind =
/// The Windows emulator.
| Windows
/// The Linux vNext preview emulator, which CI and the dev container run.
| VNext

/// <summary>
/// Tells which <see cref="Kind"/> of emulator answers at <see cref="endpoint"/>, for the few query semantics in which
/// the two differ: the Windows emulator answers an unauthenticated request to its root with HTTP 401, the vNext
/// emulator with a success status.
/// </summary>
let readKindAsync (cancellationToken : CancellationToken) : Task<Kind> = task {
use httpClient = new HttpClient (createHttpMessageHandler (), true, Timeout = reachabilityTimeout)
use! response = httpClient.GetAsync (endpoint, cancellationToken)
return
if response.IsSuccessStatusCode then
Kind.VNext
else
Kind.Windows
}

/// <summary>
/// Deletes the databases whose identifier starts with <see cref="DatabaseIdentifier.Prefix"/> and that stayed
/// unmodified for at least the leftover age (<see cref="readLeftoverAge"/>): databases of tests whose cleanup failed
Expand Down
1 change: 1 addition & 0 deletions tests/Cosmos.Tests/FSharp.Azure.Cosmos.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<Compile Include="ReadManyOperationTests.fs" />
<Compile Include="ReadExtensionsTests.fs" />
<Compile Include="IterationExtensionsTests.fs" />
<Compile Include="QuerySemanticsTests.fs" />
<Compile Include="BuilderUnitTests.fs" />
</ItemGroup>

Expand Down
Loading
Loading