Commit Graph

14 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
15b110da49 Reduce patching for distro default session use (#1424)
Reduce the patching needed should a distro wish to switch the default
from using the system connection by default to using a session
connection by default.

Should now only require patching the default value and a single test
checking the defaults.
2021-12-11 14:58:59 +00:00
Darragh Bailey
1f9fd6dc2e Ensure domain removal/halt limited to provider error (#1420)
Switch to dedicated actions to trigger destroy/halt via the recovery
mechanism if the VM bring up has failed to complete the bring up of the
machine.

Fixes: #1328
2021-12-04 16:55:50 +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
0b53be59cf Regression unit test for frozen string literal fix (#1393)
Add a unit test for the prepare nfs settings action to act as a
regression test for the recent fix to avoiding modifying a frozen string
literal.

As part of this fix how the communicator is returned via a call to a
machine for testing purposes and remove an obsolete expect from the
wait till up tests as the code that would result in the communicator
being called has been removed.

Ensure that nfsd is not required to run the tests by mocking out the
host capability check.
2021-11-04 10:55:51 +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
1fe5a80516 Ensure state is correct reflected in global-status (#1292)
Vagrant relies on the side effect of checking the machine state to
trigger updating of the state in the global machine index. As a
consequence any action should not inspect the domain state directly and
instead should access the machine state.

Additionally as part of the up/start actions should switch to built-in
WaitForCommunicator which will inspect the machine states by default to
align with the expected state updating side effects that would be in
effect for any internal provider shipped with vagrant.

Closes: #948
Partial-Fix: #193
2021-05-20 13:36:23 +01:00
Darragh Bailey
1c82be1357 Raise expected Timeout to ensure retryable retries (#1241)
With the refactor to where the domain addresses are looked up, a log
message was added in case of timeout, however it was missed that when
this occurs still need to raise the exception to ensure that checks for
this timeout can occur within the original calling function.

Update tests to ensure that the code will retry the expected number of
times before triggering the expected failure message and aborting the
machine bring up.

Additionally to allow running the wait_till_up_spec.rb separately,
needed to ensure the plugin.rb which is loaded by the code pulls in the
action.rb to ensure `Action.remove_libvirt_image` can be correctly
resolved when the rest of the test suite is not running.

Fixes: #1239
2021-04-03 14:57:31 +01:00
Darragh Bailey
c8c590f586 Consolidate ip address retreival to single method (#1199)
Refactor WaitTillUp action to make use of the domain IP address
retrieval code in the driver to ensure a single place to maintain.

Remove references to machine option for driver where already should be
available as an instance variable.
2021-03-13 19:55:17 +00: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
dima
c1898be3d6 rubocop 2016-12-06 23:20:29 +01: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
c5c15361da Use unit name instead of library to describe tests
To distinguish between future addition of acceptance tests, rename the
existing to tests to match their type as 'unit' tests in line with
other uses of vagrant-spec.
2016-02-26 11:33:05 +00:00