Skip to content

Commit 6dafab8

Browse files
author
Arunachalam Thirupathi
committed
Fix thee retryAnalyzer Annotations
RetryAnalyzer is set to Class.class which masks the actual Test failure errror. Mask optional exit code from the LocalCliProcess. Presto when query fails exits with 1, but there are tests to verify failure.
1 parent 086f8fc commit 6dafab8

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

tempto-core/src/main/java/io/prestodb/tempto/internal/convention/ConventionBasedTestProxyGenerator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
import net.bytebuddy.dynamic.loading.ClassLoadingStrategy;
2626
import net.bytebuddy.implementation.MethodCall;
2727
import org.slf4j.Logger;
28+
import org.testng.IRetryAnalyzer;
2829
import org.testng.annotations.CustomAttribute;
2930
import org.testng.annotations.Test;
31+
import org.testng.internal.annotations.DisabledRetryAnalyzer;
3032

3133
import java.lang.annotation.Annotation;
3234
import java.lang.reflect.InvocationTargetException;
@@ -267,9 +269,9 @@ public boolean singleThreaded()
267269
}
268270

269271
@Override
270-
public Class retryAnalyzer()
272+
public Class<? extends IRetryAnalyzer> retryAnalyzer()
271273
{
272-
return Class.class;
274+
return DisabledRetryAnalyzer.class;
273275
}
274276

275277
@Override

tempto-core/src/main/java/io/prestodb/tempto/process/LocalCliProcess.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
import io.prestodb.tempto.internal.process.CliProcessBase;
1717

1818
import java.time.Duration;
19+
import java.util.OptionalInt;
1920

21+
import static java.util.Objects.requireNonNull;
2022
import static java.util.concurrent.TimeUnit.MILLISECONDS;
2123

2224
/**
@@ -26,11 +28,18 @@ public class LocalCliProcess
2628
extends CliProcessBase
2729
{
2830
private final Process process;
31+
private final OptionalInt expectedExitValue;
2932

30-
public LocalCliProcess(Process process)
33+
public LocalCliProcess(Process process, OptionalInt expectedExitValue)
3134
{
3235
super(process.getInputStream(), process.getErrorStream(), process.getOutputStream());
3336
this.process = process;
37+
this.expectedExitValue = requireNonNull(expectedExitValue, "expectedExitValue is null");
38+
}
39+
40+
public LocalCliProcess(Process process)
41+
{
42+
this(process, OptionalInt.empty());
3443
}
3544

3645
@Override
@@ -43,7 +52,7 @@ public void waitForWithTimeoutAndKill(Duration timeout)
4352
}
4453

4554
int exitValue = process.exitValue();
46-
if (exitValue != 0) {
55+
if (exitValue != 0 && exitValue != expectedExitValue.orElse(0)) {
4756
throw new RuntimeException("Child process exited with non-zero code: " + exitValue);
4857
}
4958
}

0 commit comments

Comments
 (0)