Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Enable failed test logging and fix flaky UT #910

Merged
merged 4 commits into from Dec 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions core/build.gradle
Expand Up @@ -34,6 +34,7 @@ test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
}
}

Expand Down
1 change: 1 addition & 0 deletions elasticsearch/build.gradle
Expand Up @@ -28,6 +28,7 @@ test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
}
}

Expand Down
5 changes: 5 additions & 0 deletions legacy/build.gradle
Expand Up @@ -53,6 +53,11 @@ test {
// set 'project.projectDir' property to allow unit test classes to access test resources
// in src/test/resources in current module
systemProperty('project.root', project.projectDir.absolutePath)

testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
}
}

dependencies {
Expand Down
7 changes: 7 additions & 0 deletions ppl/build.gradle
Expand Up @@ -42,6 +42,13 @@ dependencies {

}

test {
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
}
}

jacoco {
toolVersion = "0.8.5"
}
Expand Down
1 change: 1 addition & 0 deletions protocol/build.gradle
Expand Up @@ -27,6 +27,7 @@ test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
}
}

Expand Down
1 change: 1 addition & 0 deletions sql/build.gradle
Expand Up @@ -44,6 +44,7 @@ test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
}
}

Expand Down
Expand Up @@ -40,7 +40,7 @@
import com.amazon.opendistroforelasticsearch.sql.sql.parser.AstExpressionBuilder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -82,7 +82,7 @@ public class QuerySpecification {
* Aggregate function calls that spreads in SELECT, HAVING clause. Since this is going to be
* pushed to aggregation operator, de-duplicate is necessary to avoid duplication.
*/
private final Set<UnresolvedExpression> aggregators = new HashSet<>();
private final Set<UnresolvedExpression> aggregators = new LinkedHashSet<>();

/**
* Items in GROUP BY clause that may be:
Expand Down
Expand Up @@ -197,20 +197,33 @@ public void can_build_where_clause() {
}

@Test
public void can_build_count_star_and_count_literal() {
public void can_build_count_literal() {
assertEquals(
project(
agg(
relation("test"),
ImmutableList.of(
alias("COUNT(*)", aggregate("COUNT", AllFields.of())),
alias("COUNT(1)", aggregate("COUNT", intLiteral(1)))),
emptyList(),
emptyList(),
emptyList()),
alias("COUNT(*)", aggregate("COUNT", AllFields.of())),
alias("COUNT(1)", aggregate("COUNT", intLiteral(1)))),
buildAST("SELECT COUNT(*), COUNT(1) FROM test"));
buildAST("SELECT COUNT(1) FROM test"));
}

@Test
public void can_build_count_star() {
assertEquals(
project(
agg(
relation("test"),
ImmutableList.of(
alias("COUNT(*)", aggregate("COUNT", AllFields.of()))),
emptyList(),
emptyList(),
emptyList()),
alias("COUNT(*)", aggregate("COUNT", AllFields.of()))),
buildAST("SELECT COUNT(*) FROM test"));
}

@Test
Expand Down