Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#64 : Only pass --scheduler-host-address in Dapr 1.14.0 and later #67

Merged
merged 1 commit into from
Oct 26, 2024
Merged
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
2 changes: 1 addition & 1 deletion src/Man.Dapr.Sidekick/Process/DaprSidecarProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected override void AddCommandLineArguments(DaprSidecarOptions source, Comma
.Add(ModeArgument, source.Mode)
.Add(PlacementHostAddressArgument, source.PlacementHostAddress)
.Add(ProfilePortArgument, source.ProfilePort, predicate: () => source.Profiling == true)
.Add(SchedulerHostAddressArgument, source.SchedulerHostAddress)
.Add(SchedulerHostAddressArgument, source.SchedulerHostAddress, predicate: () => !source.IsRuntimeVersionEarlierThan("1.14.0"))
.Add(SentryAddressArgument, source.SentryAddress, predicate: () => !source.SentryAddress.IsNullOrWhiteSpaceEx())
.Add(ConfigFileArgument, source.ConfigFile, predicate: () => File.Exists(source.ConfigFile))
.Add(ResourcesPathArgument, source.ResourcesDirectory, predicate: () => Directory.Exists(source.ResourcesDirectory))
Expand Down
23 changes: 21 additions & 2 deletions tests/Man.Dapr.Sidekick.Tests/Process/DaprSidecarProcessTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.IO;
using System;
using System.IO;
using Man.Dapr.Sidekick.Logging;
using Man.Dapr.Sidekick.Security;
using NSubstitute;
Expand Down Expand Up @@ -263,7 +264,25 @@ public void Should_add_all_arguments()

File.Delete(configFile);
}
}

[TestCase("1.13.2", false)]
[TestCase("1.14.0", true)]
public void Should_add_schedulerhostaddress_by_runtimeversion(string version, bool containsValue)
{
var p = new MockDaprSidecarProcess();
var builder = new CommandLineArgumentBuilder();
var options = new DaprSidecarOptions
{
SchedulerHostAddress = "SchedulerHostAddress",
RuntimeVersion = new Version(version)
};

p.AddCommandLineArguments(options, builder);

var expected = containsValue ? " --scheduler-host-address SchedulerHostAddress" : string.Empty;
Assert.That(builder.ToString(), Does.EndWith(expected));
}
}

public class AddEnvironmentVariables
{
Expand Down
Loading