Skip to content

Commit

Permalink
test: Fix flakiness of integration test by ordering column. (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangmichaellll committed Feb 11, 2021
1 parent b9313d3 commit 850c1eb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Expand Up @@ -42,7 +42,7 @@ public static void main(String[] args) throws Exception {
df.withColumn("word", splitCol.getItem(0))
.withColumn("word_count", splitCol.getItem(1).cast(DataTypes.LongType));
df = df.groupBy("word").sum("word_count");
df = df.orderBy(df.col("sum(word_count)").desc());
df = df.orderBy(df.col("sum(word_count)").desc(), df.col("word").asc());

StreamingQuery query =
df.writeStream()
Expand Down
Expand Up @@ -171,18 +171,18 @@ private void verifyDataprocOutput(Storage storage, Job job) {
+ "| a| 6|\n"
+ "| in| 5|\n"
+ "| that| 5|\n"
+ "| with| 4|\n"
+ "| soul| 4|\n"
+ "| us| 3|\n"
+ "| me| 3|\n"
+ "| when| 3|\n"
+ "| with| 4|\n"
+ "| as| 3|\n"
+ "| feel| 3|\n"
+ "| like| 3|\n"
+ "| me| 3|\n"
+ "| so| 3|\n"
+ "| as| 3|\n"
+ "| then| 3|\n"
+ "| us| 3|\n"
+ "| when| 3|\n"
+ "|which| 3|\n"
+ "|among| 2|\n"
+ "| am| 2|\n"
+ "+-----+---------------+\n"
+ "only showing top 20 rows";
assertThat(sparkJobOutput).contains(expectedWordCountResult);
Expand Down Expand Up @@ -218,7 +218,8 @@ private void setUpVariables() {
.build();
clusterName = env.get(CLUSTER_NAME);
bucketName = env.get(BUCKET_NAME);
workingDir = System.getProperty("user.dir")
workingDir =
System.getProperty("user.dir")
.replace("/samples/snapshot", "")
.replace("/samples/snippets", "");
sampleVersion = env.get(SAMPLE_VERSION);
Expand Down

0 comments on commit 850c1eb

Please sign in to comment.