ensure js/css build succeeded during health_check
fixes: CNVS-38654 otherwise the health check might happily say canvas is all good, when no front end page will actually work test plan: (Do all of this in RAILS_ENV=production) * go to /health_check; it should work * delete public/dist/webpack-*/webpack-manifest.json * restart your server * go to /health_check; it should give a 500 * compile_assets again * go to /health_check; it should work * delete public/dist/brandable_css * restart your server * go to /health_check; it should give a 500 * compile_assets again * go to /health_check; it should work * rm public/dist/rev-manifest.json * restart your server * go to /health_check; it should give a 500 Change-Id: I0d4c941e71185563ad382d5f91dfce92447fbba6 Reviewed-on: https://gerrit.instructure.com/122326 Reviewed-by: Cody Cutrer <cody@instructure.com> Tested-by: Jenkins QA-Review: Jeremy Putnam <jeremyp@instructure.com> Product-Review: Ryan Shaw <ryan@instructure.com>
This commit is contained in:
parent
3b043037d1
commit
a01547c823
|
@ -54,10 +54,18 @@ class InfoController < ApplicationController
|
|||
end
|
||||
Tempfile.open("heartbeat", ENV['TMPDIR'] || Dir.tmpdir) { |f| f.write("heartbeat"); f.flush }
|
||||
|
||||
# javascript/css build process didn't die, right?
|
||||
asset_urls = {
|
||||
common_css: css_url_for("common"), # ensures brandable_css_bundles_with_deps exists
|
||||
common_js: ActionController::Base.helpers.javascript_url("#{js_base_url}/common"), # ensures webpack worked
|
||||
revved_url: Canvas::Cdn::RevManifest.gulp_manifest.values.first # makes sure `gulp rev` has ran
|
||||
}
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render plain: 'canvas ok' }
|
||||
format.json { render json:
|
||||
{ status: 'canvas ok',
|
||||
asset_urls: asset_urls,
|
||||
revision: Canvas.revision,
|
||||
installation_uuid: Canvas.installation_uuid } }
|
||||
end
|
||||
|
|
|
@ -30,12 +30,21 @@ describe InfoController do
|
|||
it "should respond_to json" do
|
||||
request.accept = "application/json"
|
||||
allow(Canvas).to receive(:revision).and_return("Test Proc")
|
||||
allow(Canvas::Cdn::RevManifest).to receive(:gulp_manifest).and_return({test_key: "mock_revved_url"})
|
||||
get "health_check"
|
||||
expect(response).to be_success
|
||||
json = JSON.parse(response.body)
|
||||
expect(json).to have_key('installation_uuid')
|
||||
json.delete('installation_uuid')
|
||||
expect(json).to eq({ "status" => "canvas ok", "revision" => "Test Proc" })
|
||||
expect(json).to eq({
|
||||
"status" => "canvas ok",
|
||||
"revision" => "Test Proc",
|
||||
"asset_urls" => {
|
||||
"common_css" => "/dist/brandable_css/new_styles_normal_contrast/bundles/common-#{BrandableCSS.cache_for('bundles/common', 'new_styles_normal_contrast')[:combinedChecksum]}.css",
|
||||
"common_js" => ActionController::Base.helpers.javascript_url("#{ENV['USE_OPTIMIZED_JS'] == 'true' ? '/dist/webpack-production' : '/dist/webpack-dev'}/common"),
|
||||
"revved_url" => "mock_revved_url"
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue