Skip to content

Commit b93e650

Browse files
committed
Fix failing command line tests (#2798)
* No need for double * Fix the bug by forcing the right parameter to be used --------- Co-authored-by: Daniel Marbach <danielmarbach@users.noreply.github.com>
1 parent 072d74f commit b93e650

File tree

3 files changed

+261
-232
lines changed

3 files changed

+261
-232
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: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ static int Main(string[] args)
6767
createCommand.AddOption(secretOption);
6868
createCommand.AddOption(prefixOption);
6969

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

73-
createCommand.OnExecuteAsync(async ct =>
74-
{
75-
var endpointName = nameArgument.Value;
76-
var retentionPeriodInSeconds = retentionPeriodInSecondsCommand.HasValue() ? double.Parse(retentionPeriodInSecondsCommand.Value()) : DefaultConfigurationValues.RetentionPeriod.TotalSeconds;
77-
var prefix = prefixOption.HasValue() ? prefixOption.Value() : DefaultConfigurationValues.QueueNamePrefix;
73+
createCommand.OnExecuteAsync(async ct =>
74+
{
75+
var endpointName = nameArgument.Value;
76+
var retentionPeriodInSeconds = retentionPeriodInSecondsCommand.HasValue() ? int.Parse(retentionPeriodInSecondsCommand.Value()) : (int)DefaultConfigurationValues.RetentionPeriod.TotalSeconds;
77+
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));
8080
});
@@ -138,11 +138,11 @@ static int Main(string[] args)
138138

139139
var retentionPeriodInSecondsCommand = delayDeliverySupportCommand.Option("-t|--retention", "Retention period in seconds (defaults to " + DefaultConfigurationValues.RetentionPeriod.TotalSeconds + " ).", CommandOptionType.SingleValue);
140140

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

147147
var endpointName = nameArgument.Value;
148148
var prefix = prefixOption.HasValue() ? prefixOption.Value() : DefaultConfigurationValues.QueueNamePrefix;

0 commit comments

Comments
 (0)