46 Commits

Author SHA1 Message Date
Chris Roberts
6e13612111 Add test coverage for architecture support 2023-09-14 16:15:03 -07:00
hashicorp-copywrite[bot]
36a312ee26
add missing license headers and update copyright file headers to BUS-1.1 2023-08-10 21:53:25 +01:00
Dan Čermák
be63d8a88f
Mark box_collection_test to require bsdtar
These tests implicitly require bsdtar and should be skipped if the binary is not
available.
2022-11-01 15:25:39 +01:00
Chris Roberts
7d7ad89ac5 Provide helpful error message on invalid version
When a box version (or constraint) is provided with an invalid
format, rescue the error and return a customized error with
information for the user explaining the problem.
2022-09-21 11:21:24 -07:00
Chris Roberts
3d0d0148e9 Update tests to use real UI instance
Replaces use of UI doubles within tests to use actual UI instance
    to ensure calls are passing parameters correctly.
2021-06-23 14:04:48 -07:00
Chris Roberts
e7a6f397da Updates for Ruby 3.0 2021-06-21 15:57:46 -07:00
Brian Cain
6b9cdb4e48
Fixes #10663: Ignore boxes in collection with malformed version numbers
Prior to this commit, if a box some how got on disk that had an
incorrect or invalid version number that did not match Gem::Version,
Vagrant would throw an exception when attempting to generate a list of
the boxes on disk. This commit fixes that by looking at the version from
the path generated, and shows a warning to the user about the box and
skips it from the list so they at least know about the problematic box
and can still get a list of boxes.
2019-02-14 15:30:11 -08:00
Chris Roberts
1a62743bc5 Update rspec to recent version and fix deprecations 2017-08-03 17:54:07 -07:00
Chris Roberts
68be1422f8 Add test coverage for box sorting
Provides test coverage for proper box sorting using BoxCollection#all
and BoxCollection#find.
2017-03-06 08:19:49 -08:00
Seth Vargo
49ce775b53
Prefix tempfiles with vagrant- 2016-05-31 00:18:16 -04:00
Seth Vargo
7014aa3bab
Remove custom tempfile class
This is not actually providing any additional utility and also causes
namespace conflicts with people trying to use the real Tempfile class.
2016-05-30 23:21:47 -04:00
Seth Vargo
fb60d34236
Add unique names to all tmpdir and tempfile calls in tests + cleanup
This commit attempts to uniquely identify the temporary files and
directories that are created during test runs. Where it was a quick
fix, this commit also removes the temporary files and directories.

There are still a ton of temporary files due to calls to
.isolated_environment in the tests without an easy API an easy way
to provide a closer to that function.
2016-05-28 23:22:34 -04:00
Mark Mickan
31ece8324b Add tests for using prerelease box versions 2016-01-20 11:18:27 +10:30
Mitchell Hashimoto
e1f8b0d9c0 more passing tests on Windows 2015-11-20 15:24:51 -08:00
Mitchell Hashimoto
c541767949 core: add tests for box collection cleanup [GH-6002] 2015-11-19 15:59:58 -08:00
Mitchell Hashimoto
15f1823d5c core: box names with colons work on Windows [GH-4100] 2014-08-08 14:47:17 -07:00
Mitchell Hashimoto
27bf597214 Add box collection test for colons 2014-08-08 14:35:05 -07:00
Mitchell Hashimoto
5b360d0990 core: BoxCollection#find version constraint can benil 2014-04-02 19:50:44 -07:00
Fabio Rehm
54656151cf Convert specs to RSpec 2.14.8 syntax with Transpec
This conversion is done by Transpec 1.10.2 with the following command:
    transpec test/unit/

* 507 conversions
    from: obj.should
      to: expect(obj).to

* 394 conversions
    from: == expected
      to: eq(expected)

* 260 conversions
    from: obj.should_receive(:message)
      to: expect(obj).to receive(:message)

* 85 conversions
    from: obj.stub(:message)
      to: allow(obj).to receive(:message)

* 25 conversions
    from: its(:attr) { }
      to: describe '#attr' do subject { super().attr }; it { } end

* 19 conversions
    from: obj.should_not
      to: expect(obj).not_to

* 7 conversions
    from: obj.should_not_receive(:message)
      to: expect(obj).not_to receive(:message)

* 3 conversions
    from: Klass.any_instance.should_receive(:message)
      to: expect_any_instance_of(Klass).to receive(:message)
2014-03-14 12:02:07 -03:00
Mitchell Hashimoto
7926f7f051 core: box URLs can be authenticated by hooking 2014-03-01 11:38:04 +01:00
Mitchell Hashimoto
bd9f375263 core: Box can store a metadata URL 2014-02-05 21:20:07 -08:00
Mitchell Hashimoto
b2fa785d07 core: Environment loads proper version of box 2014-02-05 21:19:51 -08:00
Mitchell Hashimoto
15aa91b073 core: can add/search boxes with slashes in name 2014-02-05 21:19:17 -08:00
Mitchell Hashimoto
16ced8d36c core: boxcollection test tests versions 2014-02-05 21:19:11 -08:00
Mitchell Hashimoto
87a85488d1 core: all box collection tests pass 2014-02-05 21:19:09 -08:00
Mitchell Hashimoto
4c1fa7359d core: BoxCollection can find with version constraints 2014-02-05 21:19:07 -08:00
Mitchell Hashimoto
77b5fa94b7 core: BoxCollection#all returns versions 2014-02-05 21:19:06 -08:00
Mitchell Hashimoto
b52d33e0af core: upgrade to v1.5 box dir format if it can 2014-02-05 21:19:04 -08:00
Mitchell Hashimoto
7c25a23352 core: get tests passing cleanly on Ruby 2.0.0 2013-11-30 16:21:19 -08:00
Mitchell Hashimoto
dea881cad2 vagrant box add --force works again [GH-1413] 2013-03-13 21:20:25 -07:00
Mitchell Hashimoto
3399b74163 Fix invalid box test by not relying on Archive;:Tar::Minitar 2013-01-29 11:10:44 -08:00
Andy Williams
8a8b771e0a Add test for invalid box file
Filled in pending test. It creates a valid tar file, over-writes the
checksum field in the tar's header and then checks that the
BoxUnpackageFailure exception is thrown.
2013-01-20 14:28:48 -05:00
Mitchell Hashimoto
0ec639c8e1 BoxCollection#find should only find V1 box when searching for vbox 2012-12-23 16:29:23 -08:00
Mitchell Hashimoto
5002b8d9c2 Fix failing test on 1.8.7 2012-12-20 22:05:05 -08:00
skim
bad38ca935 fixes an exception issue when a non-directory appears in the boxes dir 2012-09-25 21:13:38 -05:00
Mitchell Hashimoto
798ffc93bd BoxCollection#add throws an UpgradeRequired exception if a V1 box
already exists
2012-07-11 18:36:22 -07:00
Mitchell Hashimoto
1d197d84c3 BoxCollection#add transparently upgrades V1 boxes to V2
This means that V1 boxes can be added to a V2 box collection without
issue.
2012-07-11 18:36:22 -07:00
Mitchell Hashimoto
7595f0078e BoxCollection#add provider argument is optional
In the case that not provider is given then whatever provider the box
represents will be added to the system. Ideally, a provider will be
given, but if not, Vagrant still does a "best effort" to install the
box.
2012-07-11 18:36:22 -07:00
Mitchell Hashimoto
da15105a8f Make Box2 the new Box
This involved defaulting all box searching at the moment to VirtualBox.
Additionally, box upgrading is not yet handled. This needs to be done at
some point.
2012-07-11 18:36:21 -07:00
Mitchell Hashimoto
42826356ad Basic "Box2" implementation.
This is the beginning of the new box internals. The basic idea is that
the new box has a new field: provider. The provider will describe what
provider that box was built with and what provider it is made to work
with.
2012-07-11 18:36:20 -07:00
Mitchell Hashimoto
5c6ca57409 Throw an error if a box already exists when calling box.add 2011-12-10 13:09:03 -08:00
Mitchell Hashimoto
d92f3d8c6d Box add works again with new env stuff 2011-12-09 17:33:30 -08:00
Mitchell Hashimoto
daf711fd80 Separate Vagrant::Action into Runner and Registry 2011-12-09 14:22:03 -08:00
Mitchell Hashimoto
8801bc7b1b Starting to revamp BoxCollection to not depend on env 2011-12-04 11:39:44 -08:00
Mitchell Hashimoto
fe442faefa Move unit tests into the unit_legacy folder 2011-12-03 15:44:08 -08:00
Mitchell Hashimoto
ce5d989384 Moving unit tests to test/unit 2011-08-28 23:10:32 -07:00