Skip to content

Commit

Permalink
Avoid a cassette trick in worker status
Browse files Browse the repository at this point in the history
  • Loading branch information
coolo committed Nov 5, 2018
1 parent 8e3e036 commit e54a9a6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/api/spec/controllers/worker/status_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,17 @@
end

describe 'GET /index' do
let(:response) { file_fixture('worker_status_response.xml') }

before do
stub_request(:get, CONFIG['source_url'] + '/build/_workerstatus').and_return(body: response)
end

subject! { get :index, params: { format: :xml } }

it { is_expected.to have_http_status(:success) }
it { assert_select 'workerstatus[clients=2]' }
it 'finds 2 workers' do
assert_select 'workerstatus[clients=2]'
end
end
end
27 changes: 27 additions & 0 deletions src/api/spec/fixtures/files/worker_status_response.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<workerstatus clients="2">
<idle workerid="7de14aea3d12:1" hostarch="x86_64" />
<idle workerid="7de14aea3d12:2" hostarch="x86_64" />
<waiting arch="i586" jobs="0" />
<waiting arch="x86_64" jobs="0" />
<blocked arch="i586" jobs="0" />
<blocked arch="x86_64" jobs="0" />
<buildavg arch="i586" buildavg="1200" />
<buildavg arch="x86_64" buildavg="1200" />
<partition>
<daemon type="srcserver" state="running" starttime="1535957126" />
<daemon type="servicedispatch" state="running" starttime="1535957132" />
<daemon type="service" state="running" starttime="1535957132" />
<daemon type="clouduploadserver" state="running" starttime="1535957132" />
<daemon type="clouduploadworker" state="running" starttime="1535957132" />
<daemon type="scheduler" arch="i586" state="running" starttime="1535957132">
<queue high="0" med="0" low="2" next="0" />
</daemon>
<daemon type="scheduler" arch="x86_64" state="running" starttime="1535957132">
<queue high="0" med="0" low="2" next="0" />
</daemon>
<daemon type="repserver" state="running" starttime="1535957130" />
<daemon type="dispatcher" state="running" starttime="1535957132" />
<daemon type="publisher" state="running" starttime="1535957132" />
<daemon type="signer" state="running" starttime="1535957132" />
</partition>
</workerstatus>

0 comments on commit e54a9a6

Please sign in to comment.