3578 Commits

Author SHA1 Message Date
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
sophia
9b35ab6ed6
Run docker tests 2022-04-25 12:26:26 -05:00
sophia
2cc32e9256
Extract ubuntu steps for getting Vagrant ready for testing 2022-04-25 12:26:26 -05:00
sophia
49ea304ba3
Update centos test setup 2022-04-25 12:26:26 -05:00
sophia
17ff196305
Add ci test for spectesting 2022-04-25 12:26:26 -05:00
sophia
cba6b76a26
Run vagrant-spec tests 2022-04-25 12:26:26 -05:00
sophia
0e29cf9900
Setup vagrant-spec 2022-04-25 12:26:26 -05:00
sophia
b28379bec3
Setup Vagrant for running spec tests within vm 2022-04-25 12:26:26 -05:00
Paul Hinze
a86965c340
ruby mappers: Unwrap wrapper types in Hashes and Arrays
Boolean types (and possibly a few others) are returned as wrapper
classes when coming out from proto mapping; these need to be unwrapped
otherwise the caller who is expecting a nice clean boolean value ends up
with an icky protobuf class.

This fixes the shell provisioner, which relies on a communicator
receiving a settings hash `{error_check: false}` for a command that
usually fails but it sent just in case before provisioning starts.
2022-04-25 12:26:23 -05:00
Paul Hinze
a841da4fc6
Add a simple push plugin in Go
The only tweak required to get this to work was allowing a DummyConfig
to survive being passed through a remote plugin on the Ruby side.
2022-04-25 12:26:21 -05:00
sophia
53f7b3f8eb
Update tests for GRPC errors 2022-04-25 12:26:20 -05:00
Paul Hinze
142b1af0cc
Fix local exec pushes in server mode
The local-exec push strategy was assuming it was running from a CLI and
so it wouldn't be a big deal for it to straight up `exec` and replace
its running with the user command. That command will just do its thing
and we want the exit code for the CLI command to match anyways, right?

Sure that works for a shell, but in a GRPC server setting it's decidedly
Not Cool to suddenly swap out the running process!

As you can imagine - the effect of doing this was all sorts of broken
pipes and unexpected EOFs and a very confused @phinze.

Luckily we had a subprocess strategy sitting right there for Windows
compat, so it was just a matter of switching to that in the server
context as well. Long and winding debugging process; simple fix;
just another classic!
2022-04-25 12:26:17 -05:00
Chris Roberts
820118b481
Prevent GRPC connection in tests 2022-04-25 12:26:16 -05:00
Chris Roberts
59144f74d3
Stub out mapper response to return machine 2022-04-25 12:26:01 -05:00
sophia
c6070c69db
Rename cap command 'target' to 'target-guest'
the target name is already used by the go cli
2022-04-25 12:24:49 -05:00
sophia
b1f495315e
Fix tests 2022-04-25 12:24:49 -05:00
sophia
ca824644a5
Add tests for host service 2022-04-25 12:24:41 -05:00
sophia
434e613856
Test has capability 2022-04-25 12:24:39 -05:00