Skip to content

Commit

Permalink
Fix and PTL testcase for missing node attr
Browse files Browse the repository at this point in the history
Incorporated the changes requested in PR
  • Loading branch information
SudeshnaMoulik committed Nov 20, 2018
1 parent 374dd7a commit 0197d9b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/server/node_manager.c
Expand Up @@ -8594,6 +8594,9 @@ set_last_used_time_node(void *pobj, int type)
snprintf(str_val, sizeof(str_val), "%d", time_int_val);
set_attr_svr(&(pnode->nd_attr[(int)ND_ATR_last_used_time]),
&node_attr_def[(int) ND_ATR_last_used_time], str_val);
pnode->nd_modified = NODE_UPDATE_OTHERS;
if(svr_chngNodesfile == 0)
svr_chngNodesfile = 1; /*make sure nodes are saved to the database during shutdown*/
}
}
last_pn = pn;
Expand Down
18 changes: 18 additions & 0 deletions test/tests/functional/pbs_pbsnodes.py
Expand Up @@ -89,3 +89,21 @@ def test_pbsnodes_aS(self):
self.assertIn(
hdr, out2['out'][0],
"header %s not found in output" % hdr)

def test_pbsnodes_av(self):
"""
This verifies the values of last_used_time in 'pbsnodes -av'
result before and after server shutdown, once a job submitted.
"""
j = Job(TEST_USER)
j.set_sleep_time(1)
jid = self.server.submit(j)
self.server.accounting_match("E;%s;" % jid)
prev = self.server.status(NODE, 'last_used_time')[0]['last_used_time']
self.logger.info("Restarting server")
self.server.restart()
self.assertTrue(self.server.isUp(), 'Failed to restart Server Daemon')
now = self.server.status(NODE, 'last_used_time')[0]['last_used_time']
self.logger.info("Before: " + prev + ". After: " + now + ".")
self.assertEquals(prev.strip(), now.strip(),
'Last used time mismatch after server restart')

0 comments on commit 0197d9b

Please sign in to comment.