Elastic.Transport.VirtualizedCluster
0.11.1
Prefix Reserved
See the version list below for details.
dotnet add package Elastic.Transport.VirtualizedCluster --version 0.11.1
NuGet\Install-Package Elastic.Transport.VirtualizedCluster -Version 0.11.1
<PackageReference Include="Elastic.Transport.VirtualizedCluster" Version="0.11.1" />
<PackageVersion Include="Elastic.Transport.VirtualizedCluster" Version="0.11.1" />
<PackageReference Include="Elastic.Transport.VirtualizedCluster" />
paket add Elastic.Transport.VirtualizedCluster --version 0.11.1
#r "nuget: Elastic.Transport.VirtualizedCluster, 0.11.1"
#:package Elastic.Transport.VirtualizedCluster@0.11.1
#addin nuget:?package=Elastic.Transport.VirtualizedCluster&version=0.11.1
#tool nuget:?package=Elastic.Transport.VirtualizedCluster&version=0.11.1
Elastic.Transport.VirtualizedCluster
An in-memory virtual cluster for testing Elastic.Transport behavior without connecting to a real cluster. Provides a fluent rule engine to simulate ping, sniff, and API call responses, and an auditor to assert the exact sequence of transport actions.
Installation
dotnet add package Elastic.Transport.VirtualizedCluster
Quick Start
// Bootstrap a 3-node virtual cluster
var cluster = Virtual.Elasticsearch
.Bootstrap(3)
.ClientCalls(r => r.SucceedAlways())
.StaticNodePool()
.AllDefaults();
var response = cluster.ClientCall();
// response.ApiCallDetails.HttpStatusCode == 200
Rule Engine
Rules control how the virtual cluster responds to pings, sniffs, and client API calls.
Client Call Rules
Virtual.Elasticsearch
.Bootstrap(3)
.ClientCalls(r => r.SucceedAlways())
// or fail a certain number of times, then succeed
.ClientCalls(r => r.Fails(TimesHelper.Times(2)).Succeeds(TimesHelper.Times(10)))
// simulate slow responses
.ClientCalls(r => r.Takes(TimeSpan.FromSeconds(10)).SucceedAlways())
// return a custom response body
.ClientCalls(r => r.ReturnResponse(new { hits = new { total = 100 } }).SucceedAlways())
.StaticNodePool()
.AllDefaults();
Ping Rules
Virtual.Elasticsearch
.Bootstrap(3)
.Ping(r => r.SucceedAlways())
// or fail on a specific port
.Ping(r => r.OnPort(9201).Fails(TimesHelper.Times(1)))
.Ping(r => r.OnPort(9202).SucceedAlways())
.StaticNodePool()
.AllDefaults();
Sniff Rules
Virtual.Elasticsearch
.Bootstrap(3)
.Sniff(r => r.SucceedAlways())
// or return a new cluster topology after sniffing
.Sniff(r => r.Succeeds(TimesHelper.Always, Virtual.Elasticsearch.Bootstrap(5)))
.SniffingNodePool()
.AllDefaults();
Node Pool Strategies
Choose the node pool to test different failover and discovery behaviors:
var cluster = Virtual.Elasticsearch.Bootstrap(10);
cluster.StaticNodePool() // Fixed list of nodes
cluster.SniffingNodePool() // Discovers nodes via sniff API
cluster.StickyNodePool() // Prefers a single node
cluster.StickySniffingNodePool() // Sticky with sniff discovery
cluster.SingleNodeConnection() // Single node, no failover
Auditing
The Auditor class asserts the exact sequence of transport events across both sync and async code paths:
var auditor = new Auditor(() => Virtual.Elasticsearch
.Bootstrap(3)
.Ping(r => r.SucceedAlways())
.ClientCalls(r => r.SucceedAlways())
.StaticNodePool()
.AllDefaults()
);
await auditor.TraceCall(new ClientCall
{
{ AuditEvent.PingSuccess, 9200 },
{ AuditEvent.HealthyResponse, 9200 }
});
Time Control
Simulate the passage of time to test dead-node resurrection and timeout behavior:
var cluster = Virtual.Elasticsearch
.Bootstrap(3)
.ClientCalls(r => r.FailAlways())
.StaticNodePool()
.AllDefaults();
// Advance time by 30 minutes
cluster.ChangeTime(d => d.AddMinutes(30));
// Nodes marked dead will now be retried
var response = cluster.ClientCall();
Custom Configuration
Use .Settings() to customize the transport configuration:
var cluster = Virtual.Elasticsearch
.Bootstrap(3)
.ClientCalls(r => r.SucceedAlways())
.StaticNodePool()
.Settings(s => s with
{
DisablePings = true,
MaxRetries = 5
});
Links
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Elastic.Transport (>= 0.11.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Elastic.Transport.VirtualizedCluster:
| Repository | Stars |
|---|---|
|
elastic/elasticsearch-net
This strongly-typed, client library enables working with Elasticsearch. It is the official client maintained and supported by Elastic.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 0.15.0 | 75 | 2/24/2026 |
| 0.14.0 | 125 | 2/23/2026 |
| 0.13.0 | 91 | 2/23/2026 |
| 0.12.0 | 145 | 2/20/2026 |
| 0.11.1 | 89 | 2/17/2026 |
| 0.11.0 | 120 | 2/16/2026 |
| 0.10.3 | 112 | 1/22/2026 |
| 0.10.2 | 405 | 12/8/2025 |
| 0.10.1 | 349 | 8/19/2025 |
| 0.10.0 | 238 | 8/12/2025 |
| 0.9.2 | 377 | 5/29/2025 |
| 0.9.1 | 302 | 5/28/2025 |
| 0.9.0 | 290 | 5/28/2025 |
| 0.8.1 | 290 | 5/26/2025 |
| 0.8.0 | 296 | 5/20/2025 |
| 0.7.0 | 300 | 5/19/2025 |
| 0.6.1 | 349 | 5/16/2025 |
| 0.5.9 | 272 | 3/16/2025 |
| 0.5.8 | 236 | 2/3/2025 |