test: Add an integration test for partial line in logs

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
Mrunal Patel 2017-11-21 16:24:29 -08:00
parent 4cf4137be0
commit d10490bccf
1 changed files with 45 additions and 0 deletions

View File

@ -296,6 +296,51 @@ function teardown() {
stop_crio
}
@test "ctr partial line logging" {
start_crio
run crictl runs "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
pod_id="$output"
# Create a new container.
newconfig=$(mktemp --tmpdir crio-config.XXXXXX.json)
cp "$TESTDATA"/container_config_logging.json "$newconfig"
sed -i 's|"%shellcommand%"|"echo -n hello"|' "$newconfig"
run crictl create "$pod_id" "$newconfig" "$TESTDATA"/sandbox_config.json
echo "$output"
[ "$status" -eq 0 ]
ctr_id="$output"
run crictl start "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
run crictl stop "$ctr_id"
echo "$output"
# Ignore errors on stop.
run crictl inspect "$ctr_id"
[ "$status" -eq 0 ]
run crictl rm "$ctr_id"
echo "$output"
[ "$status" -eq 0 ]
# Check that the output is what we expect.
logpath="$DEFAULT_LOG_PATH/$pod_id/$ctr_id.log"
[ -f "$logpath" ]
echo "$logpath :: $(cat "$logpath")"
grep -E "^[^\n]+ stdout P hello$" "$logpath"
run crictl stops "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
run crictl rms "$pod_id"
echo "$output"
[ "$status" -eq 0 ]
cleanup_ctrs
cleanup_pods
stop_crio
}
# regression test for #127
@test "ctrs status for a pod" {
start_crio