<commit_before>#!/usr/bin/env bash

#### BEGIN CONFIGURATION ####
# You can change the go compiler to use. Default: "gc"
COMPILER="gc"
# Set the of of your NERDZ-API configuration file
CONF_FILE="$HOME/nerdz_env/confSample.json"
# Set the path of your nerdz-test-db repo's clone.
TEST_DB_PATH="$HOME/nerdz_env/nerdz-test-db/"

#### END CONFIGURATION ####

echo 'Creating new test database....'
echo 'Exising role (eg. postgres): '
read ROLE
echo 'Db name (eg. test_db): '
read DB_NAME
echo 'Password: '
read DB_PASS

LOCAL_PATH=$( cd $(dirname $0) ; pwd -P )

cd "$TEST_DB_PATH"
./initdb.sh "$ROLE" "$DB_NAME" "$DB_PASS"
cd "$LOCAL_PATH"

echo 'Test database created'; echo
echo 'Begin tests...'; echo

CONF_FILE=$CONF_FILE go test -compiler $COMPILER<commit_msg>Fix test_all.sh script. Restore test-db after tests<commit_after>#!/usr/bin/env bash

#### BEGIN CONFIGURATION ####
# Set the of of your NERDZ-API configuration file
CONF_FILE="$HOME/nerdz_env/confSample.json"
# Set the path of your nerdz-test-db repo's clone.
TEST_DB_PATH="$HOME/nerdz_env/nerdz-test-db/"

#### END CONFIGURATION ####

echo 'Creating new test database....'
echo 'Exising role (eg. postgres): '
read ROLE
echo 'Db name (eg. test_db): '
read DB_NAME
echo 'Password: '
read DB_PASS

LOCAL_PATH=$( cd $(dirname $0) ; pwd -P )

cd "$TEST_DB_PATH"
./initdb.sh "$ROLE" "$DB_NAME" "$DB_PASS"
cd "$LOCAL_PATH"

echo 'Test database created'; echo
echo 'Begin tests...'; echo

CONF_FILE=$CONF_FILE go test

echo 'Restoring test db...'
cd "$TEST_DB_PATH"
./initdb.sh "$ROLE" "$DB_NAME" "$DB_PASS"
{'fraction_non_alphanumeric': 0.15782747603833866, 'fraction_numerical': 0.0012779552715654952, 'mean_word_length': 4.612903225806452, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '3466587', 'n_tokens_mistral': 576, 'n_tokens_neox': 571, 'n_words': 174}