vcloud-tools-tester 0.0.1

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/.gitignore ADDED
@@ -0,0 +1 @@
1
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 HM Government (Government Digital Service)
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # vCloud Tools Tester
2
+
3
+ The integration tests for [vCloud Tools](https://github.com/alphagov/vcloud-tools) require a lot of parameters that are specific to your environment, and not ones you want to make public.
4
+
5
+ vCloud tools Tester makes it easy to run the vCloud Tools integration tests using a config file.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'vcloud-tools-tester'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install vcloud-tools-tester
20
+
21
+ ## Usage
22
+
23
+ TODO
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require 'rspec/core/rake_task'
2
+
3
+ task :default => [:spec]
4
+
5
+ RSpec::Core::RakeTask.new(:spec) do |task|
6
+ task.pattern = FileList['spec/vcloud/**/*_spec.rb']
7
+ end
8
+
9
+ require 'gem_publisher'
10
+ task :publish_gem do
11
+ gem = GemPublisher.publish_if_updated("vcloud-tools-tester.gemspec", :rubygems)
12
+ puts "Published #{gem}" if gem
13
+ end
data/jenkins.sh ADDED
@@ -0,0 +1,4 @@
1
+ bundle install --path "${HOME}/bundles/${JOB_NAME}"
2
+
3
+ bundle exec rake
4
+ bundle exec rake publish_gem
@@ -0,0 +1,2 @@
1
+ require "vcloud/tools/tester/version"
2
+ require "vcloud/tools/tester/test_parameters"
@@ -0,0 +1,73 @@
1
+ require 'yaml'
2
+
3
+ module Vcloud
4
+ module Tools
5
+ module Tester
6
+ class TestParameters
7
+
8
+ def initialize(config_file)
9
+ load_config(config_file)
10
+ end
11
+
12
+ def load_config(config_file)
13
+ organization = ENV['FOG_CREDENTIAL']
14
+ all_config = YAML::load(File.open(config_file))
15
+ @input_config = all_config[organization]
16
+ end
17
+
18
+ def vdc_1_name
19
+ @input_config["vdc_1_name"]
20
+ end
21
+
22
+ def vdc_2_name
23
+ @input_config["vdc_2_name"]
24
+ end
25
+
26
+ def catalog
27
+ @input_config["catalog"]
28
+ end
29
+
30
+ def vapp_template
31
+ @input_config["vapp_template"]
32
+ end
33
+
34
+ def network1
35
+ @input_config["network1"]
36
+ end
37
+
38
+ def network1_ip
39
+ @input_config["network1_ip"]
40
+ end
41
+
42
+ def network2
43
+ @input_config["network2"]
44
+ end
45
+
46
+ def network2_ip
47
+ @input_config["network2_ip"]
48
+ end
49
+
50
+ def storage_profile
51
+ @input_config["storage_profile"]
52
+ end
53
+
54
+ def default_storage_profile_name
55
+ @input_config["default_storage_profile_name"]
56
+ end
57
+
58
+ def default_storage_profile_href
59
+ @input_config["default_storage_profile_href"]
60
+ end
61
+
62
+ def vdc_1_storage_profile_href
63
+ @input_config["vdc_1_storage_profile_href"]
64
+ end
65
+
66
+ def vdc_2_storage_profile_href
67
+ @input_config["vdc_2_storage_profile_href"]
68
+ end
69
+
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,7 @@
1
+ module Vcloud
2
+ module Tools
3
+ module Tester
4
+ VERSION = "0.0.1"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ test-organisation:
2
+ vdc_1_name: "test-vdc-name"
3
+ catalog: "test-catalog"
4
+ vapp_template: "test-catalog-item"
5
+ network1: "test-network1"
6
+ network1_ip: "test-network1-ip"
7
+ network2: "test-network1"
8
+ network2_ip: "test-network2-ip"
9
+ storage_profile: "test-storage-profile"
10
+
11
+ other-organisation:
12
+ vdc_1_name: "other-vdc-name"
@@ -0,0 +1,14 @@
1
+ launcher-testing-organisation:
2
+ vdc_1_name: "launcher-vdc-1-name"
3
+ vdc_2_name: "launcher-vdc-2-name"
4
+ catalog: "launcher-catalog"
5
+ vapp_template: "launcher-vapp-template"
6
+ network1: "launcher-network-1"
7
+ network1_ip: "launcher-network-1-ip"
8
+ network2: "launcher-network-2"
9
+ network2_ip: "launcher-network-2-ip"
10
+ storage_profile: "launcher-storage-profile"
11
+ default_storage_profile_name: "launcher-default-sp-name"
12
+ default_storage_profile_href: "launcher-default-sp-href"
13
+ vdc_1_storage_profile_href: "launcher-vdc-1-sp-href"
14
+ vdc_2_storage_profile_href: "launcher-vdc-2-sp-href"
@@ -0,0 +1,2 @@
1
+ "minimal-organisation":
2
+ vdc_1_name: "minimal-vdc-name"
@@ -0,0 +1,89 @@
1
+ require 'vcloud/tools/tester'
2
+
3
+ module Vcloud::Tools::Tester
4
+
5
+ describe TestParameters do
6
+
7
+ before(:all) do
8
+ @data_dir = File.join(File.dirname(__FILE__), "/data")
9
+ end
10
+
11
+ context "loading config file" do
12
+
13
+ it "loads input yaml when intialized" do
14
+ ENV['FOG_CREDENTIAL'] = 'test-organisation'
15
+ parameters = TestParameters.new("#{@data_dir}/test_config.yaml")
16
+ test_vdc = parameters.vdc_1_name
17
+ expect(test_vdc).to eq("test-vdc-name")
18
+ end
19
+
20
+ it "loads a different organization's yaml when env var changes" do
21
+ ENV['FOG_CREDENTIAL'] = 'other-organisation'
22
+ parameters = TestParameters.new("#{@data_dir}/test_config.yaml")
23
+ test_vdc = parameters.vdc_1_name
24
+ expect(test_vdc).to eq("other-vdc-name")
25
+ end
26
+
27
+ it "input yaml file can be changed" do
28
+ ENV['FOG_CREDENTIAL'] = 'minimal-organisation'
29
+ parameters = TestParameters.new("#{@data_dir}/test_minimal_config.yaml")
30
+ test_vdc = parameters.vdc_1_name
31
+ expect(test_vdc).to eq("minimal-vdc-name")
32
+ end
33
+
34
+ end
35
+
36
+ context "parameters required for integration tests" do
37
+
38
+ it "contains all the parameters required for the vCloud Launcher tests" do
39
+ ENV['FOG_CREDENTIAL'] = "launcher-testing-organisation"
40
+ parameters = TestParameters.new("#{@data_dir}/test_launcher_config.yaml")
41
+
42
+ test_vdc_1_name = parameters.vdc_1_name
43
+ expect(test_vdc_1_name).to eq("launcher-vdc-1-name")
44
+
45
+ test_vdc_2_name = parameters.vdc_2_name
46
+ expect(test_vdc_2_name).to eq("launcher-vdc-2-name")
47
+
48
+ test_catalog = parameters.catalog
49
+ expect(test_catalog).to eq("launcher-catalog")
50
+
51
+ test_vapp_template = parameters.vapp_template
52
+ expect(test_vapp_template).to eq("launcher-vapp-template")
53
+
54
+ test_network_1 = parameters.network1
55
+ expect(test_network_1).to eq("launcher-network-1")
56
+
57
+ test_network_1_ip = parameters.network1_ip
58
+ expect(test_network_1_ip).to eq("launcher-network-1-ip")
59
+
60
+ test_network_2 = parameters.network2
61
+ expect(test_network_2).to eq("launcher-network-2")
62
+
63
+ test_network_2_ip = parameters.network2_ip
64
+ expect(test_network_2_ip).to eq("launcher-network-2-ip")
65
+
66
+ test_storage_profile = parameters.storage_profile
67
+ expect(test_storage_profile).to eq("launcher-storage-profile")
68
+
69
+ test_default_storage_profile_name = parameters.default_storage_profile_name
70
+ expect(test_default_storage_profile_name).to eq("launcher-default-sp-name")
71
+
72
+ test_default_storage_profile_href = parameters.default_storage_profile_href
73
+ expect(test_default_storage_profile_href).to eq("launcher-default-sp-href")
74
+
75
+ test_vdc_1_storage_profile_href = parameters.vdc_1_storage_profile_href
76
+ expect(test_vdc_1_storage_profile_href).to eq("launcher-vdc-1-sp-href")
77
+
78
+ test_vdc_2_storage_profile_href = parameters.vdc_2_storage_profile_href
79
+ expect(test_vdc_2_storage_profile_href).to eq("launcher-vdc-2-sp-href")
80
+ end
81
+
82
+ end
83
+
84
+ after(:each) do
85
+ ENV.delete('FOG_CREDENTIAL')
86
+ end
87
+
88
+ end
89
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vcloud/tools/tester/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vcloud-tools-tester"
8
+ spec.version = Vcloud::Tools::Tester::VERSION
9
+ spec.authors = ["Anna Shipman"]
10
+ spec.email = ["anna.shipman@digital.cabinet-office.gov.uk"]
11
+ spec.description = %q{Tool to facilitate testing of vCloud Tools}
12
+ spec.summary = %q{vCloud Tools integration tests require secret parameters. This helps you manage them.}
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency 'gem_publisher', '1.2.0'
21
+ spec.add_development_dependency 'rake'
22
+ spec.add_development_dependency 'rspec', '~> 2.14.1'
23
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vcloud-tools-tester
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Anna Shipman
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-05-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: gem_publisher
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - '='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.2.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - '='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.2.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 2.14.1
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.14.1
62
+ description: Tool to facilitate testing of vCloud Tools
63
+ email:
64
+ - anna.shipman@digital.cabinet-office.gov.uk
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - .gitignore
70
+ - Gemfile
71
+ - LICENSE.txt
72
+ - README.md
73
+ - Rakefile
74
+ - jenkins.sh
75
+ - lib/vcloud/tools/tester.rb
76
+ - lib/vcloud/tools/tester/test_parameters.rb
77
+ - lib/vcloud/tools/tester/version.rb
78
+ - spec/vcloud/tools/tester/data/test_config.yaml
79
+ - spec/vcloud/tools/tester/data/test_launcher_config.yaml
80
+ - spec/vcloud/tools/tester/data/test_minimal_config.yaml
81
+ - spec/vcloud/tools/tester/test_parameters_spec.rb
82
+ - vcloud-tools-tester.gemspec
83
+ homepage:
84
+ licenses:
85
+ - MIT
86
+ post_install_message:
87
+ rdoc_options: []
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ segments:
97
+ - 0
98
+ hash: 2485846201161240817
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ segments:
106
+ - 0
107
+ hash: 2485846201161240817
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 1.8.23
111
+ signing_key:
112
+ specification_version: 3
113
+ summary: vCloud Tools integration tests require secret parameters. This helps you
114
+ manage them.
115
+ test_files:
116
+ - spec/vcloud/tools/tester/data/test_config.yaml
117
+ - spec/vcloud/tools/tester/data/test_launcher_config.yaml
118
+ - spec/vcloud/tools/tester/data/test_minimal_config.yaml
119
+ - spec/vcloud/tools/tester/test_parameters_spec.rb