pbs_cray_pagg_id.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # coding: utf-8
  2. # Copyright (C) 1994-2018 Altair Engineering, Inc.
  3. # For more information, contact Altair at www.altair.com.
  4. #
  5. # This file is part of the PBS Professional ("PBS Pro") software.
  6. #
  7. # Open Source License Information:
  8. #
  9. # PBS Pro is free software. You can redistribute it and/or modify it under the
  10. # terms of the GNU Affero General Public License as published by the Free
  11. # Software Foundation, either version 3 of the License, or (at your option) any
  12. # later version.
  13. #
  14. # PBS Pro is distributed in the hope that it will be useful, but WITHOUT ANY
  15. # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16. # FOR A PARTICULAR PURPOSE.
  17. # See the GNU Affero General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU Affero General Public License
  20. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. #
  22. # Commercial License Information:
  23. #
  24. # For a copy of the commercial license terms and conditions,
  25. # go to: (http://www.pbspro.com/UserArea/agreement.html)
  26. # or contact the Altair Legal Department.
  27. #
  28. # Altair’s dual-license business model allows companies, individuals, and
  29. # organizations to create proprietary derivative works of PBS Pro and
  30. # distribute them - whether embedded or bundled with other software -
  31. # under a commercial license agreement.
  32. #
  33. # Use of Altair’s trademarks, including but not limited to "PBS™",
  34. # "PBS Professional®", and "PBS Pro™" and Altair’s logos is subject to Altair's
  35. # trademark licensing policies.
  36. from tests.functional import *
  37. @tags('cray')
  38. class TestCrayPaggIdUniqueness(TestFunctional):
  39. """
  40. This test suite is written to verify that the PAGG ID provided to ALPS
  41. while confirming and releasing an ALPS reservation is not equal to the
  42. session ID of the job.
  43. This test is specific to Cray and will also not work on the Cray simulator,
  44. hence, will be skipped on non-Cray systems and Cray simulator.
  45. """
  46. def setUp(self):
  47. platform = self.du.get_platform()
  48. if platform != 'cray':
  49. self.skipTest("not a cray")
  50. TestFunctional.setUp(self)
  51. def test_pagg_id(self):
  52. """
  53. This test case submits a job, waits for it to run and then checks
  54. the MoM logs to confirm that the PAGG ID provided in the ALPS
  55. query is not equal to the session ID of the job.
  56. """
  57. j1 = Job(TEST_USER)
  58. jid = self.server.submit(j1)
  59. self.server.expect(JOB, {ATTR_state: 'R'}, id=jid)
  60. self.mom.log_match("Job;%s;Started, pid" % (jid,), n=100,
  61. max_attempts=5, interval=5, regexp=True)
  62. self.server.status(JOB, [ATTR_session], jid)
  63. sess_id = j1.attributes[ATTR_session]
  64. msg = "pagg_id =\"" + sess_id + "\""
  65. try:
  66. self.mom.log_match(msg, n='ALL')
  67. except PtlLogMatchError:
  68. self.logger.info("pagg_id is not equal to session id, test passes")
  69. else:
  70. self.assertFalse("pagg_id is equal to session id, test fails.")