3596 Commits

Author SHA1 Message Date
sophia
1e39161a7b Ensure candidate ips are available when determining mount name 2022-09-02 10:42:27 -05:00
Chris Roberts
d31f9a59a5 Only patch fake_ftp when running tests
The fake_ftp patches should only be applied when running tests. Since
the library is a development dependency only, it will not be available
for loading from a release.
2022-08-02 10:44:07 -07:00
Sophia Castellarin
14e825b8d0
Merge pull request #12753 from dcermak/bump-fake_ftp
Bump fake_ftp to ~> 0.3.0 & adjust tests
2022-08-01 13:23:00 -05:00
Paul Hinze
1b93691b8a
Merge pull request #12567 from electrofelix/improve-gem-resolving
Improve Gem spec selection when resolving
2022-08-01 12:49:16 -05:00
sophia
df94a36568 Patch fake_ftp for determining the size of files 2022-08-01 11:30:29 -05:00
sophia
9cf8c23f48 Fix push test 2022-07-29 16:15:46 -05:00
Dusty Mabe
3ad20c4c7b guests: add Alma Linux guest support 2022-07-29 09:22:50 -05:00
Dusty Mabe
d82d0fb657 guests: make CentOS/RHEL flavor detection more dynamic
Instead of having to update these flavor.rb files every time a
new version of CentOS/RHEL come out let's dynamically pick up
the version (7,8,9) from the machine.

This was inspired slightly by the Rocky Linux guest flavor.rb.
2022-07-29 09:22:50 -05:00
Dan Čermák
7e9f310dfc Bump fake_ftp to ~> 0.3.0 & adjust tests
Sadly, fake_ftp is unmaintained since 2021, but all other alternatives haven't
been touched for even longer :-/
2022-07-28 14:57:27 -05:00
Dan Čermák
73ee447c87 Stop using the last argument as kwargs in unit tests
A few unit tests started failing with Ruby 3.0, because they were relying on
keyword arguments being converted into hashes automatically. This behavior was
deprecated in Ruby 2.7 and results in errors in Ruby 3.0 onward.

For further details:
https://rubyreferences.github.io/rubychanges/3.0.html#keyword-arguments-are-now-fully-separated-from-positional-arguments
2022-07-28 14:45:47 -05:00
Paul Hinze
a846e55a0e
ci: enable shell provisioner component
This would have caught the issue in https://github.com/hashicorp/vagrant-ruby/pull/319
2022-07-25 10:26:03 -05:00
Paul Hinze
a916cddf68
Re-enable pending test since box_optional works again 2022-07-15 12:14:47 -05:00
Paul Hinze
ee8883153c
Make Docker provider work again post config refactor
- Allow machine.box to be empty without sadness (depends on
   https://github.com/hashicorp/vagrant-plugin-sdk/pull/182)
 - Get synced folder type from plugin name instead of defaulting to
   :virtualbox
2022-07-08 11:36:27 -05:00
sophia
5709027c45 Update mapper tests for not returning HashWithIndifferentAccess 2022-07-01 13:56:50 -05:00
sophia
1913864212 Update remote machine test for fully go backed machine 2022-06-29 16:54:57 -05:00
sophia
0372da5f5f Update mapper tests for hash with indifferent access 2022-06-29 16:43:19 -05:00
sophia
df8f519337 Fix guest and host service tests 2022-06-29 16:01:40 -05:00
Paul Hinze
6f9ea74e0e
Mark box_optional test as temporarily pending 2022-05-26 11:16:45 -05:00
Paul Hinze
10b505cfad
ci: Run docker tests with gogo
They were running with Ruby... whoopsie
2022-05-13 16:41:19 -05:00
sophia
fa561cab29 Fill in mock machine client methods 2022-05-04 09:32:36 -05:00
Paul Hinze
b6feb025ba
Merge pull request #261 from hashicorp/add-docker-to-ci
Add docker to Nightly CI
2022-04-25 17:47:22 -05:00
Paul Hinze
f748c42921
ci: Switch to static gem build names in non-shared dirs
Having multiple different VMs building gems inside a shared dir was
causing them to collide, making the second build always fail.
2022-04-25 14:51:11 -05:00
Paul Hinze
baf1d777bc
ci: Run docker provider too 2022-04-25 14:35:30 -05:00
Paul Hinze
11a4664901
ci: Set up docker to use Go vagrant too 2022-04-25 14:35:30 -05:00
Paul Hinze
f07ba964d3
Prevent autocomplete install test from messing with real homedir
It just so happens my `~/.bashrc` is not writable by my user (NixOS
humblebrag lol) so this test fails for me locally.

Turns out the test was touching the user's homedir which we probably
don't want anyways, so stub out a tempdir instead.
2022-04-25 14:24:06 -05:00
Paul Hinze
4cf5f7c1ba
ci: quiet things down a bit 2022-04-25 12:26:59 -05:00
Paul Hinze
6ace8d5d9d
ci: Switch to a log artifact vs a noisy stdout 2022-04-25 12:26:59 -05:00
Paul Hinze
a6184cf431
ci: Use branch for vagrant-spec 2022-04-25 12:26:59 -05:00
Paul Hinze
9d553412ee
Remove rubygems-bundler to address issues executing vagrant ruby
Executing the `vagrant` in the path was yielding an error:

> Could not locate Gemfile or .bundle/ directory

Traced it back to this gem making every ruby binary into a bundler shim
2022-04-25 12:26:59 -05:00
Paul Hinze
98385bd1c0
ci: Bump ulimits - gogo uses lots of open files :) 2022-04-25 12:26:59 -05:00
Paul Hinze
df3c0b6b0f
ci: install gem and use go binary for test runs 2022-04-25 12:26:59 -05:00
Paul Hinze
60a9528a82
ci: Install Ruby 2.7 and not latest, which is catching 3.x 2022-04-25 12:26:59 -05:00
Paul Hinze
b5c321e769
ci: Just run the basic component we know passes locally for now 2022-04-25 12:26:59 -05:00
Chris Roberts
46efcb8af8
Fix hash usage in mapper test 2022-04-25 12:26:56 -05:00
Paul Hinze
eacb798a71
Fix action hooks running twice in destroy_on_error scenarios
The "destroy_on_error" functionality for `vagrant up` is implemented in
the `recover()` action chain, and works by firing off a destroy action
from inside that chain.

This is all well and good, but it copies its existing `env` which has
had `action_name` set for the up action. This was causing action_hooks
for up actions to attach to this destroy action stack.

Setting the action_name explicitly in the env before firing the runner
should correct the behavior. I'm not sure if raw_action_name is used
anywhere but I figured it was better to be consistent vs conservative in
what we change.
2022-04-25 12:26:56 -05:00
Paul Hinze
b88123fab4
Add unit test for new behavior 2022-04-25 12:26:55 -05:00
Paul Hinze
2707d09181
Fix prepend/append action hooks firing multiple times
This addresses the surprising behavior that the StoreBoxMetadata hook
was running many times during a machine up, including during failed
operations where a destroy_on_error deleted the machine. This was
resulting in an error that looked like:

> No such file or directory @ rb_sysopen [...] /[...]/box_meta

Plugin action hooks using prepend/append were attaching every time a
Builder was run, including sub-Builders that show up for things like
Call actions.

To fix this, we tell Builders if they are "primary" and only run
prepend/append on those. See inline comments for more explanation.
2022-04-25 12:26:55 -05:00
sophia
3e641fbe6b
Stub machine index proto mapper for environment test 2022-04-25 12:26:51 -05:00
Paul Hinze
1341bfe0af
Tweak Ruby->Go error handling so exit codes match
In legacy Vagrant, any exception raised that's a subclass of
Vagrant::Errors::VagrantError is considered user-facing and so causes
the error message to be printed to the console and the process to use
exit code 1. Anything outside of that causes the process to use exit
code 255. (See `bin/vagrant` for the code.)

Here we mirror that behavior by treating errors that have a
LocalizedMessage as user-facing and those without as unexpected. This
allows the basic virtualbox component to pass in vagrant-spec!
2022-04-25 12:26:49 -05:00
Paul Hinze
7c1d2e5368
Use optional fields on Synced Folder instead of empty string checks
Addresses concerns raised in discussion here
https://github.com/hashicorp/vagrant-ruby/pull/219#discussion_r816966056
and makes it so we don't have to change any plugin code to make things
work.

Depends on https://github.com/hashicorp/vagrant-plugin-sdk/pull/133
2022-04-25 12:26:44 -05:00
Paul Hinze
6585cd55af
Add unit tests covering the new rspec helper behavior 2022-04-25 12:26:44 -05:00
Paul Hinze
2906d2c7df
Populate default when synced folder guest type is not set
This helps fix the unit tests that were failing. Also adding a test for
the new behavior
2022-04-25 12:26:44 -05:00
Paul Hinze
06ad1b4565
Fixup tests for Ruby 3.0
This is a pass through test failures and deprecation warnings:

 * Make all ambiguous `.with(..., key: val)` use explicit hashes to
   prevent test failures for argument mismatch in Ruby 3.0
 * Scope down all unbounded `raise_error` to address warnings (remove
   one test that was revealed to be referencing a nonexistent variable
   once the raise_error was scoped.)
 * Update all `any_instance` usage to new syntax to address warnings
 * Allow the service cache to be cleared and do so between some tests
 * Fix a small bug in with_plugin's plugin not found code path (revealed
   by a scoped and_raise)
2022-04-25 12:26:40 -05:00
Paul Hinze
ff86d86ac8
Provisioner Plugins 2022-04-25 12:26:37 -05:00
Paul Hinze
8b6ef27a0f
Fix multiple synced folder handling in server mode
There was a hash assignment that was overriding values when there were
multiple synced folders for a given implementation.

Includes some stub-tastic unit tests to help verify the hash munging
behavior does what it's supposed to do going forward.
2022-04-25 12:26:37 -05:00
Paul Hinze
8730b9f100
Fix MachineState mapper so IsRunning actions work
The IsRunning action checks if `env[:machine].state.id == :running` but
this check was never passing as the protobuf-washed version of machine
state was yielding a machine state w/ a string value like `"running"`.

Easy fix in the mapper!
2022-04-25 12:26:34 -05:00
sophia
ea778c188d
Update ruby tests 2022-04-25 12:26:28 -05:00
sophia
9e7ece840a
Use vagrant-spec from hashicorp org 2022-04-25 12:26:27 -05:00
sophia
0c29065483
Set Vagrant path 2022-04-25 12:26:27 -05:00
sophia
35c1396003
Don't run tests for windows 2022-04-25 12:26:26 -05:00