@@ -38,23 +38,26 @@ public class TestGcsFileSystemConfig
38
38
@ Test
39
39
void testDefaults ()
40
40
{
41
- assertRecordedDefaults (recordDefaults (GcsFileSystemConfig .class )
42
- .setReadBlockSize (DataSize .of (2 , MEGABYTE ))
43
- .setWriteBlockSize (DataSize .of (16 , MEGABYTE ))
44
- .setPageSize (100 )
45
- .setBatchSize (100 )
46
- .setProjectId (null )
47
- .setEndpoint (Optional .empty ())
48
- .setUseGcsAccessToken (false )
49
- .setAuthType (null )
50
- .setJsonKey (null )
51
- .setJsonKeyFilePath (null )
52
- .setMaxRetries (20 )
53
- .setBackoffScaleFactor (3.0 )
54
- .setMaxRetryTime (new Duration (25 , SECONDS ))
55
- .setMinBackoffDelay (new Duration (10 , MILLISECONDS ))
56
- .setMaxBackoffDelay (new Duration (2000 , MILLISECONDS ))
57
- .setApplicationId ("Trino" ));
41
+ assertThatThrownBy (
42
+ () -> assertRecordedDefaults (recordDefaults (GcsFileSystemConfig .class )
43
+ .setReadBlockSize (DataSize .of (2 , MEGABYTE ))
44
+ .setWriteBlockSize (DataSize .of (16 , MEGABYTE ))
45
+ .setPageSize (100 )
46
+ .setBatchSize (100 )
47
+ .setProjectId (null )
48
+ .setEndpoint (Optional .empty ())
49
+ .setAuthType (null )
50
+ .setJsonKey (null )
51
+ .setJsonKeyFilePath (null )
52
+ .setMaxRetries (20 )
53
+ .setBackoffScaleFactor (3.0 )
54
+ .setMaxRetryTime (new Duration (25 , SECONDS ))
55
+ .setMinBackoffDelay (new Duration (10 , MILLISECONDS ))
56
+ .setMaxBackoffDelay (new Duration (2000 , MILLISECONDS ))
57
+ .setApplicationId ("Trino" )))
58
+ .isInstanceOf (AssertionError .class )
59
+ // use-access-token is not deprecated and isn't allowed to be set with auth-type
60
+ .hasMessage ("Untested attributes: [UseGcsAccessToken]" );
58
61
}
59
62
60
63
@ Test
@@ -102,6 +105,12 @@ void testSetUseGcsAccessTokenWithAuthType()
102
105
assertThatThrownBy (() -> new GcsFileSystemConfig ().setAuthType (AuthType .DEFAULT ).setUseGcsAccessToken (false ))
103
106
.isInstanceOf (IllegalArgumentException .class )
104
107
.hasMessage ("Cannot set both gcs.use-access-token and gcs.auth-type" );
108
+ assertThatThrownBy (() -> new GcsFileSystemConfig ().setUseGcsAccessToken (true ).setAuthType (AuthType .ACCESS_TOKEN ))
109
+ .isInstanceOf (IllegalArgumentException .class )
110
+ .hasMessage ("Cannot set both gcs.use-access-token and gcs.auth-type" );
111
+ assertThatThrownBy (() -> new GcsFileSystemConfig ().setUseGcsAccessToken (true ).setAuthType (AuthType .DEFAULT ))
112
+ .isInstanceOf (IllegalArgumentException .class )
113
+ .hasMessage ("Cannot set both gcs.use-access-token and gcs.auth-type" );
105
114
}
106
115
107
116
@ Test
0 commit comments