Commit Graph

11 Commits

Author SHA1 Message Date
Darragh Bailey
e4122f480a Use instance doubles for driver where possible (#1491)
Switch to instance doubles for driver where possible and reduce usage of
allow_any_instance_of.

Additionally replace some incorrect allows with expects to validate
calls are not made.
2022-05-06 19:30:55 +00:00
Darragh Bailey
27a541bba9 Validate partial mocks (#1417)
Switch to using explicit references to objects to be partially mocked
and remove the need to resolve the string constants as this will catch
more instances of calls to invalid or missing methods.

Rework how the vm is added to the machine for one of the tests as it is
not a method and instead is provided via internal state being exposed
with a helper.
2021-12-03 11:28:21 +00:00
Darragh Bailey
df55c78010 Reorder qemu agent usage for use with sessions (#1396)
Adjust the order of checks around use of qemu sessions to allow use of
the agent as a priority when enabled, which should remove the need to
retrieve the address from the system connection when enabled.

Additionally adjust the call to the agent to ensure it uses the default
connection to retrieve the correct domain, rather than forcing the
system connection, which will fail to find the domain if it was created
via a user session.

Add tests that validate most of this behaviour, as well as resulting in
some minor fixes around downcasing the mac address for comparisons, and
also using instance mocks with rspec instead of pure doubles to help
catch false positives where mocks are allowing calls that done exist.

Related: #1342
2021-11-08 11:31:04 +00:00
Darragh Bailey
18ebb9d9ed Enable frozen string across project (#1319)
Turn on frozen string support in all files by using a comment to avoid
enabling across dependencies where it may not work.

Fixes: #1177
2021-06-30 13:27:03 +01:00
Darragh Bailey
21f7a796ff Reduce start domain unnecessary domain redefines (#1178)
Various checks in the start domain action were accidentally causing a
redefine right after initial create. Update to provide debug output when
the domain needs to be changed to allow capture of the redefines
occurring in the future and to make it easy for the tests to pick up
where the redefine was triggered by setting an expectation on the log
output.

Include a small fix to avoid running strip on what might be a nil object
returned for elements without any text attributes.

Fix a bug where changes to tpm settings made to the config after an
initial domain creation where there was previously no tpm defined, would
be ignored.

Adds a logger double and updates other tests that trigger log calls.

should fix #1176
2020-12-05 15:24:42 +00:00
Darragh Bailey
74c381a30d Update test syntax to remove stubs (#1138)
Use of stubs are deprecated, switch to the newer expect/allow syntax.
2020-08-16 16:06:05 +01:00
dima
c1898be3d6 rubocop 2016-12-06 23:20:29 +01:00
Darragh Bailey
81a35c9f14 Spec test for domain template to verify rendering
Add basic spec tests for the domain template to test rendering through
simple wrapping of a config object to provide values for class instance
variables used by the template as it mostly mirrors those required.
2016-11-25 15:59:44 +00:00
Darragh Bailey
e21465771d Add additional debug info for mac searching
Reporting the MAC address being looked for in the ARP table should help
determine why some machines pick up an address belonging to another
when starting multiple VM's in parallel.
2016-02-26 11:33:05 +00:00
Darragh Bailey
c5266a4a25 Use domain double instead of machine 2016-02-26 11:33:05 +00:00
Darragh Bailey
afb53addb1 Add rudimentary spec test to WaitTillUp using vagrant-spec
Add some basic spec tests for the WaitTillUp action class to lay some
foundations. Utilize vagrant-spec pinned to a known working commit for
tests to pass consistently until they provide releases.

Requires updating some of the rspec libraries and includes
sharedcontext.rb from the jantman/vagrant-r10k project on github.
2016-01-27 18:21:25 +00:00