Skip to content

Commit

Permalink
#64 : Only pass --scheduler-host-address in Dapr 1.14.0 and later (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
badgeratu authored Oct 26, 2024
1 parent 3ee91e2 commit f739fd5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
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

0 comments on commit f739fd5

Please sign in to comment.