class DriverSpecs
- DriverSpecs
- Reference
- Object
Overview
A place driver has 4 typical points of IO contact
- Place driver protocol (placeos-core's point of contact)
- The modules transport layer (module to device comms)
- An optional HTTP client
- Redis for state storage and subscriptions
Defined in:
placeos-driver/driver-specs/mock_driver.crplaceos-driver/driver-specs/mock_http.cr
placeos-driver/driver-specs/responder.cr
placeos-driver/driver-specs/runner.cr
placeos-driver/driver-specs/status_helper.cr
Constant Summary
-
DRIVER_ID =
"spec_runner"
-
SYSTEM_ID =
"spec_runner_system"
Class Method Summary
Instance Method Summary
-
#exec(function, *args, user_id = nil)
executes a function on the driver being tested and returns response promise
-
#exec(function, user_id = nil, **args)
executes a function on the driver being tested and returns response promise
-
#exec(function, *args, user_id = nil, &)
executes a function on the driver being tested and returns response promise
-
#exec(function, user_id = nil, **args, &)
executes a function on the driver being tested and returns response promise
-
#expect_http_request(timeout = 1.seconds, &)
provides a method for accepting and responding to HTTP requests being made by the driver
-
#expect_reconnect(timeout = 5.seconds) : TCPSocket
A particular response might disconnect the socket Then we want to wait for the reconnect to occur before continuing the spec
-
#expect_send(timeout = 500.milliseconds) : Bytes
obtain some data you were expecting to receive from the driver.
-
#publish(channel, message)
publish an event for the driver to process
-
#responds(data)
transmits some data to the driver, typically a response to something the driver has sent
-
#settings(new_settings)
allows you to provide alternative settings to the driver being tested.
-
#should_send(data, timeout = 500.milliseconds)
expects the data provided to be sent
-
#status : DriverSpecs::StatusHelper
provides access to the drivers status state.
-
#system(module_id : String | Symbol)
Grab a Mock driver instance that has been defined by updating the system
-
#system(details)
provides a new system definition for testing Logic Modules
-
#transmit(data, pause = 100.milliseconds)
transmits some data to the driver, typically a response to something the driver has sent
Class Method Detail
Instance Method Detail
executes a function on the driver being tested and returns response promise
i.e. response = exec(:method_on_driver, arg1, arg2)
then to process the response response.get.should eq "method response"
executes a function on the driver being tested and returns response promise
i.e. response = exec(:method_on_driver, arg1, arg2)
then to process the response response.get.should eq "method response"
executes a function on the driver being tested and returns response promise
i.e. response = exec(:method_on_driver, arg1, arg2)
then to process the response response.get.should eq "method response"
executes a function on the driver being tested and returns response promise
i.e. response = exec(:method_on_driver, arg1, arg2)
then to process the response response.get.should eq "method response"
provides a method for accepting and responding to HTTP requests being made by the driver
for an example of how this works see an existing driver
A particular response might disconnect the socket Then we want to wait for the reconnect to occur before continuing the spec
obtain some data you were expecting to receive from the driver. Typically triggered by an exec you've made.
expect_send.should eq "some data"
transmits some data to the driver, typically a response to something the driver has sent
transmit "\nsome response"
allows you to provide alternative settings to the driver being tested.
by default the drivers default_settings
are used
expects the data provided to be sent
should_send "some data"
provides access to the drivers status state.
status[:volume].should eq(50)
Grab a Mock driver instance that has been defined by updating the system
For example a system may look like: {Display: {MockDisplay, MockDisplay}}
We can obtain mock display 2 by calling mock_display = system(:Display_2)
Then we can check status on it mock_display[:power]?.should eq true
provides a new system definition for testing Logic Modules
expects {ModuleName: {Klass, Klass}}
see an example of it in use
transmits some data to the driver, typically a response to something the driver has sent
transmit "\nsome response"