Skip to content

Commit 18fa5fa

Browse files
committed
* Debugging
1 parent 84900c2 commit 18fa5fa

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

projects/RabbitMQ.Client.OAuth2/CredentialsRefresher.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ private async Task RefreshLoopAsync()
9393
}
9494

9595
CredentialsRefresherEventSource.Log.RefreshedCredentials(_credentialsProvider.Name);
96+
97+
Console.WriteLine("{0} [DEBUG] calling _onRefreshed, ValidUntil: {1}", DateTime.Now, _credentials.ValidUntil);
9698
await _onRefreshed(_credentials, null, _linkedCts.Token)
9799
.ConfigureAwait(false);
98100
}
@@ -112,6 +114,8 @@ await _onRefreshed(null, ex, _linkedCts.Token)
112114
delaySpan = TimeSpan.FromMilliseconds(_credentials.ValidUntil.Value.TotalMilliseconds * (1.0 - (1 / 3.0)));
113115
}
114116

117+
Console.WriteLine("{0} [DEBUG] RefreshLoopAsync delaySpan : {1}",
118+
DateTime.Now, delaySpan);
115119
await Task.Delay(delaySpan, _linkedCts.Token)
116120
.ConfigureAwait(false);
117121
}

projects/Test/Common/Util.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public Util(string managementUsername, string managementPassword)
2626
{
2727
if (string.IsNullOrEmpty(managementUsername))
2828
{
29-
throw new ArgumentNullException(nameof(managementUsername));
29+
managementUsername = "guest";
3030
}
3131

3232
if (string.IsNullOrEmpty(managementPassword))

projects/Test/OAuth2/TestOAuth2.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,17 @@ public async Task DisposeAsync()
208208
private Task OnCredentialsRefreshedAsync(Credentials? credentials, Exception? exception,
209209
CancellationToken cancellationToken = default)
210210
{
211+
Console.WriteLine("{0} [INFO] OnCredentialsRefreshedAsync start", DateTime.Now);
212+
211213
if (_connection is null)
212214
{
213215
Assert.Fail("_connection is unexpectedly null!");
214216
}
215217

216218
if (exception != null)
217219
{
220+
Console.WriteLine("{0} [ERROR] OnCredentialsRefreshedAsync exception: {1}",
221+
DateTime.Now, exception);
218222
Assert.Fail($"exception is unexpectedly not-null: {exception}");
219223
}
220224

@@ -227,9 +231,10 @@ private Task OnCredentialsRefreshedAsync(Credentials? credentials, Exception? ex
227231
{
228232
_util.Dispose();
229233
}
230-
_util = new Util(credentials.UserName, credentials.Password);
234+
_util = new Util("mgt_api_client", credentials.Password);
231235

232236
_testOutputHelper.WriteLine("{0} [INFO] calling UpdateSecretAsync", DateTime.Now);
237+
Console.WriteLine("{0} [INFO] calling UpdateSecretAsync", DateTime.Now);
233238
return _connection.UpdateSecretAsync(credentials.Password, "Token refresh", cancellationToken);
234239
}
235240

@@ -253,7 +258,7 @@ public async void IntegrationTest()
253258
_testOutputHelper.WriteLine("{0} [INFO] wait '{1}' until Token expires. Attempt #{1}",
254259
DateTime.Now, delaySpan, (i + 1));
255260

256-
if (i == 2)
261+
if (i == 1)
257262
{
258263
Assert.NotNull(_util);
259264
closeConnectionTask = _util.CloseConnectionAsync(_connection);

0 commit comments

Comments
 (0)