Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specs don't work #22

Closed
justinstoller opened this issue Jun 1, 2016 · 6 comments
Closed

specs don't work #22

justinstoller opened this issue Jun 1, 2016 · 6 comments

Comments

@justinstoller
Copy link
Member

Went to write a simple PR (show tags in list --active if they exist), but the specs fail on a clean checkout.

Tried rolling back the version of Webmock (doing a bundle install delivered me a warning that the API had changed recently) but they also fail on 1.24.6 of the library as well. Don't know if I should keep trying to roll back and hopefully find a version that works or if there are actual breakages to resolve.

@justinstoller
Copy link
Member Author

Example output after updating the Gemfile to:
gem 'webmock, '~> 1.0'

08:38:56 hobo:vmfloaty justin (show-tags *) ‖ bundle exec rspec spec/

Pooler
  #get_token
    returns a token from vmpooler (FAILED - 1)
  #delete_token
    deletes the specified token (FAILED - 2)
  #token_status
    checks the status of a token (FAILED - 3)

Pooler
  #list
    returns a hash with operating systems from the pooler
    filters operating systems based on the filter param
    returns nothing if the filter does not match
  #retrieve
    retrieves a single vm with a token (FAILED - 4)
    retrieves a multiple vms with a token (FAILED - 5)
  #modify
    modifies the TTL of a vm (FAILED - 6)
  #delete
    deletes a specified vm
  #staus
    prints the status (FAILED - 7)
  #query
    makes a query about a vm (FAILED - 8)
  #snapshot
    makes a snapshot for a single vm (FAILED - 9)
  #revert
    makes a request to revert a vm from a snapshot (FAILED - 10)

Utils
  #get_hosts
    formats a hostname hash into os, hostnames, and domain name
  #generate_os_hash
    takes an array of os arguments and returns a formatted hash
    returns an empty hash if there are no arguments provided

Failures:

  1) Pooler#get_token returns a token from vmpooler
     Failure/Error: resp = conn.post "token"

     WebMock::NetConnectNotAllowedError:
       Real HTTP connections are disabled. Unregistered request: POST https://first.last:[email protected]/token with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'0', 'User-Agent'=>'Faraday v0.9.2'}

       You can stub this request with the following snippet:

       stub_request(:post, "https://first.last:[email protected]/token").
         with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'0', 'User-Agent'=>'Faraday v0.9.2'}).
         to_return(:status => 200, :body => "", :headers => {})

       registered request stubs:

       stub_request(:post, "https://first.last:[email protected]/token").
         with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'0', 'User-Agent'=>'Faraday v0.9.1'})

       ============================================================
     # ./.bundle/gems/gems/webmock-1.24.6/lib/webmock/http_lib_adapters/net_http.rb:114:in `request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:82:in `perform_request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:40:in `block in call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:87:in `with_net_http_connection'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:32:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/request/authorization.rb:38:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb:15:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:177:in `post'
     # ./lib/vmfloaty/auth.rb:9:in `get_token'
     # ./spec/vmfloaty/auth_spec.rb:20:in `block (3 levels) in <top (required)>'

  2) Pooler#delete_token deletes the specified token
     Failure/Error: response = conn.delete "token/#{token}"

     WebMock::NetConnectNotAllowedError:
       Real HTTP connections are disabled. Unregistered request: DELETE https://first.last:[email protected]/token/utpg2i2xswor6h8ttjhu3d47z53yy47y with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}

       You can stub this request with the following snippet:

       stub_request(:delete, "https://first.last:[email protected]/token/utpg2i2xswor6h8ttjhu3d47z53yy47y").
         with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}).
         to_return(:status => 200, :body => "", :headers => {})

       registered request stubs:

       stub_request(:delete, "https://first.last:[email protected]/token/utpg2i2xswor6h8ttjhu3d47z53yy47y").
         with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.1'})

       ============================================================
     # ./.bundle/gems/gems/webmock-1.24.6/lib/webmock/http_lib_adapters/net_http.rb:114:in `request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:82:in `perform_request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:40:in `block in call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:87:in `with_net_http_connection'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:32:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/request/authorization.rb:38:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb:15:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:140:in `delete'
     # ./lib/vmfloaty/auth.rb:29:in `delete_token'
     # ./spec/vmfloaty/auth_spec.rb:36:in `block (3 levels) in <top (required)>'

  3) Pooler#token_status checks the status of a token
     Failure/Error: response = conn.get "token/#{token}"

     WebMock::NetConnectNotAllowedError:
       Real HTTP connections are disabled. Unregistered request: GET https://vmpooler.example.com/token/utpg2i2xswor6h8ttjhu3d47z53yy47y with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}

       You can stub this request with the following snippet:

       stub_request(:get, "https://vmpooler.example.com/token/utpg2i2xswor6h8ttjhu3d47z53yy47y").
         with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}).
         to_return(:status => 200, :body => "", :headers => {})

       registered request stubs:

       stub_request(:get, "https://vmpooler.example.com/token/utpg2i2xswor6h8ttjhu3d47z53yy47y").
         with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.1'})

       ============================================================
     # ./.bundle/gems/gems/webmock-1.24.6/lib/webmock/http_lib_adapters/net_http.rb:114:in `request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:80:in `perform_request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:40:in `block in call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:87:in `with_net_http_connection'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:32:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb:15:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:140:in `get'
     # ./lib/vmfloaty/auth.rb:48:in `token_status'
     # ./spec/vmfloaty/auth_spec.rb:51:in `block (3 levels) in <top (required)>'

  4) Pooler#retrieve retrieves a single vm with a token
     Failure/Error: response = conn.post "vm/#{os_string}"

     WebMock::NetConnectNotAllowedError:
       Real HTTP connections are disabled. Unregistered request: POST https://vmpooler.example.com/vm/debian-7-i386 with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'0', 'User-Agent'=>'Faraday v0.9.2', 'X-Auth-Token'=>'mytokenfile'}

       You can stub this request with the following snippet:

       stub_request(:post, "https://vmpooler.example.com/vm/debian-7-i386").
         with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'0', 'User-Agent'=>'Faraday v0.9.2', 'X-Auth-Token'=>'mytokenfile'}).
         to_return(:status => 200, :body => "", :headers => {})

       registered request stubs:

       stub_request(:post, "https://vmpooler.example.com/vm/debian-7-i386").
         with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'0', 'User-Agent'=>'Faraday v0.9.1', 'X-Auth-Token'=>'mytokenfile'})

       ============================================================
     # ./.bundle/gems/gems/webmock-1.24.6/lib/webmock/http_lib_adapters/net_http.rb:114:in `request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:82:in `perform_request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:40:in `block in call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:87:in `with_net_http_connection'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:32:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb:15:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:177:in `post'
     # ./lib/vmfloaty/pooler.rb:40:in `retrieve'
     # ./spec/vmfloaty/pooler_spec.rb:54:in `block (3 levels) in <top (required)>'

  5) Pooler#retrieve retrieves a multiple vms with a token
     Failure/Error: response = conn.post "vm/#{os_string}"

     WebMock::NetConnectNotAllowedError:
       Real HTTP connections are disabled. Unregistered request: POST https://vmpooler.example.com/vm/debian-7-i386+debian-7-i386+centos-7-x86_64 with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'0', 'User-Agent'=>'Faraday v0.9.2', 'X-Auth-Token'=>'mytokenfile'}

       You can stub this request with the following snippet:

       stub_request(:post, "https://vmpooler.example.com/vm/debian-7-i386+debian-7-i386+centos-7-x86_64").
         with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'0', 'User-Agent'=>'Faraday v0.9.2', 'X-Auth-Token'=>'mytokenfile'}).
         to_return(:status => 200, :body => "", :headers => {})

       registered request stubs:

       stub_request(:post, "https://vmpooler.example.com/vm/debian-7-i386+debian-7-i386+centos-7-x86_64").
         with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'0', 'User-Agent'=>'Faraday v0.9.1', 'X-Auth-Token'=>'mytokenfile'})

       ============================================================
     # ./.bundle/gems/gems/webmock-1.24.6/lib/webmock/http_lib_adapters/net_http.rb:114:in `request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:82:in `perform_request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:40:in `block in call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:87:in `with_net_http_connection'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:32:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb:15:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:177:in `post'
     # ./lib/vmfloaty/pooler.rb:40:in `retrieve'
     # ./spec/vmfloaty/pooler_spec.rb:68:in `block (3 levels) in <top (required)>'

  6) Pooler#modify modifies the TTL of a vm
     Failure/Error:
       response = conn.put do |req|
         req.url "vm/#{hostname}"
         req.body = modify_body.to_json
       end

     WebMock::NetConnectNotAllowedError:
       Real HTTP connections are disabled. Unregistered request: PUT https://vmpooler.example.com/vm/fq6qlpjlsskycq6 with body '{"lifetime":12}' with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>'Faraday v0.9.2', 'X-Auth-Token'=>'mytokenfile'}

       You can stub this request with the following snippet:

       stub_request(:put, "https://vmpooler.example.com/vm/fq6qlpjlsskycq6").
         with(:body => {"{\"lifetime\":12}"=>nil},
              :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>'Faraday v0.9.2', 'X-Auth-Token'=>'mytokenfile'}).
         to_return(:status => 200, :body => "", :headers => {})

       registered request stubs:

       stub_request(:put, "https://vmpooler.example.com/vm/fq6qlpjlsskycq6").
         with(:body => {"{\"lifetime\":12}"=>true},
              :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>'Faraday v0.9.1', 'X-Auth-Token'=>'mytokenfile'})

       ============================================================
     # ./.bundle/gems/gems/webmock-1.24.6/lib/webmock/http_lib_adapters/net_http.rb:114:in `request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:82:in `perform_request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:40:in `block in call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:87:in `with_net_http_connection'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:32:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb:15:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:177:in `put'
     # ./lib/vmfloaty/pooler.rb:62:in `modify'
     # ./spec/vmfloaty/pooler_spec.rb:89:in `block (3 levels) in <top (required)>'

  7) Pooler#staus prints the status
     Failure/Error: response = conn.get '/status'

     WebMock::NetConnectNotAllowedError:
       Real HTTP connections are disabled. Unregistered request: GET https://vmpooler.example.com/status with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}

       You can stub this request with the following snippet:

       stub_request(:get, "https://vmpooler.example.com/status").
         with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}).
         to_return(:status => 200, :body => "", :headers => {})

       registered request stubs:

       stub_request(:get, "https://vmpooler.example.com/status").
         with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.1'})

       ============================================================
     # ./.bundle/gems/gems/webmock-1.24.6/lib/webmock/http_lib_adapters/net_http.rb:114:in `request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:80:in `perform_request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:40:in `block in call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:87:in `with_net_http_connection'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:32:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb:15:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:140:in `get'
     # ./lib/vmfloaty/pooler.rb:104:in `status'
     # ./spec/vmfloaty/pooler_spec.rb:119:in `block (3 levels) in <top (required)>'

  8) Pooler#query makes a query about a vm
     Failure/Error: response = conn.get "vm/#{hostname}"

     WebMock::NetConnectNotAllowedError:
       Real HTTP connections are disabled. Unregistered request: GET https://vmpooler.example.com/vm/fq6qlpjlsskycq6 with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}

       You can stub this request with the following snippet:

       stub_request(:get, "https://vmpooler.example.com/vm/fq6qlpjlsskycq6").
         with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.2'}).
         to_return(:status => 200, :body => "", :headers => {})

       registered request stubs:

       stub_request(:get, "https://vmpooler.example.com/vm/fq6qlpjlsskycq6").
         with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.1'})

       ============================================================
     # ./.bundle/gems/gems/webmock-1.24.6/lib/webmock/http_lib_adapters/net_http.rb:114:in `request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:80:in `perform_request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:40:in `block in call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:87:in `with_net_http_connection'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:32:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb:15:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:140:in `get'
     # ./lib/vmfloaty/pooler.rb:120:in `query'
     # ./spec/vmfloaty/pooler_spec.rb:143:in `block (3 levels) in <top (required)>'

  9) Pooler#snapshot makes a snapshot for a single vm
     Failure/Error: response = conn.post "vm/#{hostname}/snapshot"

     WebMock::NetConnectNotAllowedError:
       Real HTTP connections are disabled. Unregistered request: POST https://vmpooler.example.com/vm/fq6qlpjlsskycq6/snapshot with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'0', 'User-Agent'=>'Faraday v0.9.2', 'X-Auth-Token'=>'mytokenfile'}

       You can stub this request with the following snippet:

       stub_request(:post, "https://vmpooler.example.com/vm/fq6qlpjlsskycq6/snapshot").
         with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'0', 'User-Agent'=>'Faraday v0.9.2', 'X-Auth-Token'=>'mytokenfile'}).
         to_return(:status => 200, :body => "", :headers => {})

       registered request stubs:

       stub_request(:post, "https://vmpooler.example.com/vm/fq6qlpjlsskycq6/snapshot").
         with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'0', 'User-Agent'=>'Faraday v0.9.1', 'X-Auth-Token'=>'mytokenfile'})

       ============================================================
     # ./.bundle/gems/gems/webmock-1.24.6/lib/webmock/http_lib_adapters/net_http.rb:114:in `request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:82:in `perform_request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:40:in `block in call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:87:in `with_net_http_connection'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:32:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb:15:in `call'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
     # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:177:in `post'
     # ./lib/vmfloaty/pooler.rb:130:in `snapshot'
     # ./spec/vmfloaty/pooler_spec.rb:158:in `block (3 levels) in <top (required)>'

  10) Pooler#revert makes a request to revert a vm from a snapshot
      Failure/Error: response = conn.post "vm/#{hostname}/snapshot/#{snapshot_sha}"

      WebMock::NetConnectNotAllowedError:
        Real HTTP connections are disabled. Unregistered request: POST https://vmpooler.example.com/vm/fq6qlpjlsskycq6/snapshot/dAfewKNfaweLKNve with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'0', 'User-Agent'=>'Faraday v0.9.2', 'X-Auth-Token'=>'mytokenfile'}

        You can stub this request with the following snippet:

        stub_request(:post, "https://vmpooler.example.com/vm/fq6qlpjlsskycq6/snapshot/dAfewKNfaweLKNve").
          with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'0', 'User-Agent'=>'Faraday v0.9.2', 'X-Auth-Token'=>'mytokenfile'}).
          to_return(:status => 200, :body => "", :headers => {})

        registered request stubs:

        stub_request(:post, "https://vmpooler.example.com/vm/fq6qlpjlsskycq6/snapshot/dAfewKNfaweLKNve").
          with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'0', 'User-Agent'=>'Faraday v0.9.1', 'X-Auth-Token'=>'mytokenfile'})

        ============================================================
      # ./.bundle/gems/gems/webmock-1.24.6/lib/webmock/http_lib_adapters/net_http.rb:114:in `request'
      # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:82:in `perform_request'
      # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:40:in `block in call'
      # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:87:in `with_net_http_connection'
      # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:32:in `call'
      # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb:15:in `call'
      # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
      # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
      # ./.bundle/gems/gems/faraday-0.9.2/lib/faraday/connection.rb:177:in `post'
      # ./lib/vmfloaty/pooler.rb:139:in `revert'
      # ./spec/vmfloaty/pooler_spec.rb:173:in `block (3 levels) in <top (required)>'

Finished in 0.22956 seconds (files took 0.23431 seconds to load)
17 examples, 10 failures

Failed examples:

rspec ./spec/vmfloaty/auth_spec.rb:15 # Pooler#get_token returns a token from vmpooler
rspec ./spec/vmfloaty/auth_spec.rb:31 # Pooler#delete_token deletes the specified token
rspec ./spec/vmfloaty/auth_spec.rb:46 # Pooler#token_status checks the status of a token
rspec ./spec/vmfloaty/pooler_spec.rb:47 # Pooler#retrieve retrieves a single vm with a token
rspec ./spec/vmfloaty/pooler_spec.rb:60 # Pooler#retrieve retrieves a multiple vms with a token
rspec ./spec/vmfloaty/pooler_spec.rb:83 # Pooler#modify modifies the TTL of a vm
rspec ./spec/vmfloaty/pooler_spec.rb:114 # Pooler#staus prints the status
rspec ./spec/vmfloaty/pooler_spec.rb:138 # Pooler#query makes a query about a vm
rspec ./spec/vmfloaty/pooler_spec.rb:153 # Pooler#snapshot makes a snapshot for a single vm
rspec ./spec/vmfloaty/pooler_spec.rb:168 # Pooler#revert makes a request to revert a vm from a snapshot

@briancain
Copy link
Contributor

@justinstoller interesting! It looks like I'm using version webmock (1.21.0) and they pass for me. What's the latest webmock? I can update and try to fix these....they must of changed something between my version and the newest?

@briancain
Copy link
Contributor

Maybe I should just pin the gemfile to that version instead of going through the process of updating everything?

@justinstoller
Copy link
Member Author

I'd be into that (pinning). 1.24.6 and latest, 2.0.3, didn't work for me.

Knowing which version works as intended, I'm happy to do the pinning myself, if you don't mind me folding that into a PR that adds tags to the output of list --active?

PS. I currently am using a local checkout that displays info like:

Running VMs:
- v0gzwog90szfe7r.delivery.puppetlabs.net (redhat-7-x86_64, 2.81/12 hours, reason: ENTERPRISE-902, role: MoM)
- mcpy42eqjxli9g2.delivery.puppetlabs.net (ubuntu-1604-x86_64, 0.02/12 hours)

@briancain
Copy link
Contributor

@justinstoller that sounds great! Yeah please add the pin to your PR and I'll take a look.

@briancain
Copy link
Contributor

This should be fixed per PR #23 and is now in the master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants