Skip to content

Commit

Permalink
aio: correct order for test to avoid race
Browse files Browse the repository at this point in the history
Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Apr 24, 2017
1 parent 822ca70 commit ce7b34d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/aio/analog_sensor_driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ func TestAnalogSensorDriverStart(t *testing.T) {
a := newAioTestAdaptor()
d := NewAnalogSensorDriver(a, "1")

// send data
a.TestAdaptorAnalogRead(func() (val int, err error) {
val = 100
return
})

gobottest.Assert(t, d.Start(), nil)

// expect data to be received
Expand All @@ -54,6 +48,12 @@ func TestAnalogSensorDriverStart(t *testing.T) {
sem <- true
})

// send data
a.TestAdaptorAnalogRead(func() (val int, err error) {
val = 100
return
})

select {
case <-sem:
case <-time.After(1 * time.Second):
Expand Down

0 comments on commit ce7b34d

Please sign in to comment.