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

test(integ): add test for RCS process owner #389

Merged
merged 1 commit into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
});
});
});
});