@@ -27,56 +27,56 @@ namespace Apache.Arrow.Adbc.Tests.Drivers.Databricks.Auth
2727{
2828 public class OAuthClientCredentialsProviderTests : TestBase < DatabricksTestConfiguration , DatabricksTestEnvironment > , IDisposable
2929 {
30- private readonly OAuthClientCredentialsProvider _service ;
31-
3230 public OAuthClientCredentialsProviderTests ( ITestOutputHelper ? outputHelper )
3331 : base ( outputHelper , new DatabricksTestEnvironment . Factory ( ) )
3432 {
35- _service = new OAuthClientCredentialsProvider (
33+ }
34+
35+ private OAuthClientCredentialsProvider CreateService ( )
36+ {
37+ return new OAuthClientCredentialsProvider (
3638 TestConfiguration . OAuthClientId ,
3739 TestConfiguration . OAuthClientSecret ,
3840 TestConfiguration . HostName ,
3941 timeoutMinutes : 1 ) ;
4042 }
4143
42- [ Fact ]
44+ [ SkippableFact ]
4345 public void GetAccessToken_WithValidCredentials_ReturnsToken ( )
4446 {
4547 Skip . IfNot ( ! string . IsNullOrEmpty ( TestConfiguration . OAuthClientId ) , "OAuth credentials not configured" ) ;
4648
47- var token = _service . GetAccessToken ( ) ;
49+ var service = CreateService ( ) ;
50+ var token = service . GetAccessToken ( ) ;
4851
4952 Assert . NotNull ( token ) ;
5053 Assert . NotEmpty ( token ) ;
5154 }
5255
53- [ Fact ]
56+ [ SkippableFact ]
5457 public void GetAccessToken_WithCancellation_ThrowsOperationCanceledException ( )
5558 {
5659 Skip . IfNot ( ! string . IsNullOrEmpty ( TestConfiguration . OAuthClientId ) , "OAuth credentials not configured" ) ;
5760
61+ var service = CreateService ( ) ;
5862 using var cts = new CancellationTokenSource ( ) ;
5963 cts . Cancel ( ) ;
6064
61- Assert . Throws < OperationCanceledException > ( ( ) =>
62- _service . GetAccessToken ( cts . Token ) ) ;
65+ var ex = Assert . ThrowsAny < OperationCanceledException > ( ( ) =>
66+ service . GetAccessToken ( cts . Token ) ) ;
67+ Assert . IsType < TaskCanceledException > ( ex ) ;
6368 }
6469
65- [ Fact ]
70+ [ SkippableFact ]
6671 public void GetAccessToken_MultipleCalls_ReusesCachedToken ( )
6772 {
6873 Skip . IfNot ( ! string . IsNullOrEmpty ( TestConfiguration . OAuthClientId ) , "OAuth credentials not configured" ) ;
6974
70- var token1 = _service . GetAccessToken ( ) ;
71- var token2 = _service . GetAccessToken ( ) ;
75+ var service = CreateService ( ) ;
76+ var token1 = service . GetAccessToken ( ) ;
77+ var token2 = service . GetAccessToken ( ) ;
7278
7379 Assert . Equal ( token1 , token2 ) ;
7480 }
75-
76- void IDisposable . Dispose ( )
77- {
78- _service . Dispose ( ) ;
79- base . Dispose ( ) ;
80- }
8181 }
8282}
0 commit comments