Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DPL-865 handle sprint client response #2130

Open
wants to merge 30 commits into
base: develop
Choose a base branch
from

Conversation

dasunpubudumal
Copy link
Contributor

@dasunpubudumal dasunpubudumal commented Dec 17, 2024

Closes #1352

Changes proposed in this pull request

  • Handling SPrint response

Instructions for Reviewers

[All PRs] - Confirm PR template filled
[Feature Branches] - Review code
[Production Merges to main]
    - Check story numbers included
    - Check for debug code
    - Check version

yoldas and others added 5 commits December 3, 2024 15:17
@dasunpubudumal dasunpubudumal self-assigned this Dec 17, 2024
@dasunpubudumal dasunpubudumal linked an issue Dec 17, 2024 that may be closed by this pull request
3 tasks
@dasunpubudumal dasunpubudumal marked this pull request as draft December 17, 2024 09:08
Copy link

codecov bot commented Dec 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.80%. Comparing base (8eaf75c) to head (499bcf4).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2130      +/-   ##
===========================================
+ Coverage    80.78%   80.80%   +0.02%     
===========================================
  Files          476      476              
  Lines        18185    18206      +21     
  Branches       269      269              
===========================================
+ Hits         14691    14712      +21     
  Misses        3492     3492              
  Partials         2        2              
Flag Coverage Δ
javascript 74.23% <ø> (ø)
pull_request 80.80% <100.00%> (+0.02%) ⬆️
push 80.80% <100.00%> (+0.02%) ⬆️
ruby 91.30% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dasunpubudumal dasunpubudumal marked this pull request as ready for review December 17, 2024 10:54
Copy link
Contributor

@BenTopping BenTopping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, couple advisories. I haven't tested locally.

spec/models/print_job_spec.rb Outdated Show resolved Hide resolved
spec/models/print_job_spec.rb Outdated Show resolved Hide resolved
spec/models/print_job_spec.rb Outdated Show resolved Hide resolved
app/models/print_job.rb Outdated Show resolved Hide resolved
spec/models/print_job_spec.rb Outdated Show resolved Hide resolved
Copy link
Member

@andrewsparkes andrewsparkes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like Bens suggested changes.
My minor one was the error message if sprint is down, can we do something to intercept and change that into something more friendly (might need a separate story).

app/models/print_job.rb Outdated Show resolved Hide resolved
spec/models/print_job_spec.rb Outdated Show resolved Hide resolved
spec/models/print_job_spec.rb Outdated Show resolved Hide resolved
Copy link
Member

@andrewsparkes andrewsparkes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvements, thanks.

Not sure the user will like the 'try again later' messages, but this is much better than getting no label and nothing at all from LIMS to indicate why. And they can raise a clearer support message if needed.

Copy link
Contributor

@BenTopping BenTopping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, codecov complaining about tests I have mentioned.

expect(SPrintClient).to receive(:send_print_request).with(
printer_sprint.name,
label_template_name_sprint,
labels_sprint.values
)
expect(pj.print_to_sprint).to eq(true)
end

it 'will not execute if the SPrintClient is down' do
response = Net::HTTPBadGateway.new(1.0, '502', nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also test the errors for Net::HTTPUnprocessableEntity and Net::HTTPInternalServerError as they have separate routes / error messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just added two more tests, but Codecov is still complaining?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, they look good. Think codecov is complaining about coverage in extract_error_message method

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DPL-865 [Limber] Handle sprint client response
5 participants