-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* generate simple passwords for lts compatibility (this might be it)
* by default run the oldest lts instead of ci image * fixed gencert cli version mismatch
- Loading branch information
1 parent
477c03a
commit 418e996
Showing
9 changed files
with
174 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
test/EventStore.Client.Operations.Tests/AuthenticationTestsOld.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
namespace EventStore.Client; | ||
|
||
public class AuthenticationTestsOld : IClassFixture<InsecureClientTestFixture> { | ||
public AuthenticationTestsOld(ITestOutputHelper output, InsecureClientTestFixture fixture) => Fixture = fixture.With(x => x.CaptureTestRun(output)); | ||
|
||
InsecureClientTestFixture Fixture { get; } | ||
|
||
private static readonly Dictionary<string, UserCredentials> _credentials = | ||
new Dictionary<string, UserCredentials> { | ||
{ nameof(TestCredentials.Root), TestCredentials.Root }, | ||
{ nameof(TestCredentials.TestUser1), TestCredentials.TestUser1 }, | ||
}; | ||
|
||
public static IEnumerable<object?[]> AuthenticationCases() { | ||
var root = nameof(TestCredentials.Root); | ||
var testUser = nameof(TestCredentials.TestUser1); | ||
|
||
var shouldFail = false; | ||
var shouldSucceed = true; | ||
|
||
// no user credentials | ||
yield return new object?[] {1, root, null, shouldSucceed}; | ||
yield return new object?[] {2, testUser, null, shouldFail}; | ||
yield return new object?[] {3, null, null, shouldFail}; | ||
|
||
// unprivileged user credentials | ||
yield return new object?[] {4, root, testUser, shouldFail}; | ||
yield return new object?[] {5, testUser, testUser, shouldFail}; | ||
yield return new object?[] {6, null, testUser, shouldFail}; | ||
|
||
// root user credentials | ||
yield return new object?[] {7, root, root, shouldSucceed}; | ||
yield return new object?[] {8, testUser, root, shouldSucceed}; | ||
yield return new object?[] {9, null, root, shouldSucceed}; | ||
} | ||
|
||
[Theory, MemberData(nameof(AuthenticationCases))] | ||
public async Task system_call_with_credentials_combination(int caseNr, string? defaultUser, string? user, bool succeeds) { | ||
await Fixture.Users.CreateUserWithRetry( | ||
loginName: TestCredentials.TestUser1.Username!, | ||
fullName: nameof(TestCredentials.TestUser1), | ||
groups: Array.Empty<string>(), | ||
password: TestCredentials.TestUser1.Password!, | ||
userCredentials: TestCredentials.Root | ||
) | ||
.WithTimeout(TimeSpan.FromMilliseconds(1000)); | ||
|
||
var settings = Fixture.ClientSettings; | ||
|
||
settings.DefaultCredentials = defaultUser != null ? _credentials[defaultUser] : null; | ||
settings.ConnectionName = $"Authentication case #{caseNr} {defaultUser}"; | ||
|
||
await using var client = new EventStoreOperationsClient(settings); | ||
|
||
var result = await Record.ExceptionAsync(() => | ||
client.SetNodePriorityAsync(1, userCredentials: user != null ? _credentials[user] : null)); | ||
|
||
if (succeeds) { | ||
Assert.Null(result); | ||
return; | ||
} | ||
|
||
Assert.NotNull(result); | ||
} | ||
|
||
// public class Fixture : EventStoreClientFixture { | ||
// protected override async Task Given() { | ||
// var userManagementClient = new EventStoreUserManagementClient(Settings); | ||
// await userManagementClient.WarmUpAsync(); | ||
// | ||
// await userManagementClient.CreateUserWithRetry( | ||
// loginName: TestCredentials.TestUser1.Username!, | ||
// fullName: nameof(TestCredentials.TestUser1), | ||
// groups: Array.Empty<string>(), | ||
// password: TestCredentials.TestUser1.Password!, | ||
// userCredentials: TestCredentials.Root) | ||
// .WithTimeout(TimeSpan.FromMilliseconds(1000)); | ||
// } | ||
// | ||
// protected override Task When() => Task.CompletedTask; | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters