Moar linting - shellcheck & jsonlint here
This commit is contained in:
parent
ec9f5f4022
commit
90fdca47ea
|
@ -15,8 +15,10 @@ all: check container
|
|||
|
||||
lint: shunit2
|
||||
$(ROOT_DIR)/tools/yamllint -s docker-compose*.yml
|
||||
$(ROOT_DIR)/tools/yamllint -s ./tests/environments/*/docker-compose*.yml
|
||||
$(ROOT_DIR)/tools/yamllint -s config/as-code/*.yaml
|
||||
$(ROOT_DIR)/tools/shellcheck -x tests/tests.sh
|
||||
$(ROOT_DIR)/tools/shellcheck -x tests/*.sh
|
||||
$(ROOT_DIR)/tools/jsonlint --quiet ./tests/rollback/*.json
|
||||
$(ROOT_DIR)/tools/shellcheck -x scripts/*.sh
|
||||
$(MAKE) -C environments lint
|
||||
$(MAKE) -C client lint
|
||||
|
|
|
@ -4,16 +4,12 @@
|
|||
current_directory=$(dirname "$0")
|
||||
export PATH="$current_directory/../../tools:$PATH"
|
||||
|
||||
JENKINS_HOME=to_override
|
||||
|
||||
# shellcheck source=tests/utilities
|
||||
. "$current_directory/utilities"
|
||||
|
||||
|
||||
oneTimeSetUp() {
|
||||
setup_container_under_test
|
||||
# shellcheck disable=SC2016
|
||||
JENKINS_HOME="$( docker exec "$container_under_test" bash -c 'echo $JENKINS_HOME' )"
|
||||
}
|
||||
|
||||
# JENKINS-49864
|
||||
|
@ -35,7 +31,7 @@ test_not_root() {
|
|||
|
||||
docker exec "$container_under_test" ps -o user= -o comm= | \
|
||||
grep -E 'jenkins|npm' | \
|
||||
while read process_user
|
||||
while read -r process_user
|
||||
do
|
||||
currentUser=$( echo "$process_user" | awk '{print $1}' )
|
||||
assertEquals "User for '$process_user' should be jenkins" "jenkins" "$currentUser"
|
||||
|
@ -70,7 +66,7 @@ test_jep_307() {
|
|||
test_INSECURE_SHOW_ADMIN_PASSWORD_can_be_unset() {
|
||||
# Avoid executing this for the base image
|
||||
if [ ! -z "${ENVIRONMENT}" ]; then
|
||||
result=$( docker run --rm jenkins/evergreen:$ENVIRONMENT /evergreen/scripts/jenkins-evergreen.sh )
|
||||
result=$( docker run --rm "jenkins/evergreen:$ENVIRONMENT" /evergreen/scripts/jenkins-evergreen.sh )
|
||||
# Expected to fail, but because war is missing. Admin password must have been generated,
|
||||
# and final expected error line is "Error: Unable to access jarfile /evergreen/jenkins/home/jenkins.war"
|
||||
assertNotEquals "Should have failed to start up (war is absent)" "0" "$?"
|
||||
|
|
|
@ -7,8 +7,6 @@ export PATH="$current_directory/../../tools:$PATH"
|
|||
|
||||
echo "Debugging: PATH=***$PATH***"
|
||||
|
||||
JENKINS_HOME=to_override
|
||||
|
||||
# shellcheck source=tests/utilities
|
||||
. "$current_directory/utilities"
|
||||
|
||||
|
@ -20,20 +18,19 @@ oneTimeSetUp() {
|
|||
upload_update_level "./tests/rollback/1-ingest-ok.json"
|
||||
|
||||
wait_for_jenkins
|
||||
# shellcheck disable=SC2016
|
||||
JENKINS_HOME="$( docker exec "$container_under_test" bash -c 'echo $JENKINS_HOME' )"
|
||||
}
|
||||
|
||||
test_rollback() {
|
||||
|
||||
# Check UL is the correct one (UL 1 or UL 2?!)
|
||||
# shellcheck disable=SC2016
|
||||
docker exec "$container_under_test" bash -c 'ls $EVERGREEN_DATA'
|
||||
# extract 2 from `"level":2` from the updates.json file
|
||||
# shellcheck disable=SC2016
|
||||
correctUL=$( docker exec "$container_under_test" bash -c 'cat $EVERGREEN_DATA/updates.json' | \
|
||||
grep --only-matching '"level":.' | \
|
||||
cut -d : -f 2 )
|
||||
assertEquals "Command should have succeeded" 0 "$?"
|
||||
|
||||
assertEquals "Should be UL 2" 2 "$correctUL"
|
||||
|
||||
# upload borked update level to backend
|
||||
|
@ -47,7 +44,9 @@ test_rollback() {
|
|||
|
||||
# let's now check the upload and upgrade attempt to borked UL3 *actually* happened
|
||||
# because if this didn't, then we'd still on UL2, but not testing there was a rollback somewhere
|
||||
# shellcheck disable=SC2016
|
||||
beforeLastUpdate=$( docker exec "$container_under_test" bash -c 'cat $EVERGREEN_DATA/updates.auditlog' | tail -2 | head -1 | jq -r .updateLevel )
|
||||
# shellcheck disable=SC2016
|
||||
lastUpdate=$( docker exec "$container_under_test" bash -c 'cat $EVERGREEN_DATA/updates.auditlog' | tail -1 | jq -r .updateLevel )
|
||||
|
||||
assertEquals "Previous UL should be 3, the one expected to be rolled back" 3 "$beforeLastUpdate"
|
||||
|
|
Loading…
Reference in New Issue