Skip to content

Commit 921f428

Browse files
Fix failing command line tests (#2798) (#2802)
* No need for double * Fix the bug by forcing the right parameter to be used --------- Co-authored-by: Daniel Marbach <[email protected]>
1 parent 072d74f commit 921f428

File tree

3 files changed

+253
-224
lines changed

3 files changed

+253
-224
lines changed

src/CommandLine/DefaultConfigurationValues.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,5 @@ public static class DefaultConfigurationValues
1111

1212
public static readonly string QueueNamePrefix = string.Empty;
1313
public static readonly string TopicNamePrefix = string.Empty;
14-
15-
/* TODO: look into these, why are they different from the above?
16-
public static readonly int AwsMaximumQueueDelayTime = (int)TimeSpan.FromMinutes(15).TotalSeconds;
17-
public static readonly TimeSpan DelayedDeliveryQueueMessageRetentionPeriod = TimeSpan.FromDays(4);
18-
public static readonly int DelayedDeliveryQueueDelayTime = Convert.ToInt32(Math.Ceiling(MaximumQueueDelayTime.TotalSeconds));
19-
*/
2014
}
2115
}

src/CommandLine/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ static int Main(string[] args)
6868
createCommand.AddOption(prefixOption);
6969

7070
var retentionPeriodInSecondsCommand = createCommand.Option("-t|--retention",
71-
$"Retention Period in seconds (defaults to {DefaultConfigurationValues.RetentionPeriod.TotalSeconds} ) ", CommandOptionType.SingleValue);
71+
$"Retention Period in seconds (defaults to {(int)DefaultConfigurationValues.RetentionPeriod.TotalSeconds} ) ", CommandOptionType.SingleValue);
7272

7373
createCommand.OnExecuteAsync(async ct =>
7474
{
7575
var endpointName = nameArgument.Value;
76-
var retentionPeriodInSeconds = retentionPeriodInSecondsCommand.HasValue() ? double.Parse(retentionPeriodInSecondsCommand.Value()) : DefaultConfigurationValues.RetentionPeriod.TotalSeconds;
76+
var retentionPeriodInSeconds = retentionPeriodInSecondsCommand.HasValue() ? int.Parse(retentionPeriodInSecondsCommand.Value()) : (int)DefaultConfigurationValues.RetentionPeriod.TotalSeconds;
7777
var prefix = prefixOption.HasValue() ? prefixOption.Value() : DefaultConfigurationValues.QueueNamePrefix;
7878

7979
await CommandRunner.Run(accessKeyOption, secretOption, regionOption, (sqs, sns, s3) => Endpoint.Create(sqs, prefix, endpointName, retentionPeriodInSeconds));
@@ -140,8 +140,8 @@ static int Main(string[] args)
140140

141141
delayDeliverySupportCommand.OnExecuteAsync(async ct =>
142142
{
143-
var delayInSeconds = DefaultConfigurationValues.MaximumQueueDelayTime.TotalSeconds;
144-
var retentionPeriodInSeconds = retentionPeriodInSecondsCommand.HasValue() ? double.Parse(retentionPeriodInSecondsCommand.Value()) : DefaultConfigurationValues.RetentionPeriod.TotalSeconds;
143+
var delayInSeconds = (int)DefaultConfigurationValues.MaximumQueueDelayTime.TotalSeconds;
144+
var retentionPeriodInSeconds = retentionPeriodInSecondsCommand.HasValue() ? int.Parse(retentionPeriodInSecondsCommand.Value()) : (int)DefaultConfigurationValues.RetentionPeriod.TotalSeconds;
145145
var suffix = DefaultConfigurationValues.DelayedDeliveryQueueSuffix;
146146

147147
var endpointName = nameArgument.Value;

0 commit comments

Comments
 (0)