Skip to content

Commit

Permalink
test(integ): add test for RCS process owner (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
jusiskin authored Apr 14, 2021
1 parent ace30a3 commit 7070b4b
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Script to return the username for the process running the RCS as reported by Deadline
#
# Input:
# None
# Output:
# Non-zero return code on failure.
# Outputs the username of the process that the Deadline RCS is running as


set -euo pipefail

DEADLINE="/opt/Thinkbox/Deadline10/bin"

# Fetch repository.ini from the Deadline repo
$DEADLINE/deadlinecommand -json GetProxyServerInfos | jq -e -r '.result[]|select(.Stat == 1 and .Type == "Remote")|.User'
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,32 @@ describe.each(testCases)('Deadline RenderQueue tests (%s)', (_, id) => {
expect(responseCode).toEqual(0);
});
});

test(`RQ-${id}-5: RCS not running as root`, async () => {
/**********************************************************************************************************
* TestID: RQ-5
* Description: Confirm that RCS process is not running as the root user
* Input: The user owning the RCS process as reported by deadlinecommand
* Expected result: Response code 0, i.e. the script execution was successful and Deadline accepted the job
**********************************************************************************************************/
var params = {
DocumentName: 'AWS-RunShellScript',
Comment: 'Execute Test Script RQ-query-rcs-user.sh',
InstanceIds: [bastionId],
Parameters: {
commands: [
'sudo -i',
'su - ec2-user >/dev/null',
'cd ~ec2-user',
'./testScripts/RQ-query-rcs-user.sh',
],
},
};
return awaitSsmCommand(bastionId, params).then( response => {
const user = response.output;
expect(user).not.toHaveLength(0);
expect(user).not.toEqual('root');
});
});
});
});

0 comments on commit 7070b4b

Please sign in to comment.