vcloud-tools-tester 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -13,9 +13,13 @@ module Vcloud
|
|
13
13
|
unless File.exist?(config_file)
|
14
14
|
raise ArgumentError.new("Missing required file: #{config_file}")
|
15
15
|
end
|
16
|
-
organization = ENV
|
16
|
+
organization = ENV.fetch('FOG_CREDENTIAL') do
|
17
|
+
raise "Must set FOG_CREDENTIAL envvar"
|
18
|
+
end
|
17
19
|
all_config = YAML::load(File.open(config_file))
|
18
|
-
@input_config = all_config
|
20
|
+
@input_config = all_config.fetch(organization) do
|
21
|
+
raise "Invalid FOG_CREDENTIAL value '#{organization}'"
|
22
|
+
end
|
19
23
|
end
|
20
24
|
|
21
25
|
def vdc_1_name
|
@@ -70,6 +74,22 @@ module Vcloud
|
|
70
74
|
@input_config["vdc_2_storage_profile_href"]
|
71
75
|
end
|
72
76
|
|
77
|
+
def edge_gateway
|
78
|
+
@input_config["edge_gateway"]
|
79
|
+
end
|
80
|
+
|
81
|
+
def provider_network
|
82
|
+
@input_config["provider_network"]
|
83
|
+
end
|
84
|
+
|
85
|
+
def provider_network_id
|
86
|
+
@input_config["provider_network_id"]
|
87
|
+
end
|
88
|
+
|
89
|
+
def provider_network_ip
|
90
|
+
@input_config["provider_network_ip"]
|
91
|
+
end
|
92
|
+
|
73
93
|
end
|
74
94
|
end
|
75
95
|
end
|
@@ -11,28 +11,42 @@ module Vcloud::Tools::Tester
|
|
11
11
|
context "loading config file" do
|
12
12
|
|
13
13
|
it "loads input yaml when intialized" do
|
14
|
-
ENV
|
14
|
+
stub_const('ENV', {'FOG_CREDENTIAL' => 'test-organisation'})
|
15
15
|
parameters = TestParameters.new("#{@data_dir}/test_config.yaml")
|
16
16
|
test_vdc = parameters.vdc_1_name
|
17
17
|
expect(test_vdc).to eq("test-vdc-name")
|
18
18
|
end
|
19
19
|
|
20
20
|
it "loads a different organization's yaml when env var changes" do
|
21
|
-
ENV
|
21
|
+
stub_const('ENV', {'FOG_CREDENTIAL' => 'other-organisation'})
|
22
22
|
parameters = TestParameters.new("#{@data_dir}/test_config.yaml")
|
23
23
|
test_vdc = parameters.vdc_1_name
|
24
24
|
expect(test_vdc).to eq("other-vdc-name")
|
25
25
|
end
|
26
26
|
|
27
27
|
it "input yaml file can be changed" do
|
28
|
-
ENV
|
28
|
+
stub_const('ENV', {'FOG_CREDENTIAL' => 'minimal-organisation'})
|
29
29
|
parameters = TestParameters.new("#{@data_dir}/test_minimal_config.yaml")
|
30
30
|
test_vdc = parameters.vdc_1_name
|
31
31
|
expect(test_vdc).to eq("minimal-vdc-name")
|
32
32
|
end
|
33
33
|
|
34
|
+
it "gives a useful error when FOG_CREDENTIAL is unset" do
|
35
|
+
stub_const('ENV', {})
|
36
|
+
expect {
|
37
|
+
TestParameters.new("#{@data_dir}/test_minimal_config.yaml")
|
38
|
+
}.to raise_error(RuntimeError, /Must set FOG_CREDENTIAL envvar/)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "gives a useful error when the FOG_CREDENTIAL is missing from the config" do
|
42
|
+
stub_const('ENV', {'FOG_CREDENTIAL' => 'bogus-fog-credential'})
|
43
|
+
expect {
|
44
|
+
TestParameters.new("#{@data_dir}/test_config.yaml")
|
45
|
+
}.to raise_error(RuntimeError, /Invalid FOG_CREDENTIAL value/)
|
46
|
+
end
|
47
|
+
|
34
48
|
it "gives a useful error when there is no config file" do
|
35
|
-
ENV
|
49
|
+
stub_const('ENV', {'FOG_CREDENTIAL' => 'minimal-organisation'})
|
36
50
|
expect {
|
37
51
|
TestParameters.new("#{@data_dir}/non_existent_testing_config.yaml")
|
38
52
|
}.to raise_error(ArgumentError, /Missing required file/)
|
@@ -88,9 +102,5 @@ module Vcloud::Tools::Tester
|
|
88
102
|
|
89
103
|
end
|
90
104
|
|
91
|
-
after(:each) do
|
92
|
-
ENV.delete('FOG_CREDENTIAL')
|
93
|
-
end
|
94
|
-
|
95
105
|
end
|
96
106
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vcloud-tools-tester
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-05-
|
12
|
+
date: 2014-05-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rubocop
|
@@ -83,6 +83,7 @@ extensions: []
|
|
83
83
|
extra_rdoc_files: []
|
84
84
|
files:
|
85
85
|
- .gitignore
|
86
|
+
- .travis.yml
|
86
87
|
- CHANGELOG.md
|
87
88
|
- Gemfile
|
88
89
|
- LICENSE.txt
|
@@ -112,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
113
|
version: '0'
|
113
114
|
segments:
|
114
115
|
- 0
|
115
|
-
hash: -
|
116
|
+
hash: -658210485675310826
|
116
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
118
|
none: false
|
118
119
|
requirements:
|
@@ -121,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
122
|
version: '0'
|
122
123
|
segments:
|
123
124
|
- 0
|
124
|
-
hash: -
|
125
|
+
hash: -658210485675310826
|
125
126
|
requirements: []
|
126
127
|
rubyforge_project:
|
127
128
|
rubygems_version: 1.8.23
|