stefan-kolb / nucleus

Platform as a Service API abstraction layer.
MIT License
28 stars 0 forks source link

Test are failing #59

Open stefan-kolb opened 9 years ago

stefan-kolb commented 9 years ago

Tests are failing for me (especially Heroku for now). It's pretty hard to debug this stuff ^^

describe 'create application', :mock_fs_on_replay, cassette_group: 'app;create' do
    describe 'succeeds' do
      describe 'of type nodejs with all properties', :as_cassette do
        before do
          application = {
            application: {
              name: @app_all[:original_name], runtimes: ['nodejs'],
              region: @app_all[:region], autoscaled: false
            }
          }
          application[:application][:vendor_specific] = @application_params if @application_params
          post "/endpoints/#{@endpoint}/applications", application, request_headers
        end
        include_examples 'a valid POST request'
        include_examples 'application entity schema'
        include_examples 'application state: created'
      end

@croeck Should the before block really be run before each of the included examples? How can this work? Shouldn't it return a name is already taken error at the second call (as it always does for me)? I don't fully understand the control flow I think. Should it replay the interaction on the second call?

croeck commented 9 years ago

I never had such issues with the final version. What it indeed does is to replay the interaction for all further assertions. Meaning the first create is recorded and its assertion run, whereas all further assertions are then based on the recorded interaction and thus do not expect the name is already taken error.

Were there any changes regarding the RSpec gem recently?

stefan-kolb commented 9 years ago

Not that I know of. I also checked out your last commit. Same problem there. The first request to post "/endpoints/#{@endpoint}/applications", application, request_headers succeeds and writes a cassette which gets overriden or just the post request? on the second attempt. Dunno what I'm missing there.

stefan-kolb commented 9 years ago

It looks like it just ignores the first recording, records a second time, and only matches requests on the third run.

stefan-kolb commented 9 years ago

From my understanding it is very dependent on the record mode how the behavior is: With :all these tests will never work as every new call in before will be re-recorded. With :new_episodes the first call will be recorded, all subsequent will be replayed which should work in that case.

There may also be side effects if some interactions already exists in a cassette or a parent cassette (which we don't use by exclude: true).

To record new one must delete the files manually however. Or maybe we can use a hacked https://www.relishapp.com/vcr/vcr/v/1-6-0/docs/cassettes/automatic-re-recording.

Maybe we can also set the recording flag on non-repeatable interactions explicitely.

I still wonder how this worked for you. Did you only record with :new_episodes or :once? Some tests that use rspec/wait gem should have failed then tho as the first request that will be too early will be replayed all the time?!