mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-04-26 13:48:49 +08:00
aio: avoid race condition on starting test
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
2fe46b2017
commit
1cf59fd2c0
@ -40,8 +40,6 @@ func TestAnalogSensorDriverStart(t *testing.T) {
|
||||
a := newAioTestAdaptor()
|
||||
d := NewAnalogSensorDriver(a, "1")
|
||||
|
||||
gobottest.Assert(t, d.Start(), nil)
|
||||
|
||||
// expect data to be received
|
||||
d.Once(d.Event(Data), func(data interface{}) {
|
||||
gobottest.Assert(t, data.(int), 100)
|
||||
@ -54,6 +52,8 @@ func TestAnalogSensorDriverStart(t *testing.T) {
|
||||
return
|
||||
})
|
||||
|
||||
gobottest.Assert(t, d.Start(), nil)
|
||||
|
||||
select {
|
||||
case <-sem:
|
||||
case <-time.After(1 * time.Second):
|
||||
|
Loading…
x
Reference in New Issue
Block a user