1717import io .airlift .units .DataSize ;
1818import io .airlift .units .Duration ;
1919import io .trino .filesystem .gcs .GcsFileSystemConfig .AuthType ;
20- import jakarta .validation .constraints .AssertFalse ;
2120import jakarta .validation .constraints .AssertTrue ;
2221import org .junit .jupiter .api .Test ;
2322
@@ -43,7 +42,6 @@ void testDefaults()
4342 .setWriteBlockSize (DataSize .of (16 , MEGABYTE ))
4443 .setPageSize (100 )
4544 .setBatchSize (100 )
46- .setUseGcsAccessToken (false )
4745 .setProjectId (null )
4846 .setEndpoint (Optional .empty ())
4947 .setAuthType (AuthType .SERVICE_ACCOUNT )
@@ -90,44 +88,7 @@ void testExplicitPropertyMappings()
9088 .setMinBackoffDelay (new Duration (20 , MILLISECONDS ))
9189 .setMaxBackoffDelay (new Duration (20 , MILLISECONDS ))
9290 .setApplicationId ("application id" );
93- assertFullMapping (properties , expected , Set .of ("gcs.json-key" , "gcs.json-key-file-path" , "gcs.use-access-token" ));
94- }
95-
96- // backwards compatibility test, remove if use-access-token is removed
97- @ Test
98- void testExplicitPropertyMappingsWithDeprecatedUseAccessToken ()
99- {
100- Map <String , String > properties = ImmutableMap .<String , String >builder ()
101- .put ("gcs.read-block-size" , "51MB" )
102- .put ("gcs.write-block-size" , "52MB" )
103- .put ("gcs.page-size" , "10" )
104- .put ("gcs.batch-size" , "11" )
105- .put ("gcs.project-id" , "project" )
106- .put ("gcs.endpoint" , "http://custom.dns.org:8000" )
107- .put ("gcs.use-access-token" , "true" )
108- .put ("gcs.client.max-retries" , "10" )
109- .put ("gcs.client.backoff-scale-factor" , "4.0" )
110- .put ("gcs.client.max-retry-time" , "10s" )
111- .put ("gcs.client.min-backoff-delay" , "20ms" )
112- .put ("gcs.client.max-backoff-delay" , "20ms" )
113- .put ("gcs.application-id" , "application id" )
114- .buildOrThrow ();
115-
116- GcsFileSystemConfig expected = new GcsFileSystemConfig ()
117- .setReadBlockSize (DataSize .of (51 , MEGABYTE ))
118- .setWriteBlockSize (DataSize .of (52 , MEGABYTE ))
119- .setPageSize (10 )
120- .setBatchSize (11 )
121- .setProjectId ("project" )
122- .setEndpoint (Optional .of ("http://custom.dns.org:8000" ))
123- .setUseGcsAccessToken (true )
124- .setMaxRetries (10 )
125- .setBackoffScaleFactor (4.0 )
126- .setMaxRetryTime (new Duration (10 , SECONDS ))
127- .setMinBackoffDelay (new Duration (20 , MILLISECONDS ))
128- .setMaxBackoffDelay (new Duration (20 , MILLISECONDS ))
129- .setApplicationId ("application id" );
130- assertFullMapping (properties , expected , Set .of ("gcs.json-key" , "gcs.json-key-file-path" , "gcs.auth-type" ));
91+ assertFullMapping (properties , expected , Set .of ("gcs.json-key" , "gcs.json-key-file-path" ));
13192 }
13293
13394 @ Test
@@ -165,37 +126,5 @@ public void testValidation()
165126 "retryDelayValid" ,
166127 "gcs.client.min-backoff-delay must be less than or equal to gcs.client.max-backoff-delay" ,
167128 AssertTrue .class );
168-
169- assertFailsValidation (
170- new GcsFileSystemConfig ()
171- .setAuthType (AuthType .ACCESS_TOKEN )
172- .setUseGcsAccessToken (true ),
173- "authTypeAndGcsAccessTokenConfigured" ,
174- "Cannot set both gcs.use-access-token and gcs.auth-type" ,
175- AssertFalse .class );
176-
177- assertFailsValidation (
178- new GcsFileSystemConfig ()
179- .setAuthType (AuthType .ACCESS_TOKEN )
180- .setUseGcsAccessToken (false ),
181- "authTypeAndGcsAccessTokenConfigured" ,
182- "Cannot set both gcs.use-access-token and gcs.auth-type" ,
183- AssertFalse .class );
184-
185- assertFailsValidation (
186- new GcsFileSystemConfig ()
187- .setUseGcsAccessToken (true )
188- .setAuthType (AuthType .SERVICE_ACCOUNT ),
189- "authTypeAndGcsAccessTokenConfigured" ,
190- "Cannot set both gcs.use-access-token and gcs.auth-type" ,
191- AssertFalse .class );
192-
193- assertFailsValidation (
194- new GcsFileSystemConfig ()
195- .setUseGcsAccessToken (false )
196- .setAuthType (AuthType .SERVICE_ACCOUNT ),
197- "authTypeAndGcsAccessTokenConfigured" ,
198- "Cannot set both gcs.use-access-token and gcs.auth-type" ,
199- AssertFalse .class );
200129 }
201130}
0 commit comments