Fix missing pid files directory

pull/131/head
JulioV 2021-04-08 16:14:10 -04:00 committed by MoSHI
parent 415ec4a716
commit aafe35107d
2 changed files with 21 additions and 16 deletions

View File

@ -37,7 +37,8 @@ class RapidsTests(unittest.TestCase):
# Loop through the file_list dictionary and check if the files exist. # Loop through the file_list dictionary and check if the files exist.
file_lists = self.generate_sensor_file_lists() file_lists = self.generate_sensor_file_lists()
for each in file_lists: for each in file_lists:
print("The actual output file should exist: {}".format(each[0])) print("Checking if the output file exists: {}".format(each[0]))
print(os.path.exists( each[0]))
self.assertEqual(os.path.exists( each[0]), 1) self.assertEqual(os.path.exists( each[0]), 1)
@ -48,12 +49,12 @@ class RapidsTests(unittest.TestCase):
df_exp = pd.read_csv(exp_result) df_exp = pd.read_csv(exp_result)
if df_act.empty: if df_act.empty:
print(act_result) print(act_result)
print("The expected output should be empty: {}".format(exp_result)) print("Checking if the output file is empty: {}".format(exp_result))
self.assertTrue(df_exp.empty) self.assertTrue(df_exp.empty)
else: else:
# The order in which the columns varies from time to time so # The order in which the columns varies from time to time so
# the columns are sorted before doing the comparision # the columns are sorted before doing the comparision
print("Comparing: {} and {}".format(act_result, exp_result)) print("Comparing {} and {}".format(act_result, exp_result))
df_exp = df_exp.reindex(sorted(df_exp.columns), axis=1) df_exp = df_exp.reindex(sorted(df_exp.columns), axis=1)
df_act = df_act.reindex(sorted(df_act.columns), axis=1) df_act = df_act.reindex(sorted(df_act.columns), axis=1)
pd.testing.assert_frame_equal(df_exp, df_act, obj=df_exp) pd.testing.assert_frame_equal(df_exp, df_act, obj=df_exp)
@ -94,7 +95,7 @@ def run_some_tests(test_type):
elif test_type == "event": elif test_type == "event":
test_class = TestEvent test_class = TestEvent
else: else:
raise ValueError("Only frequency or periodic are valid arguments") raise ValueError("Only frequency, periodic, and event are valid arguments")
loader = unittest.TestLoader() loader = unittest.TestLoader()
suite = loader.loadTestsFromTestCase(test_class) suite = loader.loadTestsFromTestCase(test_class)

View File

@ -1,10 +1,10 @@
#!/bin/bash #!/bin/bash
run_pipeline() { run_pipeline() {
if [ $TYPE == 'frequency' ] if [ "$TYPE" == 'frequency' ]
then then
CONFIG_FILE="./tests/settings/frequency_config.yaml" CONFIG_FILE="./tests/settings/frequency_config.yaml"
elif [ $TYPE == 'event' ] elif [ "$TYPE" == 'event' ]
then then
CONFIG_FILE="./tests/settings/event_config.yaml" CONFIG_FILE="./tests/settings/event_config.yaml"
else else
@ -12,6 +12,7 @@ run_pipeline() {
fi fi
echo "Copying participant files" echo "Copying participant files"
mkdir -p data/external/participant_files/
cp -r tests/data/external/participant_files/* data/external/participant_files/ cp -r tests/data/external/participant_files/* data/external/participant_files/
echo $TYPE echo $TYPE
@ -23,7 +24,7 @@ run_pipeline() {
} }
display_usage() { display_usage() {
echo "Usage: run_test.sh [-t|--type] [periodic | frequency] [-a|--action] [ all | run | test]" echo "Usage: run_test.sh [-t|--type] [periodic | frequency | event] [-a|--action] [ all | run | both]"
exit 1 exit 1
} }
@ -50,12 +51,7 @@ case $key in
esac esac
done done
if [ $ACTION != 'test' ] && [ $ACTION != 'run' ] && [ $ACTION != 'both' ] if { [ "$TYPE" == 'all' ]; }
then
display_usage
fi
if [[ $TYPE == 'all' ]]
then then
TYPE="frequency" TYPE="frequency"
run_pipeline run_pipeline
@ -63,17 +59,25 @@ then
TYPE="periodic" TYPE="periodic"
run_pipeline run_pipeline
python tests/scripts/run_tests.py periodic python tests/scripts/run_tests.py periodic
TYPE="event"
run_pipeline
python tests/scripts/run_tests.py event
else else
if [ $TYPE != 'frequency' ] && [ $TYPE != 'periodic' ] && [ $TYPE != 'event' ] if { [ "$ACTION" != 'test' ] && [ "$ACTION" != 'run' ] && [ "$ACTION" != 'both' ]; }
then then
display_usage display_usage
fi fi
if { [ $ACTION == 'run' ] || [ $ACTION == 'both' ]; } if { [ "$TYPE" != 'frequency' ] && [ "$TYPE" != 'periodic' ] && [ "$TYPE" != 'event' ]; }
then
display_usage
fi
if { [ "$ACTION" == 'run' ] || [ "$ACTION" == 'both' ]; }
then then
run_pipeline run_pipeline
fi fi
if { [ $ACTION == 'test' ] || [ $ACTION == 'both' ]; } if { [ "$ACTION" == 'test' ] || [ "$ACTION" == 'both' ]; }
then then
python tests/scripts/run_tests.py $(echo $TYPE) python tests/scripts/run_tests.py $(echo $TYPE)
fi fi