Skip to content

Commit

Permalink
mock cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
IharYakimush committed Apr 4, 2024
1 parent c97d0eb commit d5cf066
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Test
run: dotnet test -c Debug --no-build --verbosity normal --settings .runsettings
env:
KAFKA_BOOTSTRAP_SERVERS: ${{ env.kafka_runner_address }}:9093
RUNNING_FROM_GITHUB_ACTIONS: "true"
- name: Report
run: |
dotnet tool restore
Expand Down
10 changes: 3 additions & 7 deletions tests/Epam.Kafka.Tests/Common/MockCluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,13 @@ public sealed class MockCluster : IDisposable
private const string DefaultProducer = "Default";

private readonly IAdminClient? _adminClient;
private readonly string _mockBootstrapServers;
private readonly string _mockBootstrapServers = "localhost:9092";

public MockCluster()
{
string? env = Environment.GetEnvironmentVariable("KAFKA_BOOTSTRAP_SERVERS");
string? env = Environment.GetEnvironmentVariable("RUNNING_FROM_GITHUB_ACTIONS");

if (env != null)
{
this._mockBootstrapServers = env;
}
else
if (env == null)
{
// Trick: we are going to connect with admin client first so we can get metadata and bootstrap servers from it
var clientConfig = new ClientConfig();
Expand Down

0 comments on commit d5cf066

Please sign in to comment.