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

Commit

Permalink
Enable failed test logging and fix flaky UT (#910)
Browse files Browse the repository at this point in the history
* Fix UT and add logging in gradle

* Fix UT and add logging in gradle

* Simplify test logging config
  • Loading branch information
dai-chen committed Dec 10, 2020
1 parent e0d72a2 commit d170da3
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 6 deletions.
1 change: 1 addition & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
}
}

Expand Down
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit d170da3

Please sign in to comment.