@@ -45,8 +45,8 @@ run_s2i_build() {
4545 ct_s2i_build_as_df file://${test_dir} /test-app ${IMAGE_NAME} ${IMAGE_NAME} -testapp ${s2i_args} $( ct_build_s2i_npm_variables) $1
4646}
4747
48- run_s2i_fips () {
49- ct_s2i_build_as_df file://${test_dir} /test-fips${IMAGE_NAME} ${IMAGE_NAME} -testfips ${s2i_args} $( ct_build_s2i_npm_variables) $1
48+ run_s2i_build_fips () {
49+ ct_s2i_build_as_df file://${test_dir} /test-fips ${IMAGE_NAME} ${IMAGE_NAME} -testfips ${s2i_args} $( ct_build_s2i_npm_variables) $1
5050}
5151
5252run_s2i_build_proxy () {
@@ -157,7 +157,7 @@ prepare() {
157157
158158run_test_application () {
159159 case " $1 " in
160- app|hw|express-webapp|binary)
160+ app|fips| hw|express-webapp|binary)
161161 cid_file=$CID_FILE_DIR /$( mktemp -u -p . --suffix=.cid)
162162 docker run -d --user=100001 $( ct_mount_ca_file) --rm --cidfile=${cid_file} $2 ${IMAGE_NAME} -test$1
163163 ;;
@@ -170,7 +170,7 @@ run_test_application() {
170170
171171run_test_application_with_quoted_args () {
172172 case " $1 " in
173- app | hw | express-webapp | binary)
173+ app | fips | hw | express-webapp | binary)
174174 cid_file=$CID_FILE_DIR /$( mktemp -u -p . --suffix=.cid)
175175 docker run -d --user=100001 $( ct_mount_ca_file) --rm --cidfile=${cid_file} " $2 " ${IMAGE_NAME} -test$1
176176 ;;
@@ -495,12 +495,12 @@ function test_nodejs_fips_mode() {
495495 if [[ " $is_fips_enabled " == " 0" ]]; then
496496 # FIPS disabled -- crypto.getFips() should return 0
497497 echo " Fips should be disabled"
498- docker run --rm ${IMAGE_NAME} -testapp /bin/bash -c " node -e 'const crypto = require(\" crypto\" ); process.exit(crypto.getFips());'"
498+ docker run --rm ${IMAGE_NAME} -testfips /bin/bash -c " node -e 'const crypto = require(\" crypto\" ); process.exit(crypto.getFips());'"
499499 ct_check_testcase_result " $? "
500500 else
501501 # FIPS enabled -- crypto.getFips() should return 1
502502 echo " Fips should be enabled"
503- docker run --rm ${IMAGE_NAME} -testapp /bin/bash -c " ! node -e 'const crypto = require(\" crypto\" ); process.exit(crypto.getFips());'"
503+ docker run --rm ${IMAGE_NAME} -testfips /bin/bash -c " ! node -e 'const crypto = require(\" crypto\" ); process.exit(crypto.getFips());'"
504504 ct_check_testcase_result " $? "
505505 fi
506506}
@@ -575,6 +575,25 @@ function test_run_app_application() {
575575 wait_for_cid
576576}
577577
578+ function test_run_fips_app_application() {
579+ local is_fips_enabled
580+
581+ # Read fips mode from host in case exists
582+ if [[ -f /proc/sys/crypto/fips_enabled ]]; then
583+ is_fips_enabled=$( cat /proc/sys/crypto/fips_enabled)
584+ else
585+ is_fips_enabled=" 0"
586+ fi
587+ if [[ " $is_fips_enabled " == " 1" ]]; then
588+ # Verify that the HTTP connection can be established to test application container
589+ run_test_application fips
590+ # Wait for the container to write it's CID file
591+ wait_for_cid
592+ ct_check_testcase_result $?
593+ kill_test_application
594+ fi
595+ }
596+
578597function test_run_hw_application() {
579598 # Verify that the HTTP connection can be established to test application container
580599 run_test_application hw
0 commit comments