<commit_before>#!/bin/bash -e
#
#
#
trap "make ci-teardown" ERR

# Quick hack to pass IPs off to testinfra
for host in app mon; do
    # tacking xargs at the end strips the trailing space
    ip=`ssh -F $HOME/.ssh/sshconfig-securedrop-ci-$BUILD_NUM ${host}-$CI_SD_ENV "hostname -I" | xargs`
    ansible -c local localhost -m lineinfile -a "dest=./testinfra/vars/app-${CI_SD_ENV}.yml line='${host}_ip: $ip' regexp='^${host}_ip'"
    ansible -c local localhost -m lineinfile -a "dest=./testinfra/vars/mon-${CI_SD_ENV}.yml line='${host}_ip: $ip' regexp='^${host}_ip'"
done

# Ensure we can SSH to both hosts before kicking off tests
ansible staging -m ping || exit 1

# Cleanup any possible lingering previous results
rm -v *results.xml || true

if [ "$?" == "0" ]; then
    case "$CI_SD_ENV" in
    "staging")
        ./testinfra/test.py build
        ./testinfra/test.py app-$CI_SD_ENV
        ./testinfra/test.py mon-$CI_SD_ENV
        ;;
    "development")
        ./testinfra/test.py development
        ;;
    esac
fi

if [ -z "$TEST_REPORTS" ]; then
    export TEST_REPORTS=`pwd`
fi

# Remove any existing result files
rm -r $TEST_REPORTS/junit || true
mkdir $TEST_REPORTS/junit || true

./testinfra/combine-junit.py *results.xml > $TEST_REPORTS/junit/junit.xml
<commit_msg>TEST_REPORTS variable is not getting evaluated<commit_after>#!/bin/bash -e
#
#
#
trap "make ci-teardown" ERR

# Quick hack to pass IPs off to testinfra
for host in app mon; do
    # tacking xargs at the end strips the trailing space
    ip=`ssh -F $HOME/.ssh/sshconfig-securedrop-ci-$BUILD_NUM ${host}-$CI_SD_ENV "hostname -I" | xargs`
    ansible -c local localhost -m lineinfile -a "dest=./testinfra/vars/app-${CI_SD_ENV}.yml line='${host}_ip: $ip' regexp='^${host}_ip'"
    ansible -c local localhost -m lineinfile -a "dest=./testinfra/vars/mon-${CI_SD_ENV}.yml line='${host}_ip: $ip' regexp='^${host}_ip'"
done

# Ensure we can SSH to both hosts before kicking off tests
ansible staging -m ping || exit 1

# Cleanup any possible lingering previous results
rm -v *results.xml || true

if [ "$?" == "0" ]; then
    case "$CI_SD_ENV" in
    "staging")
        ./testinfra/test.py build
        ./testinfra/test.py app-$CI_SD_ENV
        ./testinfra/test.py mon-$CI_SD_ENV
        ;;
    "development")
        ./testinfra/test.py development
        ;;
    esac
fi

if [ -z "$TEST_REPORTS" ] || [ "$TEST_REPORTS" == '${CIRCLE_TEST_REPORTS}' ]; then 
    export TEST_REPORTS=`pwd`
fi

# Remove any existing result files
rm -r $TEST_REPORTS/junit || true
mkdir $TEST_REPORTS/junit || true

./testinfra/combine-junit.py *results.xml > $TEST_REPORTS/junit/junit.xml

{'fraction_non_alphanumeric': 0.14464218099204848, 'fraction_numerical': 0.0015145778114350624, 'mean_word_length': 3.254428341384863, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7361810', 'n_tokens_mistral': 998, 'n_tokens_neox': 940, 'n_words': 259}