@@ -12,7 +12,16 @@ run_robot_test(){
12
12
local container_name=" $1 "
13
13
local service_name=" $2 "
14
14
15
- docker exec -i $container_name bash -lc " cd /nso/run/packages/$service_name /tests && robot $service_name .robot"
15
+ local TOKEN_SUCCESS=" 0 failed"
16
+ local output=$( docker exec -i $container_name bash -lc " cd /nso/run/packages/$service_name /tests && robot $service_name .robot" )
17
+
18
+ if echo " $output " | grep -q " $TOKEN_SUCCESS " ; then
19
+ # This test passed!
20
+ echo 1
21
+ else
22
+ # This test didn't pass!
23
+ echo 0
24
+ fi
16
25
}
17
26
18
27
YAML_FILE_CONFIG=" pipeline/setup/config.yaml"
@@ -25,8 +34,6 @@ if [ -z "$1" ]; then
25
34
exit 1
26
35
fi
27
36
28
- echo " ##### [🤖] Executing Robot tests of each service.... #####"
29
-
30
37
# Extract the name of the container and remove quotes
31
38
CONTAINER_NAME_PATH=" .services.$1 .container_name"
32
39
container_name=$( yq " $CONTAINER_NAME_PATH " " $YAML_FILE_DOCKER " )
@@ -39,6 +46,7 @@ ned_packages=$(yq "$NEDS_PATH" "$YAML_FILE_CONFIG")
39
46
all_packages=($( ls -d " $PACKAGES_DIR " /* / | xargs -n 1 basename) )
40
47
41
48
# Iterate over each folder and check if it's in the excluded list
49
+ all_tests_passed=1
42
50
for package in " ${all_packages[@]} " ; do
43
51
44
52
is_ned=0
@@ -51,8 +59,19 @@ for package in "${all_packages[@]}"; do
51
59
done
52
60
53
61
if [[ $is_ned == 0 ]]; then
54
- run_robot_test $container_name $package
62
+ this_test_pass=$( run_robot_test $container_name $package )
63
+
64
+ # If at least one test didn't pass. This job is declared a failure
65
+ if [[ $this_test_pass == 0 ]]; then
66
+ all_tests_passed=0
67
+ fi
55
68
fi
56
69
done
57
70
58
- echo " [🤖] Robot test cases done!"
71
+ if [[ $all_tests_passed == 0 ]]; then
72
+ # The job failed
73
+ echo " failed"
74
+ else
75
+ # The job is successful
76
+ echo " pass"
77
+ fi
0 commit comments