Skip to content

Commit

Permalink
Fixing flaky distinct tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rpeach-sag committed Sep 24, 2018
1 parent e73bc73 commit c3e97c2
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 65 deletions.
14 changes: 1 addition & 13 deletions test/tests/Operators/Distinct/Async/Input/test.mon
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,9 @@ monitor TestObservable {
Test test := Test("TestResult");

action onload() {
any discard := Observable.fromChannel("Test")
any discard := Observable.fromValues([1,1,2,1,2,0,1,2,3]).async()
.distinct()
.take(4)
.subscribe(ExpectValues.create([<any>1,2,0,3], test.complete, test.fail));

on wait(0.1) {
send WrappedAny(1) to "Test";
send WrappedAny(1) to "Test";
send WrappedAny(2) to "Test";
send WrappedAny(1) to "Test";
send WrappedAny(2) to "Test";
send WrappedAny(0) to "Test";
send WrappedAny(1) to "Test";
send WrappedAny(2) to "Test";
send WrappedAny(3) to "Test";
}
}
}
23 changes: 10 additions & 13 deletions test/tests/Operators/DistinctBy/Async/Input/test.mon
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,19 @@ monitor TestObservable {
Test test := Test("TestResult");

action onload() {
any discard := Observable.fromChannel("Test")
any discard := Observable.fromValues([
TestEvent(1, 2.0),
TestEvent.create(1),
TestEvent(2, 2.0),
TestEvent.create(1),
TestEvent.create(2),
TestEvent(0, 2.0),
TestEvent.create(1),
TestEvent.create(2),
TestEvent(3, 2.0)]).async()
.distinctBy(getIValue)
.take(4)
.subscribe(ExpectValues.create([<any>TestEvent(1, 2.0),TestEvent(2, 2.0),TestEvent(0, 2.0),TestEvent(3, 2.0)], test.complete, test.fail));

on wait(0.5) {
send TestEvent(1, 2.0) to "Test";
send TestEvent.create(1) to "Test";
send TestEvent(2, 2.0) to "Test";
send TestEvent.create(1) to "Test";
send TestEvent.create(2) to "Test";
send TestEvent(0, 2.0) to "Test";
send TestEvent.create(1) to "Test";
send TestEvent.create(2) to "Test";
send TestEvent(3, 2.0) to "Test";
}
}

action getIValue(any testEventAsAny) returns any {
Expand Down
23 changes: 10 additions & 13 deletions test/tests/Operators/DistinctByField/Async/Input/test.mon
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,18 @@ monitor TestObservable {
Test test := Test("TestResult");

action onload() {
any discard := Observable.fromChannel("Test")
any discard := Observable.fromValues([
TestEvent(1, 2.0),
TestEvent.create(1),
TestEvent(2, 2.0),
TestEvent.create(1),
TestEvent.create(2),
TestEvent(0, 2.0),
TestEvent.create(1),
TestEvent.create(2),
TestEvent(3, 2.0)]).async()
.distinctByField("i")
.take(4)
.subscribe(ExpectValues.create([<any>TestEvent(1, 2.0),TestEvent(2, 2.0),TestEvent(0, 2.0),TestEvent(3, 2.0)], test.complete, test.fail));

on wait(0.5) {
send TestEvent(1, 2.0) to "Test";
send TestEvent.create(1) to "Test";
send TestEvent(2, 2.0) to "Test";
send TestEvent.create(1) to "Test";
send TestEvent.create(2) to "Test";
send TestEvent(0, 2.0) to "Test";
send TestEvent.create(1) to "Test";
send TestEvent.create(2) to "Test";
send TestEvent(3, 2.0) to "Test";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,16 @@ monitor TestObservable {
Test test := Test("TestResult");

action onload() {
any discard := Observable.fromChannel("Test")
any discard := Observable.fromValues([
TestEvent(1, 2.0),
TestEvent.create(1),
TestEvent(2, 2.0),
TestEvent.create(2),
TestEvent(1, 2.0),
TestEvent(0, 2.0),
TestEvent.create(0)]).async()
.distinctByFieldUntilChanged("i")
.take(4)
.subscribe(ExpectValues.create([<any>TestEvent(1, 2.0),TestEvent(2, 2.0),TestEvent(1, 2.0),TestEvent(0, 2.0)], test.complete, test.fail));

on wait(0.5) {
send TestEvent(1, 2.0) to "Test";
send TestEvent.create(1) to "Test";
send TestEvent(2, 2.0) to "Test";
send TestEvent.create(2) to "Test";
send TestEvent(1, 2.0) to "Test";
send TestEvent(0, 2.0) to "Test";
send TestEvent.create(0) to "Test";
}
}
}
17 changes: 2 additions & 15 deletions test/tests/Operators/DistinctUntilChanged/Async/Input/test.mon
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,10 @@ using com.industry.rx_epl.WrappedAny;
monitor TestObservable {
Test test := Test("TestResult");

action onload() {
any discard := Observable.fromChannel("Test")
action onload() {
any discard := Observable.fromValues([1,1,2,1,2,0,0,1,2,3]).async()
.distinctUntilChanged()
.take(8)
.subscribe(ExpectValues.create([<any>1,2,1,2,0,1,2,3], test.complete, test.fail));

on wait(0.1) {
send WrappedAny(1) to "Test";
send WrappedAny(1) to "Test";
send WrappedAny(2) to "Test";
send WrappedAny(1) to "Test";
send WrappedAny(2) to "Test";
send WrappedAny(0) to "Test";
send WrappedAny(0) to "Test";
send WrappedAny(1) to "Test";
send WrappedAny(2) to "Test";
send WrappedAny(3) to "Test";
}
}
}

0 comments on commit c3e97c2

Please sign in to comment.