Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Commit b15d26c

Browse files
Brian CunnieTeal Stannard
andcommitted
🐞 V3: less flaky unit tests
The test failed because we had an extra event in the database. The extra event was an artifact of a separate test which left a lingering usage event in the database. We now delete the lingering event at test completion. Fixes: <https://capi.ci.cf-app.com/teams/main/pipelines/capi/jobs/cc-unit-tests/builds/2552> ``` 1) App Usage Events GET /v3/app_usage_events behaves like permissions for list endpoint as an admin_read_only returns the correct response status and resources Failure/Error: expect({ resources: parsed_response['resources'] }).to match_json_response({ resources: expected_response_objects }) Summary: + resources[0]: {:guid=>"3e668ba8-a72e-4a66-beab-c43629712a15", :created_at=>"2020-06-09T11:32:34Z", :updated_at=>"2020-06-09T11:32:34Z", :state=>{:current=>"STARTED", :previous=>"STARTED"}, :app=>{:guid=>"602f702c-5f78-4249-8d38-8f9386f3fca1", :name=>"name-20104"}, :process=>{:guid=>"3e668ba8-a72e-4a66-beab-c43629712a15", :type=>nil}, :space=>{:guid=>"fc22f581-4a7e-461b-aeb4-885614139c96", :name=>"name-20101"}, :organization=>{:guid=>"5894354a-53f5-4483-bc90-b0e08cb86beb"}, :buildpack=>{:guid=>nil, :name=>nil}, :task=>{:guid=>nil, :name=>nil}, :memory_in_mb_per_instance=>{:current=>1024, :previous=>1024}, :instance_count=>{:current=>1, :previous=>1}} Shared Example Group: "permissions for list endpoint" called from ./spec/request/app_usage_events_spec.rb:84 ``` [#173251275] Co-authored-by: Brian Cunnie <bcunnie@pivotal.io> Co-authored-by: Teal Stannard <tstannard@pivotal.io>
1 parent 3cc25fb commit b15d26c

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

spec/request/app_usage_events_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@
135135
h.freeze
136136
end
137137

138+
after 'clean-up to avoid test pollution' do
139+
VCAP::CloudController::AppUsageEvent.all.first.delete
140+
end
141+
138142
it_behaves_like 'permissions for single object endpoint', ALL_PERMISSIONS do
139143
let(:after_request_check) do
140144
lambda do

0 commit comments

Comments
 (0)