infrataster 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/{example/.rspec → .rspec} +0 -0
  3. data/CHANGELOG.md +10 -0
  4. data/README.md +27 -1
  5. data/Rakefile +52 -0
  6. data/infrataster.gemspec +5 -1
  7. data/lib/infrataster/contexts/base_context.rb +3 -3
  8. data/lib/infrataster/contexts/capybara_context.rb +2 -2
  9. data/lib/infrataster/contexts/http_context.rb +18 -6
  10. data/lib/infrataster/contexts/mysql_query_context.rb +1 -1
  11. data/lib/infrataster/contexts.rb +7 -7
  12. data/lib/infrataster/helpers/resource_helper.rb +24 -0
  13. data/lib/infrataster/helpers.rb +1 -1
  14. data/lib/infrataster/{types/base_type.rb → resources/base_resource.rb} +3 -3
  15. data/lib/infrataster/{types/capybara_type.rb → resources/capybara_resource.rb} +3 -3
  16. data/lib/infrataster/resources/http_resource.rb +42 -0
  17. data/lib/infrataster/{types/mysql_query_type.rb → resources/mysql_query_resource.rb} +3 -3
  18. data/lib/infrataster/{types/server_type.rb → resources/server_resource.rb} +2 -2
  19. data/lib/infrataster/resources.rb +5 -0
  20. data/lib/infrataster/rspec.rb +1 -1
  21. data/lib/infrataster/server.rb +26 -15
  22. data/lib/infrataster/version.rb +1 -1
  23. data/lib/infrataster.rb +6 -2
  24. data/spec/integration/http_spec.rb +44 -0
  25. data/{example/spec → spec/integration}/spec_helper.rb +3 -10
  26. data/spec/integration/vm/.gitignore +3 -0
  27. data/spec/integration/vm/Berksfile +2 -0
  28. data/spec/integration/vm/Vagrantfile +38 -0
  29. data/{example/sinatra_app → spec/integration/vm/app}/Gemfile +0 -1
  30. data/spec/integration/vm/app/app.rb +39 -0
  31. data/{example/sinatra_app → spec/integration/vm/app}/config.ru +0 -0
  32. data/spec/integration/vm/cookbooks/app/files/default/rackup.conf +3 -0
  33. data/spec/integration/vm/cookbooks/app/recipes/default.rb +35 -0
  34. data/spec/integration/vm/cookbooks/apt-mirror/recipes/default.rb +4 -0
  35. data/spec/integration/vm/cookbooks/proxy/files/default/index.html +1 -0
  36. data/spec/integration/vm/cookbooks/proxy/recipes/default.rb +22 -0
  37. data/spec/integration/vm/cookbooks/proxy/templates/default/integration-test.erb +65 -0
  38. data/spec/unit/lib/infrataster/server_spec.rb +49 -0
  39. data/spec/unit/spec_helper.rb +23 -0
  40. metadata +72 -29
  41. data/example/.gitignore +0 -4
  42. data/example/Berksfile +0 -2
  43. data/example/Gemfile +0 -8
  44. data/example/README.md +0 -13
  45. data/example/Vagrantfile +0 -81
  46. data/example/cookbooks/app/recipes/default.rb +0 -36
  47. data/example/cookbooks/db/files/default/my.cnf +0 -127
  48. data/example/cookbooks/db/recipes/default.rb +0 -14
  49. data/example/cookbooks/proxy/metadata.rb +0 -1
  50. data/example/cookbooks/proxy/recipes/default.rb +0 -26
  51. data/example/cookbooks/proxy/templates/default/app.erb +0 -13
  52. data/example/cookbooks/proxy/templates/default/static.erb +0 -14
  53. data/example/sinatra_app/.gitignore +0 -1
  54. data/example/sinatra_app/app.rb +0 -6
  55. data/example/spec/web_spec.rb +0 -64
  56. data/lib/infrataster/helpers/type_helper.rb +0 -24
  57. data/lib/infrataster/types/http_type.rb +0 -24
  58. data/lib/infrataster/types.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3856ecbc568b65e542d045e1a487276cd8af2d91
4
- data.tar.gz: ec9de90a7d2f8b93b48aa81260414587f008983a
3
+ metadata.gz: b0f55bdccf28c4b1f8550418fec4c53e68bf4462
4
+ data.tar.gz: c81fd723defa93cf29bcd6160b0cde91cf0491c4
5
5
  SHA512:
6
- metadata.gz: 18e6571f13959f66b4b6a98d4df2cd529bfcb4ccc545866463d3ea09320ebc12733a184de1a594aad977091985d9b65f10cad50ad2f267cd715384d596568f16
7
- data.tar.gz: ab7a261a28a0de03bd81c342ae42743c92ee0c89832a13b0a94e7f7de72a4e55fa0cd65227a3cb2f2135c778f6d5695d7bee90643a625db7a6c3b262210d723d
6
+ metadata.gz: 9f1f9c8ae16e732ebdb6002bd0ab41afe1a5e65eea2c7b09eb05b7a0f30b6ec0d51f550bbff1996c2b04a9758fac80a2262617e42cda479296f316e2474b9ad8
7
+ data.tar.gz: e377410f6e398bf4098eeb25562b99c6405ceeb8c6427875fbf4919ff2e8357d72c5916fee8ced00b0b0da24e6a58d426997fa19ad4ebc7412ece03a85166283
File without changes
data/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Infrataster Changelog
2
+
3
+ ## v0.1.1
4
+
5
+ * Http resources accept `method`, `params` and `headers` options. (Issue #7)
6
+
7
+ ## v0.1.0
8
+
9
+ * Initial release
10
+
data/README.md CHANGED
@@ -37,7 +37,7 @@ require 'infrataster/rspec'
37
37
  Infrataster::Server.define(
38
38
  :proxy, # name
39
39
  '192.168.33.10', # ip address
40
- vagrant: true, # for vagrant VM
40
+ vagrant: true # for vagrant VM
41
41
  )
42
42
  Infrataster::Server.define(
43
43
  :app, # name
@@ -124,6 +124,32 @@ end
124
124
 
125
125
  [infrataster/example](example)
126
126
 
127
+ ## How to Run Tests
128
+
129
+ ### Unit Tests
130
+
131
+ ```
132
+ $ bundle exec rake spec:unit
133
+ ```
134
+
135
+ ### Integration Tests
136
+
137
+ Start and provision VMs:
138
+
139
+ ```
140
+ $ bundle exec rake spec:integration:prepare
141
+ ```
142
+
143
+ Run tests:
144
+
145
+ ```
146
+ $ bundle exec rake spec:integration
147
+ ```
148
+
149
+ ## Presentations
150
+
151
+ * https://speakerdeck.com/ryotarai/infrataster-infra-behavior-testing-framework-number-oedo04
152
+
127
153
  ## Contributing
128
154
 
129
155
  1. Fork it ( http://github.com/ryotarai/infrataster/fork )
data/Rakefile CHANGED
@@ -1 +1,53 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ def red(str)
5
+ "\e[31m#{str}\e[m"
6
+ end
7
+
8
+ ENV['VAGRANT_CWD'] = File.expand_path('spec/integration/vm')
9
+
10
+ namespace :spec do
11
+ RSpec::Core::RakeTask.new("unit") do |task|
12
+ task.pattern = "./spec/unit{,/*/**}/*_spec.rb"
13
+ end
14
+
15
+ RSpec::Core::RakeTask.new("integration") do |task|
16
+ task.pattern = "./spec/integration{,/*/**}/*_spec.rb"
17
+ end
18
+
19
+ namespace :integration do
20
+ integration_dir = 'spec/integration'
21
+ task :prepare => ['download_browsermob', 'start_vm'] do
22
+ end
23
+
24
+ task :download_browsermob do
25
+ dir = File.join(integration_dir, 'vm/vendor/browsermob')
26
+ unless Dir.exist?(dir)
27
+ puts red("Downloading browsermob...")
28
+ Dir.mktmpdir do |tmp|
29
+ cmd = "cd #{tmp} && wget -O browsermob-proxy.zip https://s3-us-west-1.amazonaws.com/lightbody-bmp/browsermob-proxy-2.0-beta-9-bin.zip && unzip browsermob-proxy.zip"
30
+ system cmd
31
+ FileUtils.mv(File.join(tmp, 'browsermob-proxy-2.0-beta-9'), dir)
32
+ end
33
+ end
34
+ end
35
+
36
+ task :berks_vendor do
37
+ dir = File.join(integration_dir, 'vm/vendor/cookbooks')
38
+ # Berkshelf
39
+ if Dir.exist?(dir)
40
+ puts red("'#{dir}' already exists. If you want update cookbooks, delete the directory and re-run rake command")
41
+ else
42
+ puts red('Installing cookbooks by berkshelf...')
43
+ system "cd #{integartion_dir} && berks vendor vendor/cookbooks"
44
+ end
45
+ end
46
+
47
+ task :start_vm => ['berks_vendor'] do
48
+ puts red('Starting VM...')
49
+ system '/usr/bin/vagrant up'
50
+ end
51
+ end
52
+ end
53
+
data/infrataster.gemspec CHANGED
@@ -12,7 +12,9 @@ Gem::Specification.new do |spec|
12
12
  spec.homepage = "https://github.com/ryotarai/infrataster"
13
13
  spec.license = "MIT"
14
14
 
15
- spec.files = `git ls-files -z`.split("\x0")
15
+ spec.files = `git ls-files -z`.split("\x0").delete_if do |path|
16
+ path.start_with?('example/')
17
+ end
16
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
20
  spec.require_paths = ["lib"]
@@ -24,7 +26,9 @@ Gem::Specification.new do |spec|
24
26
  spec.add_runtime_dependency "capybara"
25
27
  spec.add_runtime_dependency "selenium-webdriver"
26
28
  spec.add_runtime_dependency "browsermob-proxy"
29
+ spec.add_runtime_dependency "faraday"
27
30
 
28
31
  spec.add_development_dependency "bundler", "~> 1.5"
29
32
  spec.add_development_dependency "rake"
33
+ spec.add_development_dependency "berkshelf", '~> 3.1.1'
30
34
  end
@@ -2,11 +2,11 @@ module Infrataster
2
2
  module Contexts
3
3
  class BaseContext
4
4
  attr_reader :server
5
- attr_reader :type
5
+ attr_reader :resource
6
6
 
7
- def initialize(server, type)
7
+ def initialize(server, resource)
8
8
  @server = server
9
- @type = type
9
+ @resource = resource
10
10
  end
11
11
  end
12
12
  end
@@ -14,7 +14,7 @@ module Infrataster
14
14
  def session
15
15
  return @session if @session
16
16
 
17
- address, port, @gateway_finalize_proc = server.from_gateway(type.uri.port)
17
+ address, port, @gateway_finalize_proc = server.from_gateway_open(resource.uri.port)
18
18
  Capybara.app_host = "http://#{address}:#{port}"
19
19
  @session = Capybara::Session.new(capybara_driver_name)
20
20
  end
@@ -38,7 +38,7 @@ module Infrataster
38
38
  private
39
39
  def register_capybara_driver
40
40
  proxy = BrowsermobProxy.server.create_proxy
41
- proxy.header({"Host" => type.uri.host})
41
+ proxy.header({"Host" => resource.uri.host})
42
42
 
43
43
  profile = Selenium::WebDriver::Firefox::Profile.new
44
44
  profile.proxy = proxy.selenium_proxy
@@ -1,15 +1,27 @@
1
- require 'net/http'
2
- require 'net/https'
1
+ require 'faraday'
3
2
 
4
3
  module Infrataster
5
4
  module Contexts
6
5
  class HttpContext < BaseContext
7
6
  def response
8
- req = Net::HTTP::Get.new('/', {'Host' => type.uri.host})
7
+ server.from_gateway(resource.uri.port) do |address, port|
8
+ url = "#{resource.uri.scheme}://#{address}:#{port}"
9
9
 
10
- server.from_gateway(type.uri.port) do |address, port|
11
- Net::HTTP.start(address, port) do |http|
12
- http.request(req)
10
+ conn = Faraday.new(:url => url) do |faraday|
11
+ faraday.request :url_encoded
12
+ faraday.response :logger, Logger
13
+ faraday.adapter Faraday.default_adapter
14
+ end
15
+
16
+ conn.public_send(resource.method) do |req|
17
+ resource.params.each_pair do |k, v|
18
+ req.params[k] = v
19
+ end
20
+ req.headers['Host'] = resource.uri.host
21
+ resource.headers.each_pair do |k, v|
22
+ req.headers[k] = v
23
+ end
24
+ req.url resource.uri.path
13
25
  end
14
26
  end
15
27
  end
@@ -16,7 +16,7 @@ module Infrataster
16
16
  username: options[:user],
17
17
  password: options[:password],
18
18
  )
19
- client.query(type.query)
19
+ client.query(resource.query)
20
20
  end
21
21
  end
22
22
  end
@@ -1,4 +1,4 @@
1
- require 'infrataster/types'
1
+ require 'infrataster/resources'
2
2
  require 'infrataster/contexts/base_context'
3
3
  require 'infrataster/contexts/http_context'
4
4
  require 'infrataster/contexts/mysql_query_context'
@@ -10,21 +10,21 @@ module Infrataster
10
10
  def from_example(example)
11
11
  example_group = example.metadata[:example_group]
12
12
 
13
- server = find_described(Types::ServerType, example_group).server
14
- type = find_described(Types::BaseType, example_group)
13
+ server = find_described(Resources::ServerResource, example_group).server
14
+ resource = find_described(Resources::BaseResource, example_group)
15
15
 
16
- type.context_class.new(server, type)
16
+ resource.context_class.new(server, resource)
17
17
  end
18
18
 
19
19
  private
20
- def find_described(type_class, example_group)
20
+ def find_described(resource_class, example_group)
21
21
  arg = example_group[:description_args].first
22
- if arg.is_a?(type_class)
22
+ if arg.is_a?(resource_class)
23
23
  arg
24
24
  else
25
25
  parent_example_group = example_group[:example_group]
26
26
  if parent_example_group
27
- find_described(type_class, parent_example_group)
27
+ find_described(resource_class, parent_example_group)
28
28
  else
29
29
  raise Error
30
30
  end
@@ -0,0 +1,24 @@
1
+ require 'infrataster/resources'
2
+
3
+ module Infrataster
4
+ module Helpers
5
+ module ResourceHelper
6
+ def server(*args)
7
+ Resources::ServerResource.new(*args)
8
+ end
9
+
10
+ def http(*args)
11
+ Resources::HttpResource.new(*args)
12
+ end
13
+
14
+ def mysql_query(*args)
15
+ Resources::MysqlQueryResource.new(*args)
16
+ end
17
+
18
+ def capybara(*args)
19
+ Resources::CapybaraResource.new(*args)
20
+ end
21
+ end
22
+ end
23
+ end
24
+
@@ -1,4 +1,4 @@
1
- require 'infrataster/helpers/type_helper'
1
+ require 'infrataster/helpers/resource_helper'
2
2
  require 'infrataster/helpers/rspec_helper'
3
3
 
4
4
 
@@ -1,9 +1,9 @@
1
1
  module Infrataster
2
- module Types
3
- class BaseType
2
+ module Resources
3
+ class BaseResource
4
4
  # do nothing
5
5
  def name
6
- self.class.name.split('::').last[0...-4]
6
+ self.class.name.split('::').last[0...(-1 * 'Resource'.size)]
7
7
  end
8
8
 
9
9
  def context_class
@@ -1,9 +1,9 @@
1
- require 'infrataster/types/base_type'
1
+ require 'infrataster/resources/base_resource'
2
2
  require 'uri'
3
3
 
4
4
  module Infrataster
5
- module Types
6
- class CapybaraType < BaseType
5
+ module Resources
6
+ class CapybaraResource < BaseResource
7
7
  Error = Class.new(StandardError)
8
8
 
9
9
  attr_reader :uri
@@ -0,0 +1,42 @@
1
+ require 'infrataster/resources/base_resource'
2
+ require 'uri'
3
+
4
+ module Infrataster
5
+ module Resources
6
+ class HttpResource < BaseResource
7
+ Error = Class.new(StandardError)
8
+
9
+ attr_reader :uri, :options
10
+
11
+ def initialize(url_str, options = {})
12
+ @options = {params: {}, method: :get, headers: {}}.merge(options)
13
+ @uri = URI.parse(url_str)
14
+ unless %w!http https!.include?(@uri.scheme)
15
+ raise Error, "The provided url, '#{@uri}', is not http or https."
16
+ end
17
+ end
18
+
19
+ def to_s
20
+ "http '#{@uri}' with #{@options}"
21
+ end
22
+
23
+ def params
24
+ @options[:params]
25
+ end
26
+
27
+ def method
28
+ valid_methods = [:get, :head, :delete, :post, :put, :patch]
29
+ unless valid_methods.include?(@options[:method])
30
+ raise Error, "#{@options[:method]} is not supported HTTP method."
31
+ end
32
+
33
+ @options[:method]
34
+ end
35
+
36
+ def headers
37
+ @options[:headers]
38
+ end
39
+ end
40
+ end
41
+ end
42
+
@@ -1,8 +1,8 @@
1
- require 'infrataster/types/base_type'
1
+ require 'infrataster/resources/base_resource'
2
2
 
3
3
  module Infrataster
4
- module Types
5
- class MysqlQueryType < BaseType
4
+ module Resources
5
+ class MysqlQueryResource < BaseResource
6
6
  Error = Class.new(StandardError)
7
7
 
8
8
  attr_reader :query
@@ -1,6 +1,6 @@
1
1
  module Infrataster
2
- module Types
3
- class ServerType
2
+ module Resources
3
+ class ServerResource
4
4
  Error = Class.new(StandardError)
5
5
 
6
6
  attr_reader :name
@@ -0,0 +1,5 @@
1
+ require 'infrataster/resources/base_resource'
2
+ require 'infrataster/resources/server_resource'
3
+ require 'infrataster/resources/http_resource'
4
+ require 'infrataster/resources/mysql_query_resource'
5
+ require 'infrataster/resources/capybara_resource'
@@ -1,7 +1,7 @@
1
1
  require 'infrataster'
2
2
  require 'rspec'
3
3
 
4
- include Infrataster::Helpers::TypeHelper
4
+ include Infrataster::Helpers::ResourceHelper
5
5
 
6
6
  RSpec.configure do |config|
7
7
  config.include Infrataster::Helpers::RSpecHelper
@@ -8,12 +8,19 @@ module Infrataster
8
8
  Error = Class.new(StandardError)
9
9
 
10
10
  class << self
11
- @@servers = []
12
11
 
13
12
  def define(*args)
14
13
  @@servers << Server.new(*args)
15
14
  end
16
15
 
16
+ def defined_servers
17
+ @@servers
18
+ end
19
+
20
+ def clear_defined_servers
21
+ @@servers = []
22
+ end
23
+
17
24
  def find_by_name(name)
18
25
  server = @@servers.find {|s| s.name == name }
19
26
  unless server
@@ -22,6 +29,7 @@ module Infrataster
22
29
  server
23
30
  end
24
31
 
32
+ Server.clear_defined_servers
25
33
  end
26
34
 
27
35
  attr_reader :name, :address, :options
@@ -70,24 +78,24 @@ module Infrataster
70
78
  end
71
79
  end
72
80
 
81
+ def from_gateway_open(port)
82
+ if from
83
+ new_port, finalize_proc = from.gateway_open(@address, port)
84
+ Logger.debug("tunnel: localhost:#{new_port} -> #{from.address} -> #{@address}:#{port}")
85
+ ['127.0.0.1', new_port, finalize_proc]
86
+ else
87
+ [@address, port, nil]
88
+ end
89
+ end
90
+
73
91
  def from_gateway(port)
74
92
  if from
75
- if block_given?
76
- from.gateway_open(@address, port) do |new_port|
77
- Logger.debug("tunnel: localhost:#{new_port} -> #{from.address} -> #{@address}:#{port}")
78
- yield '127.0.0.1', new_port
79
- end
80
- else
81
- new_port, finalize_proc = from.gateway_open(@address, port)
93
+ from.gateway_open(@address, port) do |new_port|
82
94
  Logger.debug("tunnel: localhost:#{new_port} -> #{from.address} -> #{@address}:#{port}")
83
- ['127.0.0.1', new_port, finalize_proc]
95
+ yield '127.0.0.1', new_port
84
96
  end
85
97
  else
86
- if block_given?
87
- yield @address, port
88
- else
89
- [@address, port, nil]
90
- end
98
+ yield @address, port
91
99
  end
92
100
  end
93
101
 
@@ -111,7 +119,10 @@ module Infrataster
111
119
 
112
120
  Dir.mktmpdir do |dir|
113
121
  output = File.join(dir, 'ssh-config')
114
- system("/usr/bin/vagrant ssh-config #{vagrant_name} > #{output}")
122
+ `/usr/bin/vagrant ssh-config #{vagrant_name} > #{output}`
123
+ if $?.exitstatus != 0
124
+ raise Error, "`vagrant ssh-config` failed. Please check if VMs are running or not."
125
+ end
115
126
  config = Net::SSH::Config.for(@name.to_s, [output])
116
127
  end
117
128
  else
@@ -1,3 +1,3 @@
1
1
  module Infrataster
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/infrataster.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require "infrataster/version"
2
- require "infrataster/types"
2
+ require "infrataster/resources"
3
3
  require "infrataster/server"
4
4
  require "infrataster/helpers"
5
5
  require "infrataster/browsermob_proxy"
@@ -8,5 +8,9 @@ require 'logger'
8
8
 
9
9
  module Infrataster
10
10
  Logger = ::Logger.new($stdout)
11
- Logger.level = ::Logger::ERROR
11
+ if ENV['INFRATASTER_LOG']
12
+ Logger.level = ::Logger.const_get(ENV['INFRATASTER_LOG'].upcase)
13
+ else
14
+ Logger.level = ::Logger::ERROR
15
+ end
12
16
  end
@@ -0,0 +1,44 @@
1
+ require 'integration/spec_helper'
2
+ require 'json'
3
+
4
+ describe server(:proxy) do
5
+ describe http('http://app.example.com') do
6
+ it "sends GET request with Host header" do
7
+ expect(response.body).to include('app')
8
+ end
9
+ end
10
+
11
+ describe http('http://static.example.com') do
12
+ it "sends GET request with Host header" do
13
+ expect(response.body).to include('static')
14
+ end
15
+ end
16
+ end
17
+
18
+ describe server(:app) do
19
+ let(:body_as_json) { JSON.parse(response.body) }
20
+
21
+ describe http('http://app.example.com') do
22
+ it "sends GET request" do
23
+ expect(response.body).to include('app')
24
+ end
25
+ end
26
+
27
+ describe http('http://app.example.com', params: {'foo' => 'bar'}, headers: {'USER' => 'VALUE'}) do
28
+ it "sends GET request with params" do
29
+ expect(body_as_json['method']).to eq('GET')
30
+ expect(body_as_json['params']).to eq({"foo" => "bar"})
31
+ expect(body_as_json['headers']['USER']).to eq('VALUE')
32
+ end
33
+ end
34
+
35
+ describe http('http://app.example.com', method: :post, params: {'foo' => 'bar'}, headers: {'USER' => 'VALUE'}) do
36
+ it "sends POST request with params" do
37
+ expect(body_as_json['method']).to eq('POST')
38
+ expect(body_as_json['params']).to eq({"foo" => "bar"})
39
+ expect(body_as_json['headers']['USER']).to eq('VALUE')
40
+ end
41
+ end
42
+ end
43
+
44
+
@@ -2,24 +2,17 @@ require 'infrataster/rspec'
2
2
 
3
3
  Infrataster::Server.define(
4
4
  :proxy,
5
- '192.168.33.10',
5
+ '192.168.44.10',
6
6
  vagrant: true,
7
7
  )
8
8
  Infrataster::Server.define(
9
9
  :app,
10
- '172.16.33.11',
10
+ '172.16.44.11',
11
11
  vagrant: true,
12
12
  from: :proxy
13
13
  )
14
- Infrataster::Server.define(
15
- :db,
16
- '172.16.33.12',
17
- vagrant: true,
18
- from: :app,
19
- mysql: {user: 'app', password: 'app'}
20
- )
21
14
 
22
- Infrataster::BrowsermobProxy.bin_path = File.expand_path('../../../vendor/browsermob-proxy/bin/browsermob-proxy', __FILE__)
15
+ Infrataster::BrowsermobProxy.bin_path = File.expand_path('../vm/vendor/browsermob/bin/browsermob-proxy', __FILE__)
23
16
 
24
17
  RSpec.configure do |config|
25
18
  config.treat_symbols_as_metadata_keys_with_true_values = true
@@ -0,0 +1,3 @@
1
+ vendor/*
2
+ .vagrant
3
+ Berksfile.lock
@@ -0,0 +1,2 @@
1
+ source "http://api.berkshelf.com"
2
+ cookbook 'apt'
@@ -0,0 +1,38 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5
+ VAGRANTFILE_API_VERSION = "2"
6
+ COOKBOOK_PATH = ['./cookbooks', './vendor/cookbooks']
7
+
8
+ INTERNAL_ADDRESSES = {
9
+ 'proxy' => '172.16.44.10',
10
+ 'app' => '172.16.44.11',
11
+ }
12
+
13
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
14
+ config.vm.box = "hashicorp/precise64"
15
+
16
+ config.vm.define :proxy do |c|
17
+ c.vm.network "private_network", ip: "192.168.44.10"
18
+ c.vm.network "private_network", ip: INTERNAL_ADDRESSES['proxy'], virtualbox__intnet: "infrataster-integration-test"
19
+
20
+ c.vm.provision "chef_solo" do |chef|
21
+ chef.cookbooks_path = COOKBOOK_PATH
22
+ chef.add_recipe "apt-mirror"
23
+ chef.add_recipe "proxy"
24
+ chef.json = {'addresses' => INTERNAL_ADDRESSES}
25
+ end
26
+ end
27
+
28
+ config.vm.define :app do |c|
29
+ c.vm.network "private_network", ip: INTERNAL_ADDRESSES['app'], virtualbox__intnet: "infrataster-integration-test"
30
+
31
+ c.vm.provision "chef_solo" do |chef|
32
+ chef.cookbooks_path = COOKBOOK_PATH
33
+ chef.add_recipe "apt-mirror"
34
+ chef.add_recipe "app"
35
+ chef.json = {'addresses' => INTERNAL_ADDRESSES}
36
+ end
37
+ end
38
+ end
@@ -1,5 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'sinatra'
4
- gem 'thin'
5
4