<commit_before>#!/bin/bash

# sanity check for build env
if [[ ! -e zap ]]; then
    echo "no zap binary present"
    exit 1
fi

# start zap, fork.
./zap --port 16000 1>/dev/null 2>/dev/null &
ZAP_PID=$!

# pull results.
RESP="$(curl -I -L -H 'Host: g' localhost:16000/z 2>/dev/null | head -n 2)"

# Check header
if [[ $RESP != *"HTTP/1.1 302 Found"* ]]; then
    echo "302 status not found"
    echo "got: $RESP"
    kill -9 $ZAP_PID
    exit 2
fi

# check location
if [[ $RESP != *"Location: https://github.com/issmirnov/zap"* ]]; then
    echo "Location is wrong"
    echo "Got: $RESP"
    kill -9 $ZAP_PID
    exit 3
fi

kill -9 $ZAP_PID
echo "End to end test passed."<commit_msg>convert e2e test to use better templates with curl<commit_after>#!/bin/bash

# sanity check for build env
if [[ ! -e zap ]]; then
    echo "no zap binary present"
    exit 1
fi

# start zap, fork.
./zap --port 16000 1>/dev/null 2>/dev/null &
ZAP_PID=$!

# pull results.
RESP="$(curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' -H 'Host: g' localhost:16000/z)"

# Check response
expected="302 https://github.com/issmirnov/zap"
if [[ $RESP != $expected ]];then
    echo "Status code or location don't match expectations"
    echo "expected: $expected"
    echo "got: $RESP"
    kill -9 $ZAP_PID
    exit 2
fi

# cleanup
kill -9 $ZAP_PID
echo "End to end test passed."
{'fraction_non_alphanumeric': 0.15549005158437731, 'fraction_numerical': 0.03537214443625645, 'mean_word_length': 2.9707602339181287, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 2, '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': '4160962', 'n_tokens_mistral': 561, 'n_tokens_neox': 512, 'n_words': 176}