|
16 | 16 |
|
17 | 17 | import org.apache.logging.log4j.LogManager; |
18 | 18 | import org.apache.logging.log4j.Logger; |
19 | | -import org.apache.lucene.tests.util.LuceneTestCase; |
20 | 19 | import org.elasticsearch.client.internal.node.NodeClient; |
21 | 20 | import org.elasticsearch.common.settings.MockSecureSettings; |
22 | 21 | import org.elasticsearch.common.settings.Settings; |
|
50 | 49 | import static org.hamcrest.Matchers.not; |
51 | 50 | import static org.hamcrest.Matchers.notNullValue; |
52 | 51 |
|
53 | | -@LuceneTestCase.AwaitsFix(bugUrl = "TODO NOMERGE") |
54 | 52 | @SuppressForbidden(reason = "test requires to set a System property to allow insecure settings when running in IDE") |
55 | 53 | public class RepositoryCredentialsTests extends ESSingleNodeTestCase { |
56 | 54 |
|
@@ -102,12 +100,14 @@ public void testRepositoryCredentialsOverrideSecureCredentials() { |
102 | 100 | assertThat(repositories.repository(repositoryName), instanceOf(S3Repository.class)); |
103 | 101 |
|
104 | 102 | final S3Repository repository = (S3Repository) repositories.repository(repositoryName); |
105 | | - final S3Client client = repository.createBlobStore().clientReference().client(); |
106 | | - assertThat(client, instanceOf(ProxyS3RepositoryPlugin.ClientAndCredentials.class)); |
| 103 | + try (var clientReference = repository.createBlobStore().clientReference()) { |
| 104 | + final S3Client client = clientReference.client(); |
| 105 | + assertThat(client, instanceOf(ProxyS3RepositoryPlugin.ClientAndCredentials.class)); |
107 | 106 |
|
108 | | - final AwsCredentials credentials = ((ProxyS3RepositoryPlugin.ClientAndCredentials) client).credentials.resolveCredentials(); |
109 | | - assertThat(credentials.accessKeyId(), is("insecure_aws_key")); |
110 | | - assertThat(credentials.secretAccessKey(), is("insecure_aws_secret")); |
| 107 | + final AwsCredentials credentials = ((ProxyS3RepositoryPlugin.ClientAndCredentials) client).credentials.resolveCredentials(); |
| 108 | + assertThat(credentials.accessKeyId(), is("insecure_aws_key")); |
| 109 | + assertThat(credentials.secretAccessKey(), is("insecure_aws_secret")); |
| 110 | + } |
111 | 111 |
|
112 | 112 | assertCriticalWarnings( |
113 | 113 | "[access_key] setting was deprecated in Elasticsearch and will be removed in a future release. " |
|
0 commit comments