Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
/// </summary>
[TestFixture]
[FixtureLifeCycle(LifeCycle.InstancePerTestCase)]
[CancelAfter(180_000)]
public abstract partial class NServiceBusAcceptanceTest
{
[SetUp]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TestCategory>PostgreSql</TestCategory>
<!-- Every test inherits [CancelAfter] from NServiceBusAcceptanceTest, which NUnit honours but the analyzer does not
see, so it reports the CancellationToken parameter as an unsupplied argument. -->
<NoWarn>$(NoWarn);NUnit1027</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace ServiceControl.AcceptanceTests.RavenDB.Monitoring.CustomChecks
{
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using AcceptanceTesting;
using AcceptanceTesting.EndpointTemplates;
Expand Down Expand Up @@ -30,7 +31,7 @@ public void SetupIngestion() =>
RavenPersisterSettings PersisterSettings => (RavenPersisterSettings)Settings.PersisterSpecificSettings;

[Test]
public async Task Forced_failure_is_classified_internal()
public async Task Forced_failure_is_classified_internal(CancellationToken cancellationToken = default)
{
CustomCheckView ingestionCheck = null;

Expand All @@ -49,7 +50,7 @@ await Define<ScenarioContext>()
ingestionCheck = result;
return result;
})
.Run();
.Run(cancellationToken);

using (Assert.EnterMultipleScope())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace ServiceControl.AcceptanceTests.RavenDB.Monitoring.CustomChecks
{
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using AcceptanceTesting;
using AcceptanceTesting.EndpointTemplates;
Expand All @@ -26,7 +27,7 @@ public void SetupIngestion() =>
RavenPersisterSettings PersisterSettings => (RavenPersisterSettings)Settings.PersisterSpecificSettings;

[Test]
public async Task Should_stop_ingestion() =>
public async Task Should_stop_ingestion(CancellationToken cancellationToken = default) =>
await Define<ScenarioContext>()
.WithEndpoint<Sender>(b => b
.When(context =>
Expand All @@ -45,10 +46,10 @@ await Define<ScenarioContext>()
)
.DoNotFailOnErrorMessages())
.Done(async c => await this.TryGetSingle<FailedMessageView>("/api/errors") == false)
.Run();
.Run(cancellationToken);

[Test]
public async Task Should_stop_ingestion_and_resume_when_more_space_is_available()
public async Task Should_stop_ingestion_and_resume_when_more_space_is_available(CancellationToken cancellationToken = default)
{
var ingestionShutdown = false;

Expand Down Expand Up @@ -76,7 +77,7 @@ await Define<ScenarioContext>()
})
.DoNotFailOnErrorMessages())
.Done(async c => await this.TryGetSingle<FailedMessageView>("/api/errors"))
.Run();
.Run(cancellationToken);
}

public class Sender : EndpointConfigurationBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class When_a_failed_message_is_retried : AcceptanceTest
{
[Test]
public async Task Should_remove_failedmessageretries_when_retrying_groups()
public async Task Should_remove_failedmessageretries_when_retrying_groups(CancellationToken cancellationToken = default)
{
FailedMessageRetriesCountReponse failedMessageRetries = null;

Expand Down Expand Up @@ -58,13 +58,13 @@ await Define<Context>()

return false;
})
.Run();
.Run(cancellationToken);

Assert.That(failedMessageRetries.Count, Is.EqualTo(0), "FailedMessageRetries not removed");
}

[Test]
public async Task Should_remove_failedmessageretries_when_retrying_individual_messages()
public async Task Should_remove_failedmessageretries_when_retrying_individual_messages(CancellationToken cancellationToken = default)
{
FailedMessageRetriesCountReponse failedMessageRetries = null;

Expand Down Expand Up @@ -99,13 +99,13 @@ await Define<Context>()

return false;
})
.Run();
.Run(cancellationToken);

Assert.That(failedMessageRetries.Count, Is.EqualTo(0), "FailedMessageRetries not removed");
}

[Test]
public async Task Should_remove_UnacknowledgedOperation_when_retrying_individual_messages()
public async Task Should_remove_UnacknowledgedOperation_when_retrying_individual_messages(CancellationToken cancellationToken = default)
{
RetryHistory retryHistory = null;

Expand Down Expand Up @@ -140,13 +140,13 @@ await Define<Context>()

return false;
})
.Run();
.Run(cancellationToken);

Assert.That(retryHistory.UnacknowledgedOperations, Is.Empty, "Unucknowledged retry operation not removed");
}

[Test]
public async Task Should_remove_failedmessageretries_after_expiration_process_passes()
public async Task Should_remove_failedmessageretries_after_expiration_process_passes(CancellationToken cancellationToken = default)
{
FailedMessageRetriesCountReponse failedMessageRetries = null;

Expand Down Expand Up @@ -186,7 +186,7 @@ await Define<Context>()

return false;
})
.Run();
.Run(cancellationToken);

Assert.That(failedMessageRetries.Count, Is.EqualTo(0), "FailedMessageRetries not removed");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class When_a_message_fails_to_import : AcceptanceTest
{
[Test]
public async Task It_can_be_reimported()
public async Task It_can_be_reimported(CancellationToken cancellationToken = default)
{
CustomizeHostBuilder = hostBuilder =>
{
Expand Down Expand Up @@ -66,7 +66,7 @@ public async Task It_can_be_reimported()

return await this.TryGet<FailedMessage>($"/api/errors/{c.UniqueMessageId}") && c.ErrorForwarded;
})
.Run();
.Run(cancellationToken);

using (Assert.EnterMultipleScope())
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace ServiceControl.AcceptanceTests.RavenDB.Recoverability.MessageFailures
{
using System;
using System.Threading;
using System.Threading.Tasks;
using AcceptanceTesting;
using AcceptanceTesting.EndpointTemplates;
Expand All @@ -15,7 +16,7 @@ namespace ServiceControl.AcceptanceTests.RavenDB.Recoverability.MessageFailures
class When_body_search_is_disabled : AcceptanceTest
{
[Test]
public async Task Should_not_be_found()
public async Task Should_not_be_found(CancellationToken cancellationToken = default)
{
SetSettings = settings => settings.PersisterSpecificSettings.EnableFullTextSearchOnBodies = false;

Expand All @@ -42,7 +43,7 @@ public async Task Should_not_be_found()
c.MessageFound = await this.TryGetMany<MessagesView>($"/api/messages/search/{searchString}");
return true;
})
.Run();
.Run(cancellationToken);

using (Assert.EnterMultipleScope())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TestCategory>Raven</TestCategory>
<!-- Every test inherits [CancelAfter] from NServiceBusAcceptanceTest, which NUnit honours but the analyzer does not
see, so it reports the CancellationToken parameter as an unsupplied argument. -->
<NoWarn>$(NoWarn);NUnit1027</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TestCategory>SqlServer</TestCategory>
<!-- Every test inherits [CancelAfter] from NServiceBusAcceptanceTest, which NUnit honours but the analyzer does not
see, so it reports the CancellationToken parameter as an unsupplied argument. -->
<NoWarn>$(NoWarn);NUnit1027</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace ServiceControl.AcceptanceTests.EventLogs
using System.Net;
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading;
using System.Threading.Tasks;
using AcceptanceTesting;
using AcceptanceTesting.EndpointTemplates;
Expand All @@ -18,7 +19,7 @@ namespace ServiceControl.AcceptanceTests.EventLogs
class When_the_event_log_is_polled_with_an_etag : AcceptanceTest
{
[Test]
public async Task Should_answer_not_modified_only_for_the_current_etag()
public async Task Should_answer_not_modified_only_for_the_current_etag(CancellationToken cancellationToken = default)
{
string etag = null;
HttpStatusCode currentEtagStatus = default;
Expand Down Expand Up @@ -70,7 +71,7 @@ await Define<ScenarioContext>()

return true;
})
.Run();
.Run(cancellationToken);

using (Assert.EnterMultipleScope())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace ServiceControl.AcceptanceTests.Licensing
using System.IO.Compression;
using System.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using AcceptanceTesting;
using AcceptanceTesting.EndpointTemplates;
Expand All @@ -27,7 +28,7 @@ namespace ServiceControl.AcceptanceTests.Licensing
class When_creating_a_usage_report_on_a_broker_transport : AcceptanceTest
{
[Test]
public async Task Should_report_what_the_broker_measured()
public async Task Should_report_what_the_broker_measured(CancellationToken cancellationToken = default)
{
ReportGenerationState reportState = null;
ThroughputConnectionSettings connectionSettings = null;
Expand Down Expand Up @@ -76,7 +77,7 @@ await Define<Context>()
report = ReadReport(archive);
})
.Done(_ => true)
.Run();
.Run(cancellationToken);

var reportData = report.RootElement.GetProperty("ReportData");
var queues = reportData.GetProperty("Queues").EnumerateArray().ToArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace ServiceControl.AcceptanceTests.Licensing
using System.IO.Compression;
using System.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using AcceptanceTesting;
using AcceptanceTesting.EndpointTemplates;
Expand All @@ -21,7 +22,7 @@ namespace ServiceControl.AcceptanceTests.Licensing
class When_creating_a_usage_report_on_a_non_broker_transport : AcceptanceTest
{
[Test]
public async Task Should_report_the_corrected_and_redacted_throughput()
public async Task Should_report_the_corrected_and_redacted_throughput(CancellationToken cancellationToken = default)
{
ReportGenerationState reportState = null;
ThroughputConnectionSettings connectionSettings = null;
Expand Down Expand Up @@ -80,7 +81,7 @@ await this.Post("/api/licensing/endpoints/update", new[]
report = ReadReport(archive);
})
.Done(_ => true)
.Run();
.Run(cancellationToken);

var queues = report.RootElement.GetProperty("ReportData").GetProperty("Queues").EnumerateArray().ToArray();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace ServiceControl.AcceptanceTests.Licensing
using System.IO.Compression;
using System.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using AcceptanceTesting;
using AcceptanceTesting.EndpointTemplates;
Expand All @@ -20,7 +21,7 @@ namespace ServiceControl.AcceptanceTests.Licensing
class When_reporting_the_environment : AcceptanceTest
{
[Test]
public async Task Should_describe_how_the_instance_is_deployed()
public async Task Should_describe_how_the_instance_is_deployed(CancellationToken cancellationToken = default)
{
JsonDocument report = null;

Expand All @@ -42,7 +43,7 @@ await Define<Context>()
return true;
})
.Done(_ => true)
.Run();
.Run(cancellationToken);

var data = report.RootElement
.GetProperty("ReportData")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace ServiceControl.AcceptanceTests.Licensing
{
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using AcceptanceTesting;
using NServiceBus.AcceptanceTesting;
Expand All @@ -10,7 +11,7 @@ namespace ServiceControl.AcceptanceTests.Licensing
class When_the_license_is_requested : AcceptanceTest
{
[Test]
public async Task Should_report_the_instance_and_where_to_extend_the_trial()
public async Task Should_report_the_instance_and_where_to_extend_the_trial(CancellationToken cancellationToken = default)
{
LicenseInfo license = null;

Expand All @@ -21,7 +22,7 @@ await Define<Context>()
license = result.Item;
return result.HasResult;
})
.Run();
.Run(cancellationToken);

using (Assert.EnterMultipleScope())
{
Expand All @@ -37,7 +38,7 @@ await Define<Context>()
}

[Test]
public async Task Should_reject_a_request_that_names_no_client()
public async Task Should_reject_a_request_that_names_no_client(CancellationToken cancellationToken = default)
{
HttpStatusCode status = default;

Expand All @@ -48,7 +49,7 @@ await Define<Context>()
status = response.StatusCode;
return true;
})
.Run();
.Run(cancellationToken);

Assert.That(status, Is.EqualTo(HttpStatusCode.BadRequest));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class When_a_custom_check_fails : AcceptanceTest
{
[Test]
public async Task Should_result_in_a_custom_check_failed_event()
public async Task Should_result_in_a_custom_check_failed_event(CancellationToken cancellationToken = default)
{
EventLogItem entry = null;

Expand All @@ -30,7 +30,7 @@ await Define<MyContext>()
entry = result;
return result;
})
.Run();
.Run(cancellationToken);

using (Assert.EnterMultipleScope())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace ServiceControl.AcceptanceTests.Monitoring.CustomChecks
class When_a_failing_custom_check_is_dismissed : AcceptanceTest
{
[Test]
public async Task Should_come_back_while_the_check_is_still_failing()
public async Task Should_come_back_while_the_check_is_still_failing(CancellationToken cancellationToken = default)
{
CustomCheckView dismissed = null;
CustomCheckView returned = null;
Expand Down Expand Up @@ -52,7 +52,7 @@ await this.Delete($"/api/customchecks/{WithoutPrefix(dismissed.Id)}"))
return returned != null;
})
.Done(_ => true)
.Run();
.Run(cancellationToken);

Assert.That(returned.FailureReason, Is.EqualTo(dismissed.FailureReason),
"Dismissing a check that is still failing cannot silence it for good, or a real failure disappears from the page for as long as it lasts");
Expand Down
Loading