Skip to content

Commit f739fd5

Browse files
authored
#64 : Only pass --scheduler-host-address in Dapr 1.14.0 and later (#67)
1 parent 3ee91e2 commit f739fd5

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

src/Man.Dapr.Sidekick/Process/DaprSidecarProcess.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ protected override void AddCommandLineArguments(DaprSidecarOptions source, Comma
135135
.Add(ModeArgument, source.Mode)
136136
.Add(PlacementHostAddressArgument, source.PlacementHostAddress)
137137
.Add(ProfilePortArgument, source.ProfilePort, predicate: () => source.Profiling == true)
138-
.Add(SchedulerHostAddressArgument, source.SchedulerHostAddress)
138+
.Add(SchedulerHostAddressArgument, source.SchedulerHostAddress, predicate: () => !source.IsRuntimeVersionEarlierThan("1.14.0"))
139139
.Add(SentryAddressArgument, source.SentryAddress, predicate: () => !source.SentryAddress.IsNullOrWhiteSpaceEx())
140140
.Add(ConfigFileArgument, source.ConfigFile, predicate: () => File.Exists(source.ConfigFile))
141141
.Add(ResourcesPathArgument, source.ResourcesDirectory, predicate: () => Directory.Exists(source.ResourcesDirectory))

tests/Man.Dapr.Sidekick.Tests/Process/DaprSidecarProcessTests.cs

+21-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.IO;
1+
using System;
2+
using System.IO;
23
using Man.Dapr.Sidekick.Logging;
34
using Man.Dapr.Sidekick.Security;
45
using NSubstitute;
@@ -263,7 +264,25 @@ public void Should_add_all_arguments()
263264

264265
File.Delete(configFile);
265266
}
266-
}
267+
268+
[TestCase("1.13.2", false)]
269+
[TestCase("1.14.0", true)]
270+
public void Should_add_schedulerhostaddress_by_runtimeversion(string version, bool containsValue)
271+
{
272+
var p = new MockDaprSidecarProcess();
273+
var builder = new CommandLineArgumentBuilder();
274+
var options = new DaprSidecarOptions
275+
{
276+
SchedulerHostAddress = "SchedulerHostAddress",
277+
RuntimeVersion = new Version(version)
278+
};
279+
280+
p.AddCommandLineArguments(options, builder);
281+
282+
var expected = containsValue ? " --scheduler-host-address SchedulerHostAddress" : string.Empty;
283+
Assert.That(builder.ToString(), Does.EndWith(expected));
284+
}
285+
}
267286

268287
public class AddEnvironmentVariables
269288
{

0 commit comments

Comments
 (0)