Skip to content

Commit b3e5442

Browse files
tests(): enable tests + flaky (#679)
1 parent 93478f2 commit b3e5442

22 files changed

+522
-352
lines changed

src/main/java/io/kestra/plugin/aws/athena/Query.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public QueryOutput run(RunContext runContext) throws Exception {
186186
.resultConfiguration(resultConfiguration)
187187
.build();
188188

189-
try (var client = client(runContext)) {
189+
try (var client = athenaClient(runContext)) {
190190
var startQueryExecution = client.startQueryExecution(startQueryExecutionRequest);
191191
var fetchType = runContext.render(this.fetchType).as(FetchType.class).orElseThrow();
192192
runContext.logger().info("Query created with Athena execution identifier {}", startQueryExecution.queryExecutionId());
@@ -257,6 +257,10 @@ else if (fetchType == FetchType.STORE) {
257257
}
258258
}
259259

260+
protected AthenaClient athenaClient(RunContext runContext) throws IllegalVariableEvaluationException {
261+
return client(runContext);
262+
}
263+
260264
private AthenaClient client(final RunContext runContext) throws IllegalVariableEvaluationException {
261265
AwsClientConfig clientConfig = awsClientConfig(runContext);
262266
return ConnectionUtils.configureSyncClient(clientConfig, AthenaClient.builder()).build();

src/main/java/io/kestra/plugin/aws/ecr/GetAuthToken.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public TokenOutput run(RunContext runContext) throws Exception {
6666
}
6767
}
6868

69-
private EcrClient client(final RunContext runContext) throws IllegalVariableEvaluationException {
69+
protected EcrClient client(final RunContext runContext) throws IllegalVariableEvaluationException {
7070
final AwsClientConfig clientConfig = awsClientConfig(runContext);
7171
return ConnectionUtils.configureSyncClient(clientConfig, EcrClient.builder()).build();
7272
}

src/main/java/io/kestra/plugin/aws/emr/AbstractEmrTask.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@ protected EmrClient client(final RunContext runContext) throws IllegalVariableEv
2121
final AwsClientConfig clientConfig = awsClientConfig(runContext);
2222
return ConnectionUtils.configureSyncClient(clientConfig, EmrClient.builder()).build();
2323
}
24+
25+
protected EmrClient emrClient(RunContext runContext) throws IllegalVariableEvaluationException {
26+
return client(runContext);
27+
}
2428
}

src/main/java/io/kestra/plugin/aws/emr/CreateClusterAndSubmitSteps.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ To launch the cluster in Amazon Virtual Private Cloud (Amazon VPC), set this par
159159

160160
@Override
161161
public Output run(RunContext runContext) throws IllegalVariableEvaluationException {
162-
try(var emrClient = this.client(runContext)) {
162+
try (var emrClient = this.emrClient(runContext)) {
163163
//Create Applications to be loaded
164164
List<Application> applicationsList = runContext.render(this.applications).asList(String.class)
165165
.stream()

src/main/java/io/kestra/plugin/aws/emr/DeleteCluster.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class DeleteCluster extends AbstractEmrTask implements RunnableTask<VoidO
5757

5858
@Override
5959
public VoidOutput run(RunContext runContext) throws IllegalVariableEvaluationException {
60-
try (EmrClient emrClient = this.client(runContext)) {
60+
try (var emrClient = this.emrClient(runContext)) {
6161
emrClient.terminateJobFlows(throwConsumer(request -> request.jobFlowIds(runContext.render(this.clusterIds).asList(String.class))));
6262
return null;
6363
}

src/main/java/io/kestra/plugin/aws/emr/SubmitSteps.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ The Amazon Resource Name (ARN) of the runtime role for a step on the cluster. Th
7878

7979
@Override
8080
public VoidOutput run(RunContext runContext) throws IllegalVariableEvaluationException {
81-
try(var emrClient = this.client(runContext)) {
81+
try (var emrClient = this.emrClient(runContext)) {
8282
List<software.amazon.awssdk.services.emr.model.StepConfig> jobSteps = steps.stream()
8383
.map(throwFunction(stepConfig -> stepConfig.toStep(runContext)))
8484
.toList();

src/main/java/io/kestra/plugin/aws/glue/AbstractGlueTask.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@ protected GlueClient client(final RunContext runContext) throws IllegalVariableE
2121
final AwsClientConfig clientConfig = awsClientConfig(runContext);
2222
return ConnectionUtils.configureSyncClient(clientConfig, GlueClient.builder()).build();
2323
}
24+
25+
protected GlueClient glueClient(RunContext runContext) throws IllegalVariableEvaluationException {
26+
return client(runContext);
27+
}
2428
}

src/main/java/io/kestra/plugin/aws/glue/GetJobRun.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public class GetJobRun extends AbstractGlueTask implements RunnableTask<Output>
8282

8383
@Override
8484
public Output run(RunContext runContext) throws IllegalVariableEvaluationException {
85-
try (GlueClient glueClient = this.client(runContext)) {
85+
try (GlueClient glueClient = this.glueClient(runContext)) {
8686
String jobNameValue = runContext.render(this.jobName).as(String.class).orElseThrow();
8787
String runIdValue = null;
8888

src/main/java/io/kestra/plugin/aws/glue/StartJobRun.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public class StartJobRun extends AbstractGlueTask implements RunnableTask<Output
9090

9191
@Override
9292
public Output run(RunContext runContext) throws IllegalVariableEvaluationException {
93-
try (GlueClient glueClient = this.client(runContext)) {
93+
try (GlueClient glueClient = this.glueClient(runContext)) {
9494
String jobNameValue = runContext.render(this.jobName).as(String.class).orElseThrow();
9595
String jobRunId = startJob(runContext, glueClient, jobNameValue);
9696

src/main/java/io/kestra/plugin/aws/glue/StopJobRun.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public Output run(RunContext runContext) throws Exception {
8888
boolean rwaitValue = runContext.render(this.wait).as(Boolean.class).orElse(true);
8989
Duration rintervalValue = runContext.render(this.interval).as(Duration.class).orElse(Duration.ofSeconds(1));
9090

91-
try (GlueClient glueClient = this.client(runContext)) {
91+
try (GlueClient glueClient = this.glueClient(runContext)) {
9292
// Stop the job
9393
BatchStopJobRunResponse stopResponse = glueClient.batchStopJobRun(
9494
BatchStopJobRunRequest.builder()

0 commit comments

Comments
 (0)