hexdump is used in common function generate_hex_string which is
used by nova and heat. The current general dependencies do not
have this dependency covered, instead it is usually pulled in by
other implicit dependencies when a full devstack is built. In
cases where only a subset is built (like just Heat and keystone)
hexdump is missing.
Added unit tests for the generate_hex_string function.
Depends-On: Ib47d802a31a0f4c2a49daa7e6698e37c70a2365a
Change-Id: I77c8c2019fb8b8174cdfaed3e56ebf728f0732b7
Closes-Bug: #1558672
(cherry picked from commit d99c29032bb0cc89ffe6874c7b879b84897ff0b0)
(cherry picked from commit 603fc0c6ec58a0fec060a1030e58b5f7e56794d4)
| ... | ... |
@@ -9,6 +9,22 @@ source $TOP/functions |
| 9 | 9 |
|
| 10 | 10 |
source $TOP/tests/unittest.sh |
| 11 | 11 |
|
| 12 |
+echo "Testing generate_hex_string()" |
|
| 13 |
+ |
|
| 14 |
+VAL=$(generate_hex_string 16) |
|
| 15 |
+if [[ ${#VAL} -eq 32 ]]; then
|
|
| 16 |
+ passed "OK" |
|
| 17 |
+else |
|
| 18 |
+ failed "generate_hex_string 16 failed ${#VAL}"
|
|
| 19 |
+fi |
|
| 20 |
+ |
|
| 21 |
+VAL=$(generate_hex_string 32) |
|
| 22 |
+if [[ ${#VAL} -eq 64 ]]; then
|
|
| 23 |
+ passed "OK" |
|
| 24 |
+else |
|
| 25 |
+ failed "generate_hex_string 32 failed ${#VAL}"
|
|
| 26 |
+fi |
|
| 27 |
+ |
|
| 12 | 28 |
echo "Testing die_if_not_set()" |
| 13 | 29 |
|
| 14 | 30 |
bash -c "source $TOP/functions; X=`echo Y && true`; die_if_not_set $LINENO X 'not OK'" |