vagrant-skytap 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/vagrant-skytap/action/add_vm_to_environment.rb +4 -4
- data/lib/vagrant-skytap/action/compose_environment.rb +131 -0
- data/lib/vagrant-skytap/action/create_environment.rb +3 -1
- data/lib/vagrant-skytap/action/initialize_api_client.rb +6 -5
- data/lib/vagrant-skytap/action/set_up_vm.rb +3 -1
- data/lib/vagrant-skytap/action/store_extra_data.rb +4 -2
- data/lib/vagrant-skytap/action.rb +4 -17
- data/lib/vagrant-skytap/api/environment.rb +53 -25
- data/lib/vagrant-skytap/api/vm.rb +9 -3
- data/lib/vagrant-skytap/command/up.rb +46 -30
- data/lib/vagrant-skytap/errors.rb +4 -0
- data/lib/vagrant-skytap/version.rb +1 -1
- data/locales/en.yml +5 -1
- data/spec/unit/actions/compose_environment_spec.rb +101 -0
- data/spec/unit/environment_spec.rb +26 -45
- data/spec/unit/support/shared/skytap_context.rb +5 -0
- data/vagrant-skytap.gemspec +3 -3
- metadata +9 -311
- data/.byebug_history +0 -256
- data/.project +0 -11
- data/_patches-20160112/0 +0 -388
- data/_patches-20160112/1 +0 -82
- data/_patches-20160112/2 +0 -239
- data/_patches-20160112/COMPLETED-ABOVE-THIS-LINE +0 -4
- data/_patches-20160112/COMPLETED-BELOW-THIS-LINE +0 -4
- data/_patches-20160112/CR-ABOVE-THIS-LINE +0 -4
- data/_patches-20160112/CR-BELOW-THIS-LINE +0 -4
- data/_patches-20160112/WIP-ABOVE-THIS-LINE +0 -4
- data/_patches-20160112/WIP-BELOW-THIS-LINE +0 -4
- data/_patches-20160112/acceptance-test-runner +0 -29
- data/_patches-20160112/ansible-1 +0 -92
- data/_patches-20160112/cache-api-client-in-up +0 -40
- data/_patches-20160112/dead-code-in-actions +0 -44
- data/_patches-20160112/debug-changes +0 -42
- data/_patches-20160112/demo-rails-app +0 -1276
- data/_patches-20160112/eng-10166-halt-spec +0 -40
- data/_patches-20160112/eng-10256 +0 -527
- data/_patches-20160112/eng-10256-2 +0 -162
- data/_patches-20160112/eng-10256-ubuntu-testing +0 -88
- data/_patches-20160112/eng-10269-test-stuff +0 -87
- data/_patches-20160112/eng-10269-wtf +0 -119
- data/_patches-20160112/eng-10369 +0 -143
- data/_patches-20160112/eng-10369-tmp +0 -60
- data/_patches-20160112/eng-10919 +0 -56
- data/_patches-20160112/eng-11177-fix-actions-requires +0 -44
- data/_patches-20160112/eng-11442 +0 -4
- data/_patches-20160112/eng-11616 +0 -403
- data/_patches-20160112/eng-11616-2 +0 -67
- data/_patches-20160112/eng-11616-actual +0 -184
- data/_patches-20160112/eng-11625a +0 -4
- data/_patches-20160112/eng-11711 +0 -85
- data/_patches-20160112/eng-12232-command-spec +0 -236
- data/_patches-20160112/eng-12235 +0 -83
- data/_patches-20160112/eng-12235-override-refactor +0 -140
- data/_patches-20160112/eng-12240 +0 -103
- data/_patches-20160112/eng-12249 +0 -40
- data/_patches-20160112/eng-12301 +0 -50
- data/_patches-20160112/eng-12843 +0 -95
- data/_patches-20160112/env-source +0 -112
- data/_patches-20160112/frickin-vagrant-spec +0 -163
- data/_patches-20160112/gem-pre-version +0 -14
- data/_patches-20160112/gems-old +0 -9
- data/_patches-20160112/googles-specs +0 -713
- data/_patches-20160112/local-configs-ignore +0 -61
- data/_patches-20160112/misc +0 -79
- data/_patches-20160112/network-unreachable +0 -31
- data/_patches-20160112/new-boxfile +0 -288
- data/_patches-20160112/parallelization-maybe +0 -198
- data/_patches-20160112/read-state +0 -23
- data/_patches-20160112/refactor-to-use-public_address-cap +0 -25
- data/_patches-20160112/series +0 -60
- data/_patches-20160112/status +0 -12
- data/_patches-20160112/test-move-env-data +0 -231
- data/_patches-20160112/test-vagrantfile-vm1 +0 -167
- data/_patches-20160112/the_version_in_0.1.13.pre1 +0 -598
- data/_patches-20160112/vagrant-spec-mock-api +0 -137
- data/_patches-20160112/vagrant-vmware-plugin +0 -233
- data/_patches-20160112/vagrantfile +0 -403
- data/_patches-20160112/vagrantfile-for-acceptance-tests +0 -29
- data/_patches-20160112/vagrantfile-for-nick +0 -95
- data/_patches-20160112/vagrantfiles-to-forget-what-they-are-for +0 -134
- data/_patches-20160112/vm-vanished +0 -42
- data/_patches-20160112a/01 +0 -148
- data/_patches-20160112a/2 +0 -239
- data/_patches-20160112a/COMPLETED-ABOVE-THIS-LINE +0 -4
- data/_patches-20160112a/COMPLETED-BELOW-THIS-LINE +0 -4
- data/_patches-20160112a/CR-ABOVE-THIS-LINE +0 -4
- data/_patches-20160112a/CR-BELOW-THIS-LINE +0 -4
- data/_patches-20160112a/WIP-ABOVE-THIS-LINE +0 -4
- data/_patches-20160112a/WIP-BELOW-THIS-LINE +0 -4
- data/_patches-20160112a/acceptance-test-runner +0 -29
- data/_patches-20160112a/ansible-1 +0 -92
- data/_patches-20160112a/cache-api-client-in-up +0 -40
- data/_patches-20160112a/dead-code-in-actions +0 -44
- data/_patches-20160112a/debug-changes +0 -42
- data/_patches-20160112a/demo-rails-app +0 -1276
- data/_patches-20160112a/eng-10166-halt-spec +0 -40
- data/_patches-20160112a/eng-10256-ubuntu-testing +0 -88
- data/_patches-20160112a/eng-10269-test-stuff +0 -87
- data/_patches-20160112a/eng-10269-wtf +0 -119
- data/_patches-20160112a/eng-10369 +0 -143
- data/_patches-20160112a/eng-10369-tmp +0 -60
- data/_patches-20160112a/eng-10919 +0 -56
- data/_patches-20160112a/eng-11177-fix-actions-requires +0 -44
- data/_patches-20160112a/eng-11442 +0 -4
- data/_patches-20160112a/eng-11616 +0 -403
- data/_patches-20160112a/eng-11616-2 +0 -67
- data/_patches-20160112a/eng-11616-actual +0 -184
- data/_patches-20160112a/eng-11625a +0 -4
- data/_patches-20160112a/eng-11711 +0 -85
- data/_patches-20160112a/eng-12232-command-spec +0 -236
- data/_patches-20160112a/eng-12235 +0 -83
- data/_patches-20160112a/eng-12235-override-refactor +0 -140
- data/_patches-20160112a/eng-12240 +0 -103
- data/_patches-20160112a/eng-12249 +0 -40
- data/_patches-20160112a/eng-12301 +0 -50
- data/_patches-20160112a/eng-12843 +0 -95
- data/_patches-20160112a/env-source +0 -112
- data/_patches-20160112a/frickin-vagrant-spec +0 -163
- data/_patches-20160112a/gem-pre-version +0 -14
- data/_patches-20160112a/gems-old +0 -9
- data/_patches-20160112a/googles-specs +0 -713
- data/_patches-20160112a/local-configs-ignore +0 -61
- data/_patches-20160112a/misc +0 -79
- data/_patches-20160112a/network-unreachable +0 -31
- data/_patches-20160112a/new-boxfile +0 -288
- data/_patches-20160112a/parallelization-maybe +0 -198
- data/_patches-20160112a/read-state +0 -23
- data/_patches-20160112a/refactor-to-use-public_address-cap +0 -25
- data/_patches-20160112a/series +0 -58
- data/_patches-20160112a/status +0 -14
- data/_patches-20160112a/test-move-env-data +0 -231
- data/_patches-20160112a/test-vagrantfile-vm1 +0 -167
- data/_patches-20160112a/the_version_in_0.1.13.pre1 +0 -612
- data/_patches-20160112a/then-copy-the-newer-files +0 -632
- data/_patches-20160112a/vagrant-spec-mock-api +0 -137
- data/_patches-20160112a/vagrant-vmware-plugin +0 -233
- data/_patches-20160112a/vagrantfile +0 -403
- data/_patches-20160112a/vagrantfile-for-acceptance-tests +0 -29
- data/_patches-20160112a/vagrantfile-for-nick +0 -95
- data/_patches-20160112a/vagrantfiles-to-forget-what-they-are-for +0 -134
- data/_patches-20160112a/vm-vanished +0 -42
- data/_patches-20160113/COMPLETED-ABOVE-THIS-LINE +0 -4
- data/_patches-20160113/COMPLETED-BELOW-THIS-LINE +0 -4
- data/_patches-20160113/CR-ABOVE-THIS-LINE +0 -4
- data/_patches-20160113/CR-BELOW-THIS-LINE +0 -4
- data/_patches-20160113/WIP-ABOVE-THIS-LINE +0 -4
- data/_patches-20160113/WIP-BELOW-THIS-LINE +0 -4
- data/_patches-20160113/acceptance-test-runner +0 -29
- data/_patches-20160113/ansible-1 +0 -92
- data/_patches-20160113/cache-api-client-in-up +0 -40
- data/_patches-20160113/dead-code-in-actions +0 -44
- data/_patches-20160113/debug-changes +0 -55
- data/_patches-20160113/demo-rails-app +0 -1276
- data/_patches-20160113/eng-10166-halt-spec +0 -40
- data/_patches-20160113/eng-10256 +0 -543
- data/_patches-20160113/eng-10256-ubuntu-testing +0 -88
- data/_patches-20160113/eng-10269-test-stuff +0 -87
- data/_patches-20160113/eng-10269-wtf +0 -119
- data/_patches-20160113/eng-10369 +0 -143
- data/_patches-20160113/eng-10369-tmp +0 -60
- data/_patches-20160113/eng-10919 +0 -56
- data/_patches-20160113/eng-11177-fix-actions-requires +0 -44
- data/_patches-20160113/eng-11442 +0 -4
- data/_patches-20160113/eng-11616 +0 -403
- data/_patches-20160113/eng-11616-2 +0 -67
- data/_patches-20160113/eng-11616-actual +0 -184
- data/_patches-20160113/eng-11625a +0 -4
- data/_patches-20160113/eng-11711 +0 -85
- data/_patches-20160113/eng-12232-command-spec +0 -236
- data/_patches-20160113/eng-12235 +0 -83
- data/_patches-20160113/eng-12235-override-refactor +0 -140
- data/_patches-20160113/eng-12240 +0 -103
- data/_patches-20160113/eng-12249 +0 -40
- data/_patches-20160113/eng-12301 +0 -50
- data/_patches-20160113/eng-12720 +0 -47
- data/_patches-20160113/eng-12843 +0 -95
- data/_patches-20160113/env-source +0 -112
- data/_patches-20160113/frickin-vagrant-spec +0 -163
- data/_patches-20160113/gem-pre-version +0 -14
- data/_patches-20160113/gems-old +0 -9
- data/_patches-20160113/googles-specs +0 -713
- data/_patches-20160113/local-configs-ignore +0 -61
- data/_patches-20160113/misc +0 -79
- data/_patches-20160113/network-unreachable +0 -31
- data/_patches-20160113/new-boxfile +0 -288
- data/_patches-20160113/parallelization-maybe +0 -198
- data/_patches-20160113/read-state +0 -23
- data/_patches-20160113/refactor-to-use-public_address-cap +0 -25
- data/_patches-20160113/series +0 -56
- data/_patches-20160113/status +0 -14
- data/_patches-20160113/test-move-env-data +0 -231
- data/_patches-20160113/test-vagrantfile-vm1 +0 -167
- data/_patches-20160113/vagrant-spec-mock-api +0 -137
- data/_patches-20160113/vagrant-vmware-plugin +0 -233
- data/_patches-20160113/vagrantfile +0 -403
- data/_patches-20160113/vagrantfile-for-acceptance-tests +0 -29
- data/_patches-20160113/vagrantfile-for-nick +0 -95
- data/_patches-20160113/vagrantfiles-to-forget-what-they-are-for +0 -134
- data/_patches-20160113/vm-vanished +0 -42
- data/_patches-20160118/COMPLETED-ABOVE-THIS-LINE +0 -4
- data/_patches-20160118/COMPLETED-BELOW-THIS-LINE +0 -4
- data/_patches-20160118/CR-ABOVE-THIS-LINE +0 -4
- data/_patches-20160118/CR-BELOW-THIS-LINE +0 -4
- data/_patches-20160118/WIP-ABOVE-THIS-LINE +0 -4
- data/_patches-20160118/WIP-BELOW-THIS-LINE +0 -4
- data/_patches-20160118/acceptance-test-runner +0 -29
- data/_patches-20160118/ansible-1 +0 -92
- data/_patches-20160118/cache-api-client-in-up +0 -40
- data/_patches-20160118/dead-code-in-actions +0 -44
- data/_patches-20160118/debug-changes +0 -55
- data/_patches-20160118/demo-rails-app +0 -1276
- data/_patches-20160118/eng-10166-halt-spec +0 -40
- data/_patches-20160118/eng-10256 +0 -554
- data/_patches-20160118/eng-10256-cr +0 -314
- data/_patches-20160118/eng-10256-ubuntu-testing +0 -88
- data/_patches-20160118/eng-10269-test-stuff +0 -87
- data/_patches-20160118/eng-10269-wtf +0 -119
- data/_patches-20160118/eng-10369 +0 -143
- data/_patches-20160118/eng-10369-tmp +0 -60
- data/_patches-20160118/eng-10919 +0 -56
- data/_patches-20160118/eng-11177-fix-actions-requires +0 -44
- data/_patches-20160118/eng-11442 +0 -4
- data/_patches-20160118/eng-11616 +0 -403
- data/_patches-20160118/eng-11616-2 +0 -67
- data/_patches-20160118/eng-11616-actual +0 -184
- data/_patches-20160118/eng-11625a +0 -4
- data/_patches-20160118/eng-11711 +0 -85
- data/_patches-20160118/eng-12232-command-spec +0 -236
- data/_patches-20160118/eng-12235 +0 -83
- data/_patches-20160118/eng-12235-override-refactor +0 -140
- data/_patches-20160118/eng-12240 +0 -103
- data/_patches-20160118/eng-12249 +0 -40
- data/_patches-20160118/eng-12301 +0 -50
- data/_patches-20160118/eng-12720 +0 -74
- data/_patches-20160118/eng-12843 +0 -95
- data/_patches-20160118/eng-13040 +0 -291
- data/_patches-20160118/env-source +0 -112
- data/_patches-20160118/frickin-vagrant-spec +0 -163
- data/_patches-20160118/gem-pre-version +0 -14
- data/_patches-20160118/gems-old +0 -9
- data/_patches-20160118/googles-specs +0 -713
- data/_patches-20160118/local-configs-ignore +0 -61
- data/_patches-20160118/misc +0 -79
- data/_patches-20160118/network-unreachable +0 -31
- data/_patches-20160118/new-boxfile +0 -288
- data/_patches-20160118/parallelization-maybe +0 -198
- data/_patches-20160118/port-forwarding-processes +0 -87
- data/_patches-20160118/read-state +0 -23
- data/_patches-20160118/refactor-to-use-public_address-cap +0 -25
- data/_patches-20160118/series +0 -59
- data/_patches-20160118/status +0 -13
- data/_patches-20160118/test-move-env-data +0 -231
- data/_patches-20160118/test-vagrantfile-vm1 +0 -167
- data/_patches-20160118/vagrant-spec-mock-api +0 -137
- data/_patches-20160118/vagrant-vmware-plugin +0 -233
- data/_patches-20160118/vagrantfile +0 -403
- data/_patches-20160118/vagrantfile-for-acceptance-tests +0 -29
- data/_patches-20160118/vagrantfile-for-nick +0 -95
- data/_patches-20160118/vagrantfiles-to-forget-what-they-are-for +0 -134
- data/_patches-20160118/vm-vanished +0 -42
- data/_patches-20160118a/COMPLETED-ABOVE-THIS-LINE +0 -4
- data/_patches-20160118a/COMPLETED-BELOW-THIS-LINE +0 -4
- data/_patches-20160118a/CR-ABOVE-THIS-LINE +0 -4
- data/_patches-20160118a/CR-BELOW-THIS-LINE +0 -4
- data/_patches-20160118a/WIP-ABOVE-THIS-LINE +0 -4
- data/_patches-20160118a/WIP-BELOW-THIS-LINE +0 -4
- data/_patches-20160118a/acceptance-test-runner +0 -29
- data/_patches-20160118a/ansible-1 +0 -92
- data/_patches-20160118a/bar +0 -189
- data/_patches-20160118a/cache-api-client-in-up +0 -40
- data/_patches-20160118a/dead-code-in-actions +0 -44
- data/_patches-20160118a/debug-changes +0 -55
- data/_patches-20160118a/demo-rails-app +0 -1276
- data/_patches-20160118a/eng-10166-halt-spec +0 -40
- data/_patches-20160118a/eng-10256 +0 -554
- data/_patches-20160118a/eng-10256-cr +0 -314
- data/_patches-20160118a/eng-10256-ubuntu-testing +0 -88
- data/_patches-20160118a/eng-10269-test-stuff +0 -87
- data/_patches-20160118a/eng-10269-wtf +0 -119
- data/_patches-20160118a/eng-10369 +0 -143
- data/_patches-20160118a/eng-10369-tmp +0 -60
- data/_patches-20160118a/eng-10919 +0 -56
- data/_patches-20160118a/eng-11177-fix-actions-requires +0 -44
- data/_patches-20160118a/eng-11442 +0 -4
- data/_patches-20160118a/eng-11616 +0 -403
- data/_patches-20160118a/eng-11616-2 +0 -67
- data/_patches-20160118a/eng-11616-actual +0 -184
- data/_patches-20160118a/eng-11625a +0 -4
- data/_patches-20160118a/eng-11711 +0 -85
- data/_patches-20160118a/eng-12232-command-spec +0 -236
- data/_patches-20160118a/eng-12235 +0 -83
- data/_patches-20160118a/eng-12235-override-refactor +0 -140
- data/_patches-20160118a/eng-12240 +0 -103
- data/_patches-20160118a/eng-12249 +0 -40
- data/_patches-20160118a/eng-12301 +0 -50
- data/_patches-20160118a/eng-12720 +0 -74
- data/_patches-20160118a/eng-12843 +0 -95
- data/_patches-20160118a/eng-13040 +0 -291
- data/_patches-20160118a/env-source +0 -112
- data/_patches-20160118a/foo +0 -169
- data/_patches-20160118a/frickin-vagrant-spec +0 -163
- data/_patches-20160118a/gem-pre-version +0 -14
- data/_patches-20160118a/gems-old +0 -9
- data/_patches-20160118a/googles-specs +0 -713
- data/_patches-20160118a/guestport-madness +0 -59
- data/_patches-20160118a/local-configs-ignore +0 -61
- data/_patches-20160118a/misc +0 -79
- data/_patches-20160118a/network-unreachable +0 -31
- data/_patches-20160118a/new-boxfile +0 -288
- data/_patches-20160118a/parallelization-maybe +0 -198
- data/_patches-20160118a/port-forwarding-processes +0 -87
- data/_patches-20160118a/read-state +0 -23
- data/_patches-20160118a/refactor-to-use-public_address-cap +0 -25
- data/_patches-20160118a/series +0 -62
- data/_patches-20160118a/status +0 -14
- data/_patches-20160118a/test-move-env-data +0 -231
- data/_patches-20160118a/test-vagrantfile-vm1 +0 -167
- data/_patches-20160118a/vagrant-spec-mock-api +0 -137
- data/_patches-20160118a/vagrant-vmware-plugin +0 -233
- data/_patches-20160118a/vagrantfile +0 -403
- data/_patches-20160118a/vagrantfile-for-acceptance-tests +0 -29
- data/_patches-20160118a/vagrantfile-for-nick +0 -95
- data/_patches-20160118a/vagrantfiles-to-forget-what-they-are-for +0 -134
- data/_patches-20160118a/vm-vanished +0 -42
@@ -1,713 +0,0 @@
|
|
1
|
-
# HG changeset patch
|
2
|
-
# Parent cc7a47cd4204ca0a01605c415bad7f2f3e1ba9a9
|
3
|
-
imported patch googles-specs
|
4
|
-
|
5
|
-
diff -r cc7a47cd4204 Rakefile
|
6
|
-
--- a/Rakefile Thu Sep 10 15:27:23 2015 -0700
|
7
|
-
+++ b/Rakefile Fri Sep 11 15:11:26 2015 -0700
|
8
|
-
@@ -19,3 +19,12 @@
|
9
|
-
|
10
|
-
# Default task is to run the unit tests
|
11
|
-
task :default => "spec"
|
12
|
-
+
|
13
|
-
+# Load all the rake tasks from the "tasks" folder. This folder
|
14
|
-
+# allows us to nicely separate rake tasks into individual files
|
15
|
-
+# based on their role, which makes development and debugging easier
|
16
|
-
+# than one monolithic file.
|
17
|
-
+task_dir = File.expand_path("../tasks", __FILE__)
|
18
|
-
+Dir["#{task_dir}/**/*.rake"].each do |task_file|
|
19
|
-
+ load task_file
|
20
|
-
+end
|
21
|
-
diff -r cc7a47cd4204 spec/vagrant-skytap/acceptance/base.rb
|
22
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
23
|
-
+++ b/spec/vagrant-skytap/acceptance/base.rb Fri Sep 11 15:11:26 2015 -0700
|
24
|
-
@@ -0,0 +1,2 @@
|
25
|
-
+require "vagrant-spec/acceptance"
|
26
|
-
+require_relative "shared/context_google"
|
27
|
-
diff -r cc7a47cd4204 spec/vagrant-skytap/acceptance/provider/halt_spec.rb
|
28
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
29
|
-
+++ b/spec/vagrant-skytap/acceptance/provider/halt_spec.rb Fri Sep 11 15:11:26 2015 -0700
|
30
|
-
@@ -0,0 +1,34 @@
|
31
|
-
+# This tests that an instance can be halted correctly
|
32
|
-
+shared_examples 'provider/halt' do |provider, options|
|
33
|
-
+ if !options[:box]
|
34
|
-
+ raise ArgumentError,
|
35
|
-
+ "box option must be specified for provider: #{provider}"
|
36
|
-
+ end
|
37
|
-
+
|
38
|
-
+ include_context 'acceptance'
|
39
|
-
+
|
40
|
-
+ before do
|
41
|
-
+ environment.skeleton('generic')
|
42
|
-
+ assert_execute('vagrant', 'box', 'add', 'basic', options[:box])
|
43
|
-
+ assert_execute('vagrant', 'up', "--provider=#{provider}")
|
44
|
-
+ end
|
45
|
-
+
|
46
|
-
+ after do
|
47
|
-
+ assert_execute('vagrant', 'destroy', '--force')
|
48
|
-
+ end
|
49
|
-
+
|
50
|
-
+ it 'should halt the machine and bring it back up' do
|
51
|
-
+ status("Test: machine can be halted")
|
52
|
-
+ halt_result = execute("vagrant", "halt")
|
53
|
-
+ expect(halt_result).to exit_with(0)
|
54
|
-
+
|
55
|
-
+ status("Test: machine can be brought up after halt")
|
56
|
-
+ up_result = execute("vagrant", "up")
|
57
|
-
+ expect(up_result).to exit_with(0)
|
58
|
-
+
|
59
|
-
+ status("Test: machine is running after up")
|
60
|
-
+ echo_result = execute("vagrant", "ssh", "-c", "echo foo")
|
61
|
-
+ expect(echo_result).to exit_with(0)
|
62
|
-
+ expect(echo_result.stdout).to match(/foo\n$/)
|
63
|
-
+ end
|
64
|
-
+end
|
65
|
-
diff -r cc7a47cd4204 spec/vagrant-skytap/acceptance/provider/multi_instance_spec.rb
|
66
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
67
|
-
+++ b/spec/vagrant-skytap/acceptance/provider/multi_instance_spec.rb Fri Sep 11 15:11:26 2015 -0700
|
68
|
-
@@ -0,0 +1,31 @@
|
69
|
-
+# This tests that multiple instances can be brought up correctly
|
70
|
-
+shared_examples 'provider/multi_instance' do |provider, options|
|
71
|
-
+ if !options[:box]
|
72
|
-
+ raise ArgumentError,
|
73
|
-
+ "box option must be specified for provider: #{provider}"
|
74
|
-
+ end
|
75
|
-
+
|
76
|
-
+ include_context 'acceptance'
|
77
|
-
+
|
78
|
-
+ before do
|
79
|
-
+ environment.skeleton('multi_instance')
|
80
|
-
+ assert_execute('vagrant', 'box', 'add', 'basic', options[:box])
|
81
|
-
+ assert_execute('vagrant', 'up', "--provider=#{provider}")
|
82
|
-
+ end
|
83
|
-
+
|
84
|
-
+ after do
|
85
|
-
+ assert_execute('vagrant', 'destroy', '--force')
|
86
|
-
+ end
|
87
|
-
+
|
88
|
-
+ it 'should bring up 2 machines in different zones' do
|
89
|
-
+ status("Test: both machines are running after up")
|
90
|
-
+ status("Test: machine1 is running after up")
|
91
|
-
+ result1 = execute("vagrant", "ssh", "z1a", "-c", "echo foo")
|
92
|
-
+ expect(result1).to exit_with(0)
|
93
|
-
+ expect(result1.stdout).to match(/foo\n$/)
|
94
|
-
+ status("Test: machine2 is running after up")
|
95
|
-
+ result1 = execute("vagrant", "ssh", "z1b", "-c", "echo foo")
|
96
|
-
+ expect(result1).to exit_with(0)
|
97
|
-
+ expect(result1.stdout).to match(/foo\n$/)
|
98
|
-
+ end
|
99
|
-
+end
|
100
|
-
diff -r cc7a47cd4204 spec/vagrant-skytap/acceptance/provider/preemptible_spec.rb
|
101
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
102
|
-
+++ b/spec/vagrant-skytap/acceptance/provider/preemptible_spec.rb Fri Sep 11 15:11:26 2015 -0700
|
103
|
-
@@ -0,0 +1,26 @@
|
104
|
-
+# This tests that a preemptible instance can be brought up correctly
|
105
|
-
+shared_examples 'provider/preemptible' do |provider, options|
|
106
|
-
+ if !options[:box]
|
107
|
-
+ raise ArgumentError,
|
108
|
-
+ "box option must be specified for provider: #{provider}"
|
109
|
-
+ end
|
110
|
-
+
|
111
|
-
+ include_context 'acceptance'
|
112
|
-
+
|
113
|
-
+ before do
|
114
|
-
+ environment.skeleton('preemptible')
|
115
|
-
+ assert_execute('vagrant', 'box', 'add', 'basic', options[:box])
|
116
|
-
+ assert_execute('vagrant', 'up', "--provider=#{provider}")
|
117
|
-
+ end
|
118
|
-
+
|
119
|
-
+ after do
|
120
|
-
+ assert_execute('vagrant', 'destroy', '--force')
|
121
|
-
+ end
|
122
|
-
+
|
123
|
-
+ it 'should bring up machine with preemptible option' do
|
124
|
-
+ status("Test: machine is running after up")
|
125
|
-
+ result = execute("vagrant", "ssh", "-c", "echo foo")
|
126
|
-
+ expect(result).to exit_with(0)
|
127
|
-
+ expect(result.stdout).to match(/foo\n$/)
|
128
|
-
+ end
|
129
|
-
+end
|
130
|
-
diff -r cc7a47cd4204 spec/vagrant-skytap/acceptance/provider/reload_spec.rb
|
131
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
132
|
-
+++ b/spec/vagrant-skytap/acceptance/provider/reload_spec.rb Fri Sep 11 15:11:26 2015 -0700
|
133
|
-
@@ -0,0 +1,29 @@
|
134
|
-
+# This tests that an instance can be reloaded correctly
|
135
|
-
+shared_examples 'provider/reload' do |provider, options|
|
136
|
-
+ if !options[:box]
|
137
|
-
+ raise ArgumentError,
|
138
|
-
+ "box option must be specified for provider: #{provider}"
|
139
|
-
+ end
|
140
|
-
+
|
141
|
-
+ include_context 'acceptance'
|
142
|
-
+
|
143
|
-
+ before do
|
144
|
-
+ environment.skeleton('generic')
|
145
|
-
+ assert_execute('vagrant', 'box', 'add', 'basic', options[:box])
|
146
|
-
+ assert_execute('vagrant', 'up', "--provider=#{provider}")
|
147
|
-
+ end
|
148
|
-
+
|
149
|
-
+ after do
|
150
|
-
+ assert_execute('vagrant', 'destroy', '--force')
|
151
|
-
+ end
|
152
|
-
+
|
153
|
-
+ it 'should reload the machine correctly' do
|
154
|
-
+ status("Test: machine can be reloaded")
|
155
|
-
+ reload_result = execute("vagrant", "reload")
|
156
|
-
+ expect(reload_result).to exit_with(0)
|
157
|
-
+
|
158
|
-
+ echo_result = execute("vagrant", "ssh", "-c", "echo foo")
|
159
|
-
+ expect(echo_result).to exit_with(0)
|
160
|
-
+ expect(echo_result.stdout).to match(/foo\n$/)
|
161
|
-
+ end
|
162
|
-
+end
|
163
|
-
diff -r cc7a47cd4204 spec/vagrant-skytap/acceptance/provider/scopes_spec.rb
|
164
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
165
|
-
+++ b/spec/vagrant-skytap/acceptance/provider/scopes_spec.rb Fri Sep 11 15:11:26 2015 -0700
|
166
|
-
@@ -0,0 +1,29 @@
|
167
|
-
+# This tests that account scopes can be configured correctly
|
168
|
-
+# Additionally, this verifies that the 'scopes' method alias is
|
169
|
-
+# available and gcloud GCE aliases can be used.
|
170
|
-
+# (see lib/fog/google/models/compute/server.rb in fog-google)
|
171
|
-
+shared_examples 'provider/scopes' do |provider, options|
|
172
|
-
+ if !options[:box]
|
173
|
-
+ raise ArgumentError,
|
174
|
-
+ "box option must be specified for provider: #{provider}"
|
175
|
-
+ end
|
176
|
-
+
|
177
|
-
+ include_context 'acceptance'
|
178
|
-
+
|
179
|
-
+ before do
|
180
|
-
+ environment.skeleton('scopes')
|
181
|
-
+ assert_execute('vagrant', 'box', 'add', 'basic', options[:box])
|
182
|
-
+ assert_execute('vagrant', 'up', "--provider=#{provider}")
|
183
|
-
+ end
|
184
|
-
+
|
185
|
-
+ after do
|
186
|
-
+ assert_execute('vagrant', 'destroy', '--force')
|
187
|
-
+ end
|
188
|
-
+
|
189
|
-
+ it 'should bring up machine with scope definitions' do
|
190
|
-
+ status("Test: machine is running after up")
|
191
|
-
+ result = execute("vagrant", "ssh", "-c", "echo foo")
|
192
|
-
+ expect(result).to exit_with(0)
|
193
|
-
+ expect(result.stdout).to match(/foo\n$/)
|
194
|
-
+ end
|
195
|
-
+end
|
196
|
-
diff -r cc7a47cd4204 spec/vagrant-skytap/acceptance/shared/context_google.rb
|
197
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
198
|
-
+++ b/spec/vagrant-skytap/acceptance/shared/context_google.rb Fri Sep 11 15:11:26 2015 -0700
|
199
|
-
@@ -0,0 +1,3 @@
|
200
|
-
+shared_context "provider-context/google" do
|
201
|
-
+
|
202
|
-
+end
|
203
|
-
diff -r cc7a47cd4204 spec/vagrant-skytap/acceptance/skeletons/generic/Vagrantfile
|
204
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
205
|
-
+++ b/spec/vagrant-skytap/acceptance/skeletons/generic/Vagrantfile Fri Sep 11 15:11:26 2015 -0700
|
206
|
-
@@ -0,0 +1,17 @@
|
207
|
-
+# This is a generic acceptance skeleton with no particular settings, set in
|
208
|
-
+# europe-west1-d zone
|
209
|
-
+
|
210
|
-
+Vagrant.configure("2") do |config|
|
211
|
-
+ config.vm.box = "basic"
|
212
|
-
+
|
213
|
-
+ config.vm.provider :google do |google, override|
|
214
|
-
+
|
215
|
-
+ google.zone = "europe-west1-d"
|
216
|
-
+
|
217
|
-
+ google.zone_config "europe-west1-d" do |zone1d|
|
218
|
-
+ zone1d.name = "vagrant-testing-halt"
|
219
|
-
+ zone1d.image = "debian-7-wheezy-v20150603"
|
220
|
-
+ zone1d.zone = "europe-west1-d"
|
221
|
-
+ end
|
222
|
-
+ end
|
223
|
-
+end
|
224
|
-
diff -r cc7a47cd4204 spec/vagrant-skytap/acceptance/skeletons/multi_instance/Vagrantfile
|
225
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
226
|
-
+++ b/spec/vagrant-skytap/acceptance/skeletons/multi_instance/Vagrantfile Fri Sep 11 15:11:26 2015 -0700
|
227
|
-
@@ -0,0 +1,29 @@
|
228
|
-
+Vagrant.configure("2") do |config|
|
229
|
-
+ config.vm.box = "basic"
|
230
|
-
+
|
231
|
-
+ config.vm.define :z1a do |z1a|
|
232
|
-
+ z1a.vm.provider :google do |google, override|
|
233
|
-
+ google.zone = "europe-west1-c"
|
234
|
-
+
|
235
|
-
+ google.zone_config "europe-west1-c" do |z1a_zone|
|
236
|
-
+ z1a_zone.name = "vagrant-testing-acceptance-multi-z1a"
|
237
|
-
+ z1a_zone.image = "debian-7-wheezy-v20150603"
|
238
|
-
+ z1a_zone.machine_type = "n1-standard-1"
|
239
|
-
+ z1a_zone.zone = "europe-west1-c"
|
240
|
-
+ end
|
241
|
-
+ end
|
242
|
-
+ end
|
243
|
-
+
|
244
|
-
+ config.vm.define :z1b do |z1b|
|
245
|
-
+ z1b.vm.provider :google do |google, override|
|
246
|
-
+ google.zone = "europe-west1-d"
|
247
|
-
+
|
248
|
-
+ google.zone_config "europe-west1-d" do |z1b_zone|
|
249
|
-
+ z1b_zone.name = "vagrant-testing-acceptance-multi-z1b"
|
250
|
-
+ z1b_zone.image = "debian-7-wheezy-v20150603"
|
251
|
-
+ z1b_zone.machine_type = "n1-standard-2"
|
252
|
-
+ z1b_zone.zone = "europe-west1-d"
|
253
|
-
+ end
|
254
|
-
+ end
|
255
|
-
+ end
|
256
|
-
+end
|
257
|
-
diff -r cc7a47cd4204 spec/vagrant-skytap/acceptance/skeletons/preemptible/Vagrantfile
|
258
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
259
|
-
+++ b/spec/vagrant-skytap/acceptance/skeletons/preemptible/Vagrantfile Fri Sep 11 15:11:26 2015 -0700
|
260
|
-
@@ -0,0 +1,17 @@
|
261
|
-
+Vagrant.configure("2") do |config|
|
262
|
-
+ config.vm.box = "basic"
|
263
|
-
+
|
264
|
-
+ config.vm.provider :google do |google, override|
|
265
|
-
+
|
266
|
-
+ google.zone = "europe-west1-d"
|
267
|
-
+
|
268
|
-
+ google.zone_config "europe-west1-d" do |zone1d|
|
269
|
-
+ zone1d.name = "vagrant-testing-preemptible"
|
270
|
-
+ zone1d.image = "debian-7-wheezy-v20150603"
|
271
|
-
+ zone1d.zone = "europe-west1-d"
|
272
|
-
+ zone1d.preemptible = true
|
273
|
-
+ zone1d.auto_restart = false
|
274
|
-
+ zone1d.on_host_maintenance = "TERMINATE"
|
275
|
-
+ end
|
276
|
-
+ end
|
277
|
-
+end
|
278
|
-
diff -r cc7a47cd4204 spec/vagrant-skytap/acceptance/skeletons/scopes/Vagrantfile
|
279
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
280
|
-
+++ b/spec/vagrant-skytap/acceptance/skeletons/scopes/Vagrantfile Fri Sep 11 15:11:26 2015 -0700
|
281
|
-
@@ -0,0 +1,18 @@
|
282
|
-
+Vagrant.configure("2") do |config|
|
283
|
-
+ config.vm.box = "basic"
|
284
|
-
+
|
285
|
-
+ config.vm.provider :google do |google, override|
|
286
|
-
+
|
287
|
-
+ google.zone = "europe-west1-d"
|
288
|
-
+
|
289
|
-
+ google.zone_config "europe-west1-d" do |zone1d|
|
290
|
-
+ zone1d.name = "vagrant-testing-acceptance-scopes"
|
291
|
-
+ zone1d.scopes = ['sql-admin',
|
292
|
-
+ 'bigquery',
|
293
|
-
+ 'https://www.googleapis.com/auth/compute'
|
294
|
-
+ ]
|
295
|
-
+ zone1d.image = "debian-7-wheezy-v20150603"
|
296
|
-
+ zone1d.zone = "europe-west1-d"
|
297
|
-
+ end
|
298
|
-
+ end
|
299
|
-
+end
|
300
|
-
diff -r cc7a47cd4204 spec/vagrant-skytap/unit/base.rb
|
301
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
302
|
-
+++ b/spec/vagrant-skytap/unit/base.rb Fri Sep 11 15:11:26 2015 -0700
|
303
|
-
@@ -0,0 +1,19 @@
|
304
|
-
+require "rubygems"
|
305
|
-
+require "rspec/autorun"
|
306
|
-
+
|
307
|
-
+# Require Vagrant itself so we can reference the proper
|
308
|
-
+# classes to test.
|
309
|
-
+require "vagrant"
|
310
|
-
+require "vagrant-google"
|
311
|
-
+
|
312
|
-
+# Add the test directory to the load path
|
313
|
-
+$LOAD_PATH.unshift File.expand_path("../../", __FILE__)
|
314
|
-
+
|
315
|
-
+# Do not buffer output
|
316
|
-
+$stdout.sync = true
|
317
|
-
+$stderr.sync = true
|
318
|
-
+
|
319
|
-
+# Configure RSpec
|
320
|
-
+RSpec.configure do |c|
|
321
|
-
+ c.formatter = :progress
|
322
|
-
+end
|
323
|
-
diff -r cc7a47cd4204 spec/vagrant-skytap/unit/common/config_test.rb
|
324
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
325
|
-
+++ b/spec/vagrant-skytap/unit/common/config_test.rb Fri Sep 11 15:11:26 2015 -0700
|
326
|
-
@@ -0,0 +1,297 @@
|
327
|
-
+# Copyright 2013 Google Inc. All Rights Reserved.
|
328
|
-
+#
|
329
|
-
+# Licensed under the Apache License, Version 2.0 (the "License");
|
330
|
-
+# you may not use this file except in compliance with the License.
|
331
|
-
+# You may obtain a copy of the License at
|
332
|
-
+#
|
333
|
-
+# http://www.apache.org/licenses/LICENSE-2.0
|
334
|
-
+#
|
335
|
-
+# Unless required by applicable law or agreed to in writing, software
|
336
|
-
+# distributed under the License is distributed on an "AS IS" BASIS,
|
337
|
-
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
338
|
-
+# See the License for the specific language governing permissions and
|
339
|
-
+# limitations under the License.
|
340
|
-
+require File.expand_path("../../base", __FILE__)
|
341
|
-
+
|
342
|
-
+require "vagrant-google/config"
|
343
|
-
+
|
344
|
-
+describe VagrantPlugins::Google::Config do
|
345
|
-
+ let(:instance) { described_class.new }
|
346
|
-
+
|
347
|
-
+ # Ensure tests are not affected by Google credential environment variables
|
348
|
-
+ before :each do
|
349
|
-
+ ENV.stub(:[] => nil)
|
350
|
-
+ end
|
351
|
-
+
|
352
|
-
+ describe "defaults" do
|
353
|
-
+ subject do
|
354
|
-
+ instance.tap do |o|
|
355
|
-
+ o.finalize!
|
356
|
-
+ end
|
357
|
-
+ end
|
358
|
-
+
|
359
|
-
+ its("name") { should match "i-[0-9]{10}-[0-9a-f]{4}" }
|
360
|
-
+ its("image") { should == "debian-7-wheezy-v20150127" }
|
361
|
-
+ its("zone") { should == "us-central1-f" }
|
362
|
-
+ its("network") { should == "default" }
|
363
|
-
+ its("machine_type") { should == "n1-standard-1" }
|
364
|
-
+ its("disk_size") { should == 10 }
|
365
|
-
+ its("disk_name") { should be_nil }
|
366
|
-
+ its("disk_type") { should == "pd-standard" }
|
367
|
-
+ its("instance_ready_timeout") { should == 20 }
|
368
|
-
+ its("metadata") { should == {} }
|
369
|
-
+ its("tags") { should == [] }
|
370
|
-
+ its("service_accounts") { should == nil }
|
371
|
-
+ its("preemptible") { should be_false }
|
372
|
-
+ its("auto_restart") { should }
|
373
|
-
+ its("on_host_maintenance") { should == "MIGRATE" }
|
374
|
-
+ end
|
375
|
-
+
|
376
|
-
+ describe "overriding defaults" do
|
377
|
-
+ # I typically don't meta-program in tests, but this is a very
|
378
|
-
+ # simple boilerplate test, so I cut corners here. It just sets
|
379
|
-
+ # each of these attributes to "foo" in isolation, and reads the value
|
380
|
-
+ # and asserts the proper result comes back out.
|
381
|
-
+ [:name, :image, :zone, :instance_ready_timeout, :machine_type, :disk_size, :disk_name, :disk_type,
|
382
|
-
+ :network, :metadata, :can_ip_forward, :external_ip, :autodelete_disk].each do |attribute|
|
383
|
-
+
|
384
|
-
+ it "should not default #{attribute} if overridden" do
|
385
|
-
+ instance.send("#{attribute}=".to_sym, "foo")
|
386
|
-
+ instance.finalize!
|
387
|
-
+ instance.send(attribute).should == "foo"
|
388
|
-
+ end
|
389
|
-
+ end
|
390
|
-
+
|
391
|
-
+ it "should raise error when preemptible and auto_restart is true" do
|
392
|
-
+ instance.preemptible = true
|
393
|
-
+ instance.auto_restart = true
|
394
|
-
+ expected_error = "en.vagrant_google.config.auto_restart_invalid_on_preemptible"
|
395
|
-
+ instance.finalize!
|
396
|
-
+ errors = instance.validate("foo")["Google Provider"]
|
397
|
-
+ errors.inject(false) { |a, e| a or e.include?(expected_error) }.should == true
|
398
|
-
+ end
|
399
|
-
+
|
400
|
-
+ it "should raise error when preemptible and on_host_maintenance is not TERMINATE" do
|
401
|
-
+ instance.preemptible = true
|
402
|
-
+ instance.on_host_maintenance = "MIGRATE"
|
403
|
-
+ expected_error = "en.vagrant_google.config.on_host_maintenance_invalid_on_preemptible"
|
404
|
-
+ instance.finalize!
|
405
|
-
+ errors = instance.validate("foo")["Google Provider"]
|
406
|
-
+ errors.inject(false) { |a, e| a or e.include?(expected_error) }.should == true
|
407
|
-
+ end
|
408
|
-
+ end
|
409
|
-
+
|
410
|
-
+ describe "getting credentials from environment" do
|
411
|
-
+ context "without Google credential environment variables" do
|
412
|
-
+ subject do
|
413
|
-
+ instance.tap do |o|
|
414
|
-
+ o.finalize!
|
415
|
-
+ end
|
416
|
-
+ end
|
417
|
-
+
|
418
|
-
+ its("google_client_email") { should be_nil }
|
419
|
-
+ its("google_key_location") { should be_nil }
|
420
|
-
+ its("google_json_key_location") { should be_nil }
|
421
|
-
+ end
|
422
|
-
+
|
423
|
-
+ context "with Google credential environment variables" do
|
424
|
-
+ before :each do
|
425
|
-
+ ENV.stub(:[]).with("GOOGLE_CLIENT_EMAIL").and_return("client_id_email")
|
426
|
-
+ ENV.stub(:[]).with("GOOGLE_KEY_LOCATION").and_return("/path/to/key")
|
427
|
-
+ ENV.stub(:[]).with("GOOGLE_JSON_KEY_LOCATION").and_return("/path/to/json/key")
|
428
|
-
+ end
|
429
|
-
+
|
430
|
-
+ subject do
|
431
|
-
+ instance.tap do |o|
|
432
|
-
+ o.finalize!
|
433
|
-
+ end
|
434
|
-
+ end
|
435
|
-
+
|
436
|
-
+ its("google_client_email") { should == "client_id_email" }
|
437
|
-
+ its("google_key_location") { should == "/path/to/key" }
|
438
|
-
+ its("google_json_key_location") { should == "/path/to/json/key" }
|
439
|
-
+ end
|
440
|
-
+
|
441
|
-
+ context "With both Google credential environment variables" do
|
442
|
-
+ before :each do
|
443
|
-
+ ENV.stub(:[]).with("GOOGLE_CLIENT_EMAIL").and_return("client_id_email")
|
444
|
-
+ ENV.stub(:[]).with("GOOGLE_KEY_LOCATION").and_return("/path/to/key")
|
445
|
-
+ ENV.stub(:[]).with("GOOGLE_JSON_KEY_LOCATION").and_return("/path/to/json/key")
|
446
|
-
+ end
|
447
|
-
+
|
448
|
-
+ it "Should return duplicate key location errors" do
|
449
|
-
+ instance.finalize!
|
450
|
-
+ expect(instance.validate("foo")["Google Provider"][1]).to include("en.vagrant_google.config.google_duplicate_key_location")
|
451
|
-
+ end
|
452
|
-
+ end
|
453
|
-
+
|
454
|
-
+ context "With none of the Google credential environment variables set" do
|
455
|
-
+ before :each do
|
456
|
-
+ ENV.stub(:[]).with("GOOGLE_CLIENT_EMAIL").and_return("client_id_email")
|
457
|
-
+ end
|
458
|
-
+
|
459
|
-
+ it "Should return no key set errors" do
|
460
|
-
+ instance.finalize!
|
461
|
-
+ expect(instance.validate("foo")["Google Provider"][1]).to include("en.vagrant_google.config.google_key_location_required")
|
462
|
-
+ end
|
463
|
-
+ end
|
464
|
-
+ end
|
465
|
-
+
|
466
|
-
+ describe "zone config" do
|
467
|
-
+ let(:config_image) { "foo" }
|
468
|
-
+ let(:config_machine_type) { "foo" }
|
469
|
-
+ let(:config_disk_size) { 99 }
|
470
|
-
+ let(:config_disk_name) { "foo" }
|
471
|
-
+ let(:config_disk_type) { "foo" }
|
472
|
-
+ let(:config_name) { "foo" }
|
473
|
-
+ let(:config_zone) { "foo" }
|
474
|
-
+ let(:config_network) { "foo" }
|
475
|
-
+ let(:can_ip_forward) { true }
|
476
|
-
+ let(:external_ip) { "foo" }
|
477
|
-
+
|
478
|
-
+ def set_test_values(instance)
|
479
|
-
+ instance.name = config_name
|
480
|
-
+ instance.network = config_network
|
481
|
-
+ instance.image = config_image
|
482
|
-
+ instance.machine_type = config_machine_type
|
483
|
-
+ instance.disk_size = config_disk_size
|
484
|
-
+ instance.disk_name = config_disk_name
|
485
|
-
+ instance.disk_type = config_disk_type
|
486
|
-
+ instance.zone = config_zone
|
487
|
-
+ instance.can_ip_forward = can_ip_forward
|
488
|
-
+ instance.external_ip = external_ip
|
489
|
-
+ end
|
490
|
-
+
|
491
|
-
+ it "should raise an exception if not finalized" do
|
492
|
-
+ expect { instance.get_zone_config("us-central1-f") }.
|
493
|
-
+ to raise_error
|
494
|
-
+ end
|
495
|
-
+
|
496
|
-
+ context "with no specific config set" do
|
497
|
-
+ subject do
|
498
|
-
+ # Set the values on the top-level object
|
499
|
-
+ set_test_values(instance)
|
500
|
-
+
|
501
|
-
+ # Finalize so we can get the zone config
|
502
|
-
+ instance.finalize!
|
503
|
-
+
|
504
|
-
+ # Get a lower level zone
|
505
|
-
+ instance.get_zone_config("us-central1-f")
|
506
|
-
+ end
|
507
|
-
+
|
508
|
-
+ its("name") { should == config_name }
|
509
|
-
+ its("image") { should == config_image }
|
510
|
-
+ its("machine_type") { should == config_machine_type }
|
511
|
-
+ its("disk_size") { should == config_disk_size }
|
512
|
-
+ its("disk_name") { should == config_disk_name }
|
513
|
-
+ its("disk_type") { should == config_disk_type }
|
514
|
-
+ its("network") { should == config_network }
|
515
|
-
+ its("zone") { should == config_zone }
|
516
|
-
+ its("can_ip_forward") { should == can_ip_forward }
|
517
|
-
+ its("external_ip") { should == external_ip }
|
518
|
-
+ end
|
519
|
-
+
|
520
|
-
+ context "with a specific config set" do
|
521
|
-
+ let(:zone_name) { "hashi-zone" }
|
522
|
-
+
|
523
|
-
+ subject do
|
524
|
-
+ # Set the values on a specific zone
|
525
|
-
+ instance.zone_config zone_name do |config|
|
526
|
-
+ set_test_values(config)
|
527
|
-
+ end
|
528
|
-
+
|
529
|
-
+ # Finalize so we can get the zone config
|
530
|
-
+ instance.finalize!
|
531
|
-
+
|
532
|
-
+ # Get the zone
|
533
|
-
+ instance.get_zone_config(zone_name)
|
534
|
-
+ end
|
535
|
-
+
|
536
|
-
+ its("name") { should == config_name }
|
537
|
-
+ its("image") { should == config_image }
|
538
|
-
+ its("machine_type") { should == config_machine_type }
|
539
|
-
+ its("disk_size") { should == config_disk_size }
|
540
|
-
+ its("disk_name") { should == config_disk_name }
|
541
|
-
+ its("disk_type") { should == config_disk_type }
|
542
|
-
+ its("network") { should == config_network }
|
543
|
-
+ its("zone") { should == zone_name }
|
544
|
-
+ its("can_ip_forward") { should == can_ip_forward }
|
545
|
-
+ its("external_ip") { should == external_ip }
|
546
|
-
+ end
|
547
|
-
+
|
548
|
-
+ describe "inheritance of parent config" do
|
549
|
-
+ let(:zone) { "hashi-zone" }
|
550
|
-
+
|
551
|
-
+ subject do
|
552
|
-
+ # Set the values on a specific zone
|
553
|
-
+ instance.zone_config zone do |config|
|
554
|
-
+ config.image = "child"
|
555
|
-
+ end
|
556
|
-
+
|
557
|
-
+ # Set some top-level values
|
558
|
-
+ instance.image = "parent"
|
559
|
-
+
|
560
|
-
+ # Finalize and get the zone
|
561
|
-
+ instance.finalize!
|
562
|
-
+ instance.get_zone_config(zone)
|
563
|
-
+ end
|
564
|
-
+
|
565
|
-
+ its("image") { should == "child" }
|
566
|
-
+ end
|
567
|
-
+
|
568
|
-
+ describe "shortcut configuration" do
|
569
|
-
+ subject do
|
570
|
-
+ # Use the shortcut configuration to set some values
|
571
|
-
+ instance.zone_config "us-central1-f", :image => "child"
|
572
|
-
+ instance.finalize!
|
573
|
-
+ instance.get_zone_config("us-central1-f")
|
574
|
-
+ end
|
575
|
-
+
|
576
|
-
+ its("image") { should == "child" }
|
577
|
-
+ end
|
578
|
-
+
|
579
|
-
+ describe "merging" do
|
580
|
-
+ let(:first) { described_class.new }
|
581
|
-
+ let(:second) { described_class.new }
|
582
|
-
+
|
583
|
-
+ it "should merge the metadata" do
|
584
|
-
+ first.metadata["one"] = "foo"
|
585
|
-
+ second.metadata["two"] = "bar"
|
586
|
-
+
|
587
|
-
+ third = first.merge(second)
|
588
|
-
+ third.metadata.should == {
|
589
|
-
+ "one" => "foo",
|
590
|
-
+ "two" => "bar"
|
591
|
-
+ }
|
592
|
-
+ end
|
593
|
-
+ end
|
594
|
-
+
|
595
|
-
+ describe "zone_preemptible" do
|
596
|
-
+ let(:zone) { "hashi-zone" }
|
597
|
-
+ subject do
|
598
|
-
+ instance.zone = zone
|
599
|
-
+ instance.zone_config zone do |config|
|
600
|
-
+ config.preemptible = true
|
601
|
-
+ config.auto_restart = true
|
602
|
-
+ config.on_host_maintenance = "MIGRATE"
|
603
|
-
+ end
|
604
|
-
+
|
605
|
-
+ instance.tap do |o|
|
606
|
-
+ o.finalize!
|
607
|
-
+ end
|
608
|
-
+ end
|
609
|
-
+
|
610
|
-
+ it "should fail auto_restart validation" do
|
611
|
-
+ expected_error = "en.vagrant_google.config.auto_restart_invalid_on_preemptible"
|
612
|
-
+ errors = subject.validate("foo")["Google Provider"]
|
613
|
-
+ errors.inject(false) { |a, e| a or e.include?(expected_error) }.should == true
|
614
|
-
+ end
|
615
|
-
+
|
616
|
-
+ it "should fail on_host_maintenance validation" do
|
617
|
-
+ expected_error = "en.vagrant_google.config.on_host_maintenance_invalid_on_preemptible"
|
618
|
-
+ errors = subject.validate("foo")["Google Provider"]
|
619
|
-
+ errors.inject(false) { |a, e| a or e.include?(expected_error) }.should == true
|
620
|
-
+ end
|
621
|
-
+ end
|
622
|
-
+ end
|
623
|
-
+end
|
624
|
-
diff -r cc7a47cd4204 tasks/acceptance.rake
|
625
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
626
|
-
+++ b/tasks/acceptance.rake Fri Sep 11 15:11:26 2015 -0700
|
627
|
-
@@ -0,0 +1,52 @@
|
628
|
-
+def colorize(text, color_code)
|
629
|
-
+ puts "\033[#{color_code}m#{text}\033[0m"
|
630
|
-
+end
|
631
|
-
+
|
632
|
-
+{
|
633
|
-
+ :red => 31,
|
634
|
-
+ :green => 32,
|
635
|
-
+ :yellow => 33
|
636
|
-
+}.each do |key, color_code|
|
637
|
-
+ define_method key do |text|
|
638
|
-
+ colorize(text, color_code)
|
639
|
-
+ end
|
640
|
-
+end
|
641
|
-
+
|
642
|
-
+namespace :acceptance do
|
643
|
-
+
|
644
|
-
+ desc "shows components that can be tested separately"
|
645
|
-
+ task :components do
|
646
|
-
+ exec("bundle exec vagrant-spec components")
|
647
|
-
+ end
|
648
|
-
+
|
649
|
-
+ desc "runs acceptance tests using vagrant-spec"
|
650
|
-
+ task :run do
|
651
|
-
+
|
652
|
-
+# yellow "NOTE: For acceptance tests to be functional, correct ssh key needs to be added to GCE metadata."
|
653
|
-
+#
|
654
|
-
+# if !ENV["GOOGLE_JSON_KEY_LOCATION"] && !ENV["GOOGLE_KEY_LOCATION"]
|
655
|
-
+# abort ("Environment variables GOOGLE_JSON_KEY_LOCATION or GOOGLE_KEY_LOCATION are not set. Aborting.")
|
656
|
-
+# end
|
657
|
-
+#
|
658
|
-
+# if !ENV["GOOGLE_PROJECT_ID"]
|
659
|
-
+# abort ("Environment variable GOOGLE_PROJECT_ID is not set. Aborting.")
|
660
|
-
+# end
|
661
|
-
+#
|
662
|
-
+# if !ENV["GOOGLE_CLIENT_EMAIL"]
|
663
|
-
+# abort ("Environment variable GOOGLE_CLIENT_EMAIL is not set. Aborting.")
|
664
|
-
+# end
|
665
|
-
+#
|
666
|
-
+# if !ENV["GOOGLE_SSH_USER"]
|
667
|
-
+# puts "WARNING: GOOGLE_SSH_USER variable is not set. Will try to start tests using insecure Vagrant private key."
|
668
|
-
+# end
|
669
|
-
+
|
670
|
-
+ components = %w(
|
671
|
-
+ halt
|
672
|
-
+ ).map{ |s| "provider/skytap/#{s}" }
|
673
|
-
+
|
674
|
-
+ command = "bundle exec vagrant-spec test --components=#{components.join(" ")}"
|
675
|
-
+ puts command
|
676
|
-
+ puts
|
677
|
-
+ exec(command)
|
678
|
-
+ end
|
679
|
-
+end
|
680
|
-
diff -r cc7a47cd4204 tasks/bundler.rake
|
681
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
682
|
-
+++ b/tasks/bundler.rake Fri Sep 11 15:11:26 2015 -0700
|
683
|
-
@@ -0,0 +1,3 @@
|
684
|
-
+# This installs the tasks that help with gem creation and
|
685
|
-
+# publishing.
|
686
|
-
+Bundler::GemHelper.install_tasks
|
687
|
-
diff -r cc7a47cd4204 tasks/lint.rake
|
688
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
689
|
-
+++ b/tasks/lint.rake Fri Sep 11 15:11:26 2015 -0700
|
690
|
-
@@ -0,0 +1,3 @@
|
691
|
-
+#require 'rubocop/rake_task'
|
692
|
-
+
|
693
|
-
+#RuboCop::RakeTask.new(:lint)
|
694
|
-
diff -r cc7a47cd4204 tasks/test.rake
|
695
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
696
|
-
+++ b/tasks/test.rake Fri Sep 11 15:11:26 2015 -0700
|
697
|
-
@@ -0,0 +1,9 @@
|
698
|
-
+require 'rake/testtask'
|
699
|
-
+require 'rspec/core/rake_task'
|
700
|
-
+
|
701
|
-
+namespace :test do
|
702
|
-
+ RSpec::Core::RakeTask.new(:unit) do |t|
|
703
|
-
+ t.pattern = "test/unit/**/*_test.rb"
|
704
|
-
+ t.rspec_opts = "--color"
|
705
|
-
+ end
|
706
|
-
+end
|
707
|
-
diff -r cc7a47cd4204 vagrant-spec.config.rb
|
708
|
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
709
|
-
+++ b/vagrant-spec.config.rb Fri Sep 11 15:11:26 2015 -0700
|
710
|
-
@@ -0,0 +1,3 @@
|
711
|
-
+Vagrant::Spec::Acceptance.configure do |c|
|
712
|
-
+ # ...
|
713
|
-
+end
|