-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
127 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
services: | ||
|
||
nats: | ||
image: "nats:2.9.6" | ||
image: "nats:2.9.9" | ||
command: --js | ||
ports: | ||
- "8222:8222" | ||
|
49 changes: 49 additions & 0 deletions
49
examples/Demo/Cluster/ManualCluster/ManualClusterExample.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using NBomber.Contracts; | ||
using NBomber.Contracts.Stats; | ||
using NBomber.CSharp; | ||
using NBomber.Http; | ||
using NBomber.Http.CSharp; | ||
using NBomber.Plugins.Network.Ping; | ||
|
||
namespace Demo.Cluster.ManualCluster; | ||
|
||
public class ManualClusterExample | ||
{ | ||
public void Run(string[] args) | ||
{ | ||
var scenario = BuildScenario(); | ||
StartNode(scenario, args); | ||
} | ||
|
||
private void StartNode(ScenarioProps scenario, string[] args) | ||
{ | ||
NBomberRunner | ||
.RegisterScenarios(scenario) | ||
.WithWorkerPlugins( | ||
new PingPlugin(PingPluginConfig.CreateDefault("nbomber.com")), | ||
new HttpMetricsPlugin(new [] { HttpVersion.Version1 }) | ||
) | ||
.LoadConfig("Cluster/ManualCluster/manual-cluster-config.json") // you can use: --config=Cluster/ManualCluster/manual-cluster-config.json | ||
.EnableLocalDevCluster(true) // you can use: --cluster-local-dev=true | ||
.Run(args); // more info about available CLI args: https://nbomber.com/docs/getting-started/cli/ | ||
} | ||
|
||
private ScenarioProps BuildScenario() | ||
{ | ||
using var httpClient = new HttpClient(); | ||
|
||
return Scenario.Create("http_scenario", async context => | ||
{ | ||
var request = | ||
Http.CreateRequest("GET", "https://nbomber.com") | ||
.WithHeader("Content-Type", "application/json"); | ||
// .WithBody(new StringContent("{ some JSON }", Encoding.UTF8, "application/json")); | ||
|
||
var response = await Http.Send(httpClient, request); | ||
|
||
return response; | ||
}) | ||
.WithoutWarmUp() | ||
.WithLoadSimulations(Simulation.Inject(rate: 10, interval: TimeSpan.FromSeconds(1), during: TimeSpan.FromSeconds(30))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: "3.4" | ||
services: | ||
|
||
nats: | ||
image: "nats:2.9.9" | ||
command: --js | ||
ports: | ||
- "8222:8222" | ||
- "4222:4222" |
23 changes: 23 additions & 0 deletions
23
examples/Demo/Cluster/ManualCluster/manual-cluster-config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"TestSuite": "my test suite", | ||
"TestName": "my test", | ||
|
||
"ClusterSettings": { | ||
|
||
"ManualCluster": { | ||
"ClusterId": "test_cluster", | ||
"NATSServerURL": "nats://localhost", | ||
|
||
"Coordinator": { | ||
"TargetScenarios": ["http_scenario"] | ||
}, | ||
|
||
"Agent": { | ||
"AgentGroups": [{"AgentGroup": "1", "TargetScenarios": ["http_scenario"]}], | ||
"AgentsCount": 1 | ||
} | ||
|
||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters