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

force utf-8 encoding #842

Merged
merged 5 commits into from
Jul 26, 2024
Merged

force utf-8 encoding #842

merged 5 commits into from
Jul 26, 2024

Conversation

johrstrom
Copy link
Contributor

force utf-8 encoding for Slurm to prevent errors when squeue returns ASCII characters that don't parse correctly.

@johrstrom johrstrom closed this Jul 8, 2024
@johrstrom johrstrom reopened this Jul 8, 2024
allow(Open3).to receive(:capture3).with({}, *squeue_args, stdin_data: "").and_return([stdout, '', double("success?" => true)])
job = OodCore::Job::Factory.build_slurm({}).info('123')
expect(job.job_owner).to eq('annie.oakley')
expect(job.job_name).to eq('��� non-utf8')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's some issue with stubbing the output data here where we expect 3 of these characters instead of one. In any case, comment out the line line = line.encode('UTF-8', invalid: :replace, undef: :replace) in the slurm adapter and it does indeed fail with the same ArgumentError: invalid byte sequence in US-ASCII so the test case does indeed cover that.

Copy link
Contributor

@ashton22305 ashton22305 left a comment

Choose a reason for hiding this comment

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

LGTM

@johrstrom johrstrom merged commit 9072be2 into master Jul 26, 2024
3 checks passed
@johrstrom johrstrom deleted the utf8-slurm branch July 26, 2024 18:45
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.

2 participants