Skip to content

Commit

Permalink
fix: JS InputTable test failure and race (#5616)
Browse files Browse the repository at this point in the history
This test was slightly racy, able to fail other unrelated tests in
some situations.

Follow-up to #5600
  • Loading branch information
niloc132 authored Jun 14, 2024
1 parent 27553a3 commit e0b8ed8
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class InputTableTestGwt extends AbstractAsyncGwtTestCase {
.script("result3", "input_table(init_table=source, key_cols=[\"C\"])")
.script("result4", "input_table(init_table=source, key_cols=[\"E\" , \"F\" ])");

public void testInputTable() {
public void testNoKeyCols() {
connect(tables)
.then(table("result1"))
.then(JsTable::inputTable)
Expand All @@ -26,42 +26,48 @@ public void testInputTable() {
return null;
})
.then(this::finish).catch_(this::report);
}

public void testFirstColsAreKeyCols() {
connect(tables)
.then(table("result2"))
.then(JsTable::inputTable)
.then(inputTable -> {
JsArray<Column> keyColumns = Js.uncheckedCast(inputTable.getKeyColumns());
assertEquals(2,
keyColumns.filter((col, idx) -> col.getName() == "A" || col.getName() == "B").length);
JsArray<Column> valueColumns = Js.uncheckedCast(inputTable.getValues());
JsArray<Column> valueColumns = Js.uncheckedCast(inputTable.getValueColumns());
assertEquals(4, valueColumns.filter((col, idx) -> col.getName() == "C" || col.getName() == "D"
|| col.getName() == "E" || col.getName() == "F").length);
return null;
})
.then(this::finish).catch_(this::report);
}

public void testOneKeyCol() {
connect(tables)
.then(table("result3"))
.then(JsTable::inputTable)
.then(inputTable -> {
JsArray<Column> keyColumns = Js.uncheckedCast(inputTable.getKeyColumns());
assertEquals(1, keyColumns.filter((col, idx) -> col.getName() == "C").length);
JsArray<Column> valueColumns = Js.uncheckedCast(inputTable.getValues());
JsArray<Column> valueColumns = Js.uncheckedCast(inputTable.getValueColumns());
assertEquals(5, valueColumns.filter((col, idx) -> col.getName() == "A" || col.getName() == "B"
|| col.getName() == "D" || col.getName() == "E" || col.getName() == "F").length);
return null;
})
.then(this::finish).catch_(this::report);
}

public void testLaterColsAreKeyCols() {
connect(tables)
.then(table("result4"))
.then(JsTable::inputTable)
.then(inputTable -> {
JsArray<Column> keyColumns = Js.uncheckedCast(inputTable.getKeyColumns());
assertEquals(2,
keyColumns.filter((col, idx) -> col.getName() == "E" || col.getName() == "F").length);
JsArray<Column> valueColumns = Js.uncheckedCast(inputTable.getValues());
JsArray<Column> valueColumns = Js.uncheckedCast(inputTable.getValueColumns());
assertEquals(4, valueColumns.filter((col, idx) -> col.getName() == "A" || col.getName() == "B"
|| col.getName() == "C" || col.getName() == "D").length);
return null;
Expand Down

0 comments on commit e0b8ed8

Please sign in to comment.