Skip to content

SAMZA-2484: Fix flaky tests for Container Placements#1314

Merged
mynameborat merged 1 commit into
apache:masterfrom
Sanil15:test-fix
Mar 13, 2020
Merged

SAMZA-2484: Fix flaky tests for Container Placements#1314
mynameborat merged 1 commit into
apache:masterfrom
Sanil15:test-fix

Conversation

@Sanil15
Copy link
Copy Markdown
Contributor

@Sanil15 Sanil15 commented Mar 12, 2020

Symptom:
Noticed a few runs being flaky with:

org.apache.samza.clustermanager.TestContainerPlacementActions > testAlwaysMoveToAnyHostForHostAffinityDisabled FAILED
java.lang.AssertionError: expected:<IN_PROGRESS> but was:
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.failNotEquals(Assert.java:834)
at org.junit.Assert.assertEquals(Assert.java:118)
at org.junit.Assert.assertEquals(Assert.java:144)
at org.apache.samza.clustermanager.TestContainerPlacementActions.testAlwaysMoveToAnyHostForHostAffinityDisabled(TestContainerPlacementActions.java:746)

Cause:
A race between main thread expects to read a success message from metastore and am-rm thread to write a success messages

Changes:
Make the main thread busy loop on metastore success message, since a semaphore is hard to inject

@mynameborat mynameborat merged commit c864c4c into apache:master Mar 13, 2020
@rmatharu-zz
Copy link
Copy Markdown
Contributor

Is there a way to write such tests based on invariants, so that they dont rely on thread-sleeps and fail in case of scheduling delays?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants