Skip to content

Commit

Permalink
[FLINK-22492][test] Use order-agnostic check in KinesisTableApiITCase.
Browse files Browse the repository at this point in the history
The query doesn't impose any ordering and a reorder may happen as is.
  • Loading branch information
Arvid Heise authored and AHeise committed Jun 26, 2021
1 parent 5080af0 commit b068623
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
Expand All @@ -49,7 +50,7 @@
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

import static org.junit.Assert.assertEquals;
import static org.hamcrest.MatcherAssert.assertThat;

/** End-to-end test for Kinesis Table API using Kinesalite. */
@Category(value = {TravisGroup1.class})
Expand Down Expand Up @@ -107,8 +108,9 @@ public void testTableApiSourceAndSink() throws Exception {

executeSqlStatements(readSqlFile("filter-large-orders.sql"));

// result order is not guaranteed
List<Order> result = readAllOrdersFromKinesis(kinesisClient);
assertEquals(expected, result);
assertThat(result, Matchers.containsInAnyOrder(expected.toArray(new Order[0])));
}

private List<Order> readAllOrdersFromKinesis(final KinesisPubsubClient client)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,9 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(code, quantity);
}

@Override
public String toString() {
return "Order{" + "code='" + code + '\'' + ", quantity=" + quantity + '}';
}
}

0 comments on commit b068623

Please sign in to comment.