Skip to content

Commit

Permalink
test: remove sleeps
Browse files Browse the repository at this point in the history
  • Loading branch information
caspiano committed Aug 3, 2021
1 parent 81b99e7 commit 3a3e4d9
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 28 deletions.
2 changes: 0 additions & 2 deletions drivers/cisco/meraki/meraki_locations_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ DriverSpecs.mock_driver "Cisco::Meraki::Locations" do
Dashboard: {DashboardMock},
})

sleep 0.5

# Should standardise the format of MAC addresses
exec(:format_mac, "0x12:34:A6-789B").get.should eq %(1234a6789b)

Expand Down
5 changes: 0 additions & 5 deletions drivers/cisco/switch/snooping_catalyst_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ require "placeos-driver/spec"

DriverSpecs.mock_driver "Cisco::Switch::SnoopingCatalyst" do
transmit "SG-MARWFA61301>"
sleep 1.5.seconds

should_send "show interfaces status\n"
transmit "show interfaces status\n"
Expand Down Expand Up @@ -30,8 +29,6 @@ Te4/1/4 connected trunk full 10G SFP-10GBase-S
Po1 connected trunk a-full a-10G
)

sleep 3.1.seconds

should_send "show mac address-table\n"
transmit "show mac address-table\n"

Expand All @@ -40,8 +37,6 @@ Po1 connected trunk a-full a-10G
10 f4db.e618.10a4 DYNAMIC Te2/0/40
)

sleep 3.1.seconds

should_send "show ip dhcp snooping binding\n"
transmit %(MacAddress IpAddress Lease(sec) Type VLAN Interface
------------------ --------------- ---------- ------------- ---- --------------------
Expand Down
8 changes: 4 additions & 4 deletions drivers/denon/amplifier/av_receiver_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ DriverSpecs.mock_driver "Denon::Amplifier::AvReceiver" do
####
# POWER
#
sleep 1.second

# query power
exec(:power?)
should_send("PW?")
Expand All @@ -24,7 +24,7 @@ DriverSpecs.mock_driver "Denon::Amplifier::AvReceiver" do
####
# INPUT
#
sleep 1.second

# query input > DVD
exec(:input?)
should_send("SI?")
Expand All @@ -39,7 +39,7 @@ DriverSpecs.mock_driver "Denon::Amplifier::AvReceiver" do
####
# VOLUME
#
sleep 1.second

# query
exec(:volume?)
should_send("MV?")
Expand All @@ -54,7 +54,7 @@ DriverSpecs.mock_driver "Denon::Amplifier::AvReceiver" do
####
# MUTE
#
sleep 1.second

# query
exec(:mute?)
should_send("MU?")
Expand Down
6 changes: 3 additions & 3 deletions drivers/exterity/avedia_player/r92xx_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ DriverSpecs.mock_driver "Exterity::AvediaPlayer::R92xx" do

status[:ready].should eq(false)
responds("Exterity Control Interface\r")
sleep(2)

status[:ready].should eq(true)

exec(:version)
responds("^SoftwareVersion:123!\r")
sleep(2)

status[:version].should eq("123")

exec(:tv_info)
responds("^tv_info:a,b,c,d,e,f,g!\r")
sleep(2)

status[:tv_info].should eq("a,b,c,d,e,f,g")
end
6 changes: 3 additions & 3 deletions drivers/exterity/avedia_player/r93xx_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ DriverSpecs.mock_driver "Exterity::AvediaPlayer::R92xx" do
# this lets the driver know it's successfully connected
status[:ready].should eq(false)
responds("Terminal Control Interface\r")
sleep(2)

status[:ready].should eq(true)

exec(:version)
responds("^SoftwareVersion:123!\r")
sleep(2)

status[:version].should eq("123")

exec(:tv_info)
responds("^tv_info:a,b,c,d,e,f,g!\r")
sleep(2)

status[:tv_info].should eq("a,b,c,d,e,f,g")
end
2 changes: 0 additions & 2 deletions drivers/global_cache/gc_100_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ DriverSpecs.mock_driver "GlobalCache::Gc100" do
responds("endlistdevices\r")
should_send("get_NET,0:1\r")

sleep 1

status[:relay_config].should eq({
"relay" => {"0" => "2:1", "1" => "2:2", "2" => "2:3"},
"relaysensor" => {"0" => "1:1", "1" => "1:2", "2" => "1:3", "3" => "1:4"},
Expand Down
4 changes: 2 additions & 2 deletions drivers/panasonic/display/protocol2_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ DriverSpecs.mock_driver "Panasonic::Display::Protocol2" do
responds("NTCONTROL 1 09b075be\r")
should_send("#{password}00PON\r")
responds("00PON\r")
sleep 8.seconds

expect_reconnect
responds("NTCONTROL 1 09b075be\r")
should_send("#{password}00QPW\r")
Expand Down Expand Up @@ -66,7 +66,7 @@ DriverSpecs.mock_driver "Panasonic::Display::Protocol2" do
responds("NTCONTROL 1 09b075be\r")
should_send("#{password}00POF\r")
responds("00POF\r")
sleep 8.seconds

expect_reconnect
responds("NTCONTROL 1 09b075be\r")
should_send("#{password}00QPW\r")
Expand Down
1 change: 0 additions & 1 deletion drivers/place/mqtt_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ DriverSpecs.mock_driver "Place::MQTT" do
publish.packet_length = publish.calculate_length

transmit publish.to_slice
sleep 0.1 # wait a bit for processing
status["root/topic"].should eq("testing")

# ============================
Expand Down
3 changes: 1 addition & 2 deletions drivers/screen_technics/connect_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ DriverSpecs.mock_driver "ScreenTechnics::Connect" do
# * stop command
# * down command
# * status request
sleep 1.second

should_send("36, 19\r\n", timeout: 1.second)
responds("136, 1, 19\r\n")

Expand All @@ -41,7 +41,6 @@ DriverSpecs.mock_driver "ScreenTechnics::Connect" do
# Execute the emergency stop and request another down request
exec(:stop, index: 2, emergency: true) do |response|
exec(:move, "Down", 2)
sleep 500.milliseconds

# --> respond to the down command
responds("133, 1, 19, 1\r\n")
Expand Down
3 changes: 1 addition & 2 deletions drivers/sharp/pn_series_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ DriverSpecs.mock_driver "Sharp::PnSeries" do
})

# Retrying send_credentials
sleep 5
should_send("user\x0D\x0A")
responds("OK\x0D\x0A")
should_send("pass\x0D\x0A")
Expand Down Expand Up @@ -43,7 +42,7 @@ DriverSpecs.mock_driver "Sharp::PnSeries" do
should_send("INPS0010\x0D\x0A")
responds("WAIT\x0D\x0A")
responds("OK\x0D\x0A")
sleep 2

should_send("INPS????\x0D\x0A")
responds("INPS 10\x0D\x0A")
status[:input].should eq("HDMI")
Expand Down
5 changes: 3 additions & 2 deletions drivers/sony/projector/serial_control_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DriverSpecs.mock_driver "Sony::Projector::SerialControl" do
responds("\xA9\x00\x00\x03\x00\x00\x03\x9A")
should_send("\xA9\x17\x2E\x00\x00\x00\x3F\x9A")
responds("\xA9\x00\x00\x03\x00\x00\x03\x9A")
sleep 3

# power?
should_send("\xA9\x01\x02\x01\x00\x00\x03\x9A")
responds("\xA9\x01\x02\x02\x00\x03\x03\x9A")
Expand All @@ -17,6 +17,7 @@ DriverSpecs.mock_driver "Sony::Projector::SerialControl" do
exec(:switch_to, "hdmi")
should_send("\xA9\x00\x01\x00\x00\x03\x03\x9A")
responds("\xA9\x00\x00\x03\x00\x00\x03\x9A")

# input?
should_send("\xA9\x00\x01\x01\x00\x00\x01\x9A")
responds("\xA9\x00\x01\x02\x00\x03\x03\x9A")
Expand All @@ -38,7 +39,7 @@ DriverSpecs.mock_driver "Sony::Projector::SerialControl" do
exec(:power, false)
should_send("\xA9\x17\x2F\x00\x00\x00\x3F\x9A")
responds("\xA9\x00\x00\x03\x00\x00\x03\x9A")
sleep 3

# power?
should_send("\xA9\x01\x02\x01\x00\x00\x03\x9A")
responds("\xA9\x01\x02\x02\x00\x04\x07\x9A")
Expand Down

0 comments on commit 3a3e4d9

Please sign in to comment.