From de3a3e419a83f81171c89402a60b34efd779599e Mon Sep 17 00:00:00 2001 From: ColinBruce Date: Fri, 2 Aug 2024 12:14:07 +0100 Subject: [PATCH] Chore: pdf smoke test We have seen issues with tests build on circle ci passing but pdf generation on the alpine build failing This PR attempts to add a rake task to test imapct of smoke testing a Grover test before pushing to ECR --- docker/run | 2 ++ lib/tasks/smoke_test.rake | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 lib/tasks/smoke_test.rake diff --git a/docker/run b/docker/run index 23b857a151..4ed1d30daa 100755 --- a/docker/run +++ b/docker/run @@ -11,5 +11,7 @@ bundle exec rails db:prepare db:seed # Remove irb prompts from rails console echo 'IRB.conf[:USE_AUTOCOMPLETE] = false' >> ~/.irbrc +bundle exec rake smoke_test:pdf + # Start the Puma server bundle exec puma -C config/puma.rb diff --git a/lib/tasks/smoke_test.rake b/lib/tasks/smoke_test.rake new file mode 100644 index 0000000000..5881aee771 --- /dev/null +++ b/lib/tasks/smoke_test.rake @@ -0,0 +1,9 @@ +namespace :smoke_test do + desc "Tries to generate a grover document" + task pdf: :environment do + Timeout.timeout(10) { Grover.new("test").to_pdf.size } + Rails.logger.info "PDF generation succeeded" + rescue Timeout::Error + raise StandardError, "PDF generation failed" + end +end