diff --git a/src/EventStore.Client.Common/protos/operations.proto b/src/EventStore.Client.Common/protos/operations.proto index 8576caa58..e8d5d2726 100644 --- a/src/EventStore.Client.Common/protos/operations.proto +++ b/src/EventStore.Client.Common/protos/operations.proto @@ -11,6 +11,7 @@ service Operations { rpc MergeIndexes (Empty) returns (Empty); rpc ResignNode (Empty) returns (Empty); rpc SetNodePriority (SetNodePriorityReq) returns (Empty); + rpc RestartPersistentSubscriptions (Empty) returns (Empty); } message StartScavengeReq { diff --git a/src/EventStore.Client.Operations/EventStoreOperationsClient.Admin.cs b/src/EventStore.Client.Operations/EventStoreOperationsClient.Admin.cs index 9e53cb11a..3575cb50c 100644 --- a/src/EventStore.Client.Operations/EventStoreOperationsClient.Admin.cs +++ b/src/EventStore.Client.Operations/EventStoreOperationsClient.Admin.cs @@ -59,5 +59,17 @@ public async Task SetNodePriorityAsync(int nodePriority, await _client.SetNodePriorityAsync(new SetNodePriorityReq {Priority = nodePriority}, EventStoreCallOptions.Create(Settings, Settings.OperationOptions, userCredentials, cancellationToken)); } + + /// + /// Restart persistent subscriptions + /// + /// + /// + /// + public async Task RestartPersistentSubscriptions(UserCredentials? userCredentials = null, + CancellationToken cancellationToken = default) { + await _client.RestartPersistentSubscriptionsAsync(EmptyResult, + EventStoreCallOptions.Create(Settings, Settings.OperationOptions, userCredentials, cancellationToken)); + } } } diff --git a/test/EventStore.Client.Operations.Tests/admin.cs b/test/EventStore.Client.Operations.Tests/admin.cs index d8f2a9a6a..7979f9f6c 100644 --- a/test/EventStore.Client.Operations.Tests/admin.cs +++ b/test/EventStore.Client.Operations.Tests/admin.cs @@ -10,43 +10,23 @@ public admin(Fixture fixture) { } [Fact] - public async Task shutdown_does_not_throw() { - await _fixture.Client.ShutdownAsync(userCredentials: TestCredentials.Root); - } - - [Fact] - public async Task shutdown_without_credentials_throws() { - await Assert.ThrowsAsync(() => _fixture.Client.ShutdownAsync()); - } - - [Fact] - public async Task set_node_priority_does_not_throw() { - await _fixture.Client.SetNodePriorityAsync(1000, TestCredentials.Root); - } - - [Fact] - public async Task set_node_priority_without_credentials_throws() { - await Assert.ThrowsAsync(() => _fixture.Client.SetNodePriorityAsync(1000)); - } - - [Fact] - public async Task resign_node_does_not_throw() { - await _fixture.Client.ResignNodeAsync(TestCredentials.Root); + public async Task merge_indexes_does_not_throw() { + await _fixture.Client.MergeIndexesAsync(TestCredentials.Root); } [Fact] - public async Task resign_node_without_credentials_throws() { - await Assert.ThrowsAsync(() => _fixture.Client.ResignNodeAsync()); + public async Task merge_indexes_without_credentials_throws() { + await Assert.ThrowsAsync(() => _fixture.Client.MergeIndexesAsync()); } - + [Fact] - public async Task merge_indexes_does_not_throw() { - await _fixture.Client.MergeIndexesAsync(TestCredentials.Root); + public async Task restart_persistent_subscriptions_does_not_throw() { + await _fixture.Client.RestartPersistentSubscriptions(TestCredentials.Root); } [Fact] - public async Task merge_indexes_without_credentials_throws() { - await Assert.ThrowsAsync(() => _fixture.Client.MergeIndexesAsync()); + public async Task restart_persistent_subscriptions_without_credentials_throws() { + await Assert.ThrowsAsync(() => _fixture.Client.RestartPersistentSubscriptions()); } public class Fixture : EventStoreClientFixture { diff --git a/test/EventStore.Client.Operations.Tests/admin_resign_node.cs b/test/EventStore.Client.Operations.Tests/admin_resign_node.cs new file mode 100644 index 000000000..8f788fda5 --- /dev/null +++ b/test/EventStore.Client.Operations.Tests/admin_resign_node.cs @@ -0,0 +1,27 @@ +using System.Threading.Tasks; +using Xunit; + +namespace EventStore.Client { + public class admin_resign_node : IClassFixture { + private readonly Fixture _fixture; + + public admin_resign_node(Fixture fixture) { + _fixture = fixture; + } + + [Fact] + public async Task resign_node_does_not_throw() { + await _fixture.Client.ResignNodeAsync(TestCredentials.Root); + } + + [Fact] + public async Task resign_node_without_credentials_throws() { + await Assert.ThrowsAsync(() => _fixture.Client.ResignNodeAsync()); + } + + public class Fixture : EventStoreClientFixture { + protected override Task Given() => Task.CompletedTask; + protected override Task When() => Task.CompletedTask; + } + } +} diff --git a/test/EventStore.Client.Operations.Tests/admin_shutdown_node.cs b/test/EventStore.Client.Operations.Tests/admin_shutdown_node.cs new file mode 100644 index 000000000..d471c31c1 --- /dev/null +++ b/test/EventStore.Client.Operations.Tests/admin_shutdown_node.cs @@ -0,0 +1,27 @@ +using System.Threading.Tasks; +using Xunit; + +namespace EventStore.Client { + public class admin_shutdown_node : IClassFixture { + private readonly Fixture _fixture; + + public admin_shutdown_node(Fixture fixture) { + _fixture = fixture; + } + + [Fact] + public async Task shutdown_does_not_throw() { + await _fixture.Client.ShutdownAsync(userCredentials: TestCredentials.Root); + } + + [Fact] + public async Task shutdown_without_credentials_throws() { + await Assert.ThrowsAsync(() => _fixture.Client.ShutdownAsync()); + } + + public class Fixture : EventStoreClientFixture { + protected override Task Given() => Task.CompletedTask; + protected override Task When() => Task.CompletedTask; + } + } +}