From 9ed5912461dcd9b56836ad643d1cfc8b9ff95983 Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Mon, 25 Nov 2019 08:42:42 +0100 Subject: [PATCH] Improve unit tests --- Makefile | 14 +++++++------- test/conf/defaults/post_exec | 6 ++---- test/conf/defaults/pre_exec | 6 ++---- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 9b9f3e5..ced0d28 100644 --- a/Makefile +++ b/Makefile @@ -224,26 +224,26 @@ test-dir-destination-chint: test-fixed-intervals: $(CCOLLECT_SOURCE) test-dir-source test-dir-destination test-dir-destination-chint for s in ./test/conf/sources/*; do \ CCOLLECT_CONF=./test/conf ./ccollect -l ${TEST_LOG_FILE} daily "$$(basename $$s)"; \ - test "$$(ls -1 /tmp/ccollect/backup | wc -l)" -gt "0"; \ + test "$$(ls -1 /tmp/ccollect/backup | wc -l)" -gt "0" || { cat ${TEST_LOG_FILE}; exit 1; }; \ done CCOLLECT_CONF=./test/conf ./ccollect -l ${TEST_LOG_FILE} -a -v daily - test "$$(ls -1 /tmp/ccollect/backup | wc -l)" -gt "0" + test "$$(ls -1 /tmp/ccollect/backup | wc -l)" -gt "0" || { cat ${TEST_LOG_FILE}; exit 1; } CCOLLECT_CONF=./test/conf ./ccollect -l ${TEST_LOG_FILE} -a -p daily - test "$$(ls -1 /tmp/ccollect/backup | wc -l)" -gt "0" + test "$$(ls -1 /tmp/ccollect/backup | wc -l)" -gt "0" || { cat ${TEST_LOG_FILE}; exit 1; } @printf "\nFixed intervals test ended successfully\n" test-interval-changing: $(CCOLLECT_SOURCE) test-dir-source test-dir-destination-chint rm -rf /tmp/ccollect/backup-chint/* - test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "0" + test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "0" || { cat ${TEST_LOG_FILE}; exit 1; } printf "3" > ./test/conf/sources/local-with-interval/intervals/daily for x in 1 2 3 4 5; do CCOLLECT_CONF=./test/conf ./ccollect -l ${TEST_LOG_FILE} daily local-with-interval; done - test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "3" + test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "3" || { cat ${TEST_LOG_FILE}; exit 1; } printf "5" > ./test/conf/sources/local-with-interval/intervals/daily for x in 1 2 3 4 5 6 7; do CCOLLECT_CONF=./test/conf ./ccollect -l ${TEST_LOG_FILE} daily local-with-interval; done - test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "5" + test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "5" || { cat ${TEST_LOG_FILE}; exit 1; } printf "4" > ./test/conf/sources/local-with-interval/intervals/daily for x in 1 2 3 4 5 6; do CCOLLECT_CONF=./test/conf ./ccollect -l ${TEST_LOG_FILE} daily local-with-interval; done - test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "4" + test "$$(ls -1 /tmp/ccollect/backup-chint | wc -l)" -eq "4" || { cat ${TEST_LOG_FILE}; exit 1; } printf "3" > ./test/conf/sources/local-with-interval/intervals/daily @printf "\nInterval changing test ended successfully\n" diff --git a/test/conf/defaults/post_exec b/test/conf/defaults/post_exec index 8aee58f..0dac0ed 100755 --- a/test/conf/defaults/post_exec +++ b/test/conf/defaults/post_exec @@ -1,5 +1,3 @@ -#!/bin/cat +#!/bin/sh -###################################################################### -General post_exec executed. -###################################################################### +echo 'General post_exec executed.' diff --git a/test/conf/defaults/pre_exec b/test/conf/defaults/pre_exec index ecd2857..451fdad 100755 --- a/test/conf/defaults/pre_exec +++ b/test/conf/defaults/pre_exec @@ -1,5 +1,3 @@ -#!/bin/cat +#!/bin/sh -###################################################################### -General pre__exec executed. -###################################################################### +echo 'General pre__exec executed.'