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

PP-374: PTL for Job with a root-owned script runs even if root_reject… #232

Merged
merged 1 commit into from Jan 31, 2017

Conversation

nithinj
Copy link
Contributor

@nithinj nithinj commented Jan 18, 2017

…_scripts is set to true

Issue-ID

Problem description

  • PTL test case for Job with a root-owned script runs even if root_reject set to true

Cause / Analysis

  • Provide a PTL test case for PP-374

Solution description

  • PTL has added for PP-374

Checklist:

For further information please visit the Developer Guide Home.

@nithinj
Copy link
Contributor Author

nithinj commented Jan 18, 2017

Thanks @hirenvadalia for reviewing the changes. I've addressed your comments (from #231 ) in this pull request.

rv = self.server.expect(JOB, {'job_state': 'Q'}, id=jid)
self.assertTrue(rv)
_comment = 'Not Running: PBS Error: Execution server rejected request'
rv = self.server.expect(JOB, {'comment': _comment}, id=jid)
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need to check the return code from expect(). If it isn't true, it'll error out. The only reason you'll reach your assertTrue() is if it is true.

submit a script as root and observe the job comment.
"""
j = Job(ROOT_USER)
j.create_script(self.sleep_5)
Copy link
Contributor

Choose a reason for hiding this comment

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

Idle curiosity: Why are you using a job script instead of the default job? You don't depend on anything the script is doing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only a job script will get rejected by the mom, not a default job if the "reject_root_scripts" parameter is set to true.

j.create_script(self.sleep_5)
jid = self.server.submit(j)
rv = self.server.expect(
JOB, {'job_state': 'R'}, id=jid)
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to break this line. The two lines together is 63 characters. Please join the two.

j.create_script(self.sleep_5)
jid = self.server.submit(j)
rv = self.server.expect(
JOB, {'job_state': 'R'}, id=jid)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above about checking the return value of expect(). It'll error out if the expect fails.

@nithinj
Copy link
Contributor Author

nithinj commented Jan 30, 2017

Hello @bhroam ,
I've made the suggested changes. Please review.

@bhroam
Copy link
Contributor

bhroam commented Jan 31, 2017

Looks good to me. I sign off.

Copy link
Contributor

@hirenvadalia hirenvadalia 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 to me. I sign-off.

@nithinj
Copy link
Contributor Author

nithinj commented Jan 31, 2017

I've squashed and rebased my commits. Please take it further.

@mike0042 mike0042 merged commit 3a951b0 into openpbs:master Jan 31, 2017
@nithinj nithinj deleted the PP-374 branch August 17, 2017 06:28
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.

None yet

4 participants