@@ -1017,10 +1017,13 @@ teardown() {
10171017 run --keep-empty-lines --separate-stderr " $TOOLBX " create --image " $image " " $containerName " <<< " y"
10181018
10191019 assert_success
1020- assert_line --index 0 " Image ' $image ' is not a Toolbx image and may not work properly (see https://containertoolbx.org/doc/). Continue anyway? [y/N]: Created container: $containerName "
1021- assert_line --index 1 " Enter with: toolbox enter $containerName "
1020+ assert_line --index 0 " ${MSG_CONFIRMATION_PROMPT} $( created_container_message " $containerName " ) "
1021+ assert_line --index 1 " $( enter_with_message " $containerName " ) "
10221022 assert [ ${# lines[@]} -eq 2 ]
1023- assert [ ${# stderr_lines[@]} -eq 0 ]
1023+
1024+ lines=(" ${stderr_lines[@]} " )
1025+ assert_line --index 0 " $( warning_non_toolbx_image " $image " ) "
1026+ assert [ ${# stderr_lines[@]} -eq 1 ]
10241027
10251028 run podman ps --all
10261029
@@ -1035,9 +1038,12 @@ teardown() {
10351038 run --keep-empty-lines --separate-stderr " $TOOLBX " create --image " $image " " $containerName " <<< " n"
10361039
10371040 assert_success
1038- assert_line --index 0 " Image ' $image ' is not a Toolbx image and may not work properly (see https://containertoolbx.org/doc/). Continue anyway? [y/N]: "
1041+ assert_line --index 0 " ${MSG_CONFIRMATION_PROMPT} "
10391042 assert [ ${# lines[@]} -eq 1 ]
1040- assert [ ${# stderr_lines[@]} -eq 0 ]
1043+
1044+ lines=(" ${stderr_lines[@]} " )
1045+ assert_line --index 0 " $( warning_non_toolbx_image " $image " ) "
1046+ assert [ ${# stderr_lines[@]} -eq 1 ]
10411047
10421048 run podman ps --all
10431049
@@ -1052,10 +1058,205 @@ teardown() {
10521058 run --keep-empty-lines --separate-stderr " $TOOLBX " create --assumeyes --image " $image " " $containerName "
10531059
10541060 assert_success
1055- assert_line --index 0 " Created container: $containerName "
1056- assert_line --index 1 " Enter with: toolbox enter $containerName "
1061+ assert_line --index 0 " $( created_container_message " $containerName " ) "
1062+ assert_line --index 1 " $( enter_with_message " $containerName " ) "
10571063 assert [ ${# lines[@]} -eq 2 ]
1058- assert [ ${# stderr_lines[@]} -eq 0 ]
1064+
1065+ lines=(" ${stderr_lines[@]} " )
1066+ assert_line --index 0 " $( warning_non_toolbx_image " $image " ) "
1067+ assert [ ${# stderr_lines[@]} -eq 1 ]
1068+
1069+ run podman ps --all
1070+
1071+ assert_success
1072+ assert_output --regexp " Created[[:blank:]]+$containerName "
1073+ }
1074+
1075+ @test " create: With an image with LD_PRELOAD set and prompt for confirmation - Yes" {
1076+ containerName=" test-container-ld-preload"
1077+ image=" $( build_image_with_ld_preload) "
1078+
1079+ run --keep-empty-lines --separate-stderr " $TOOLBX " create --image " $image " " $containerName " <<< " y"
1080+
1081+ assert_success
1082+ assert_line --index 0 " ${MSG_CONFIRMATION_PROMPT} $( created_container_message " $containerName " ) "
1083+ assert_line --index 1 " $( enter_with_message " $containerName " ) "
1084+ assert [ ${# lines[@]} -eq 2 ]
1085+
1086+ lines=(" ${stderr_lines[@]} " )
1087+ assert_line --index 0 " $( warning_ld_preload_image " $image " ) "
1088+ assert [ ${# stderr_lines[@]} -eq 1 ]
1089+
1090+ run podman ps --all
1091+
1092+ assert_success
1093+ assert_output --regexp " Created[[:blank:]]+$containerName "
1094+ }
1095+
1096+ @test " create: With an image with LD_PRELOAD set and prompt for confirmation - No" {
1097+ containerName=" test-container-ld-preload"
1098+ image=" $( build_image_with_ld_preload) "
1099+
1100+ run --keep-empty-lines --separate-stderr " $TOOLBX " create --image " $image " " $containerName " <<< " n"
1101+
1102+ assert_success
1103+ assert_line --index 0 " ${MSG_CONFIRMATION_PROMPT} "
1104+ assert [ ${# lines[@]} -eq 1 ]
1105+
1106+ lines=(" ${stderr_lines[@]} " )
1107+ assert_line --index 0 " $( warning_ld_preload_image " $image " ) "
1108+ assert [ ${# stderr_lines[@]} -eq 1 ]
1109+
1110+ run podman ps --all
1111+
1112+ assert_success
1113+ assert [ ${# lines[@]} -eq 1 ]
1114+ }
1115+
1116+ @test " create: With an image with LD_PRELOAD set and prompt for confirmation - assumeyes" {
1117+ containerName=" test-container-ld-preload"
1118+ image=" $( build_image_with_ld_preload) "
1119+
1120+ run --keep-empty-lines --separate-stderr " $TOOLBX " --assumeyes create --image " $image " " $containerName "
1121+
1122+ assert_success
1123+ assert_line --index 0 " $( created_container_message " $containerName " ) "
1124+ assert_line --index 1 " $( enter_with_message " $containerName " ) "
1125+ assert [ ${# lines[@]} -eq 2 ]
1126+
1127+ lines=(" ${stderr_lines[@]} " )
1128+ assert_line --index 0 " $( warning_ld_preload_image " $image " ) "
1129+ assert [ ${# stderr_lines[@]} -eq 1 ]
1130+
1131+ run podman ps --all
1132+
1133+ assert_success
1134+ assert_output --regexp " Created[[:blank:]]+$containerName "
1135+ }
1136+
1137+ @test " create: With an image with an entrypoint set and prompt for confirmation - Yes" {
1138+ containerName=" test-container-entrypoint"
1139+ image=" $( build_image_with_entrypoint) "
1140+
1141+ run --keep-empty-lines --separate-stderr " $TOOLBX " create --image " $image " " $containerName " <<< " y"
1142+
1143+ assert_success
1144+ assert_line --index 0 " ${MSG_CONFIRMATION_PROMPT} $( created_container_message " $containerName " ) "
1145+ assert_line --index 1 " $( enter_with_message " $containerName " ) "
1146+ assert [ ${# lines[@]} -eq 2 ]
1147+
1148+ lines=(" ${stderr_lines[@]} " )
1149+ assert_line --index 0 " $( warning_entrypoint_image " $image " ) "
1150+ assert [ ${# stderr_lines[@]} -eq 1 ]
1151+
1152+ run podman ps --all
1153+
1154+ assert_success
1155+ assert_output --regexp " Created[[:blank:]]+$containerName "
1156+ }
1157+
1158+ @test " create: With an image with an entrypoint set and prompt for confirmation - No" {
1159+ containerName=" test-container-entrypoint"
1160+ image=" $( build_image_with_entrypoint) "
1161+
1162+ run --keep-empty-lines --separate-stderr " $TOOLBX " create --image " $image " " $containerName " <<< " n"
1163+
1164+ assert_success
1165+ assert_line --index 0 " ${MSG_CONFIRMATION_PROMPT} "
1166+ assert [ ${# lines[@]} -eq 1 ]
1167+
1168+ lines=(" ${stderr_lines[@]} " )
1169+ assert_line --index 0 " $( warning_entrypoint_image " $image " ) "
1170+ assert [ ${# stderr_lines[@]} -eq 1 ]
1171+
1172+ run podman ps --all
1173+
1174+ assert_success
1175+ assert [ ${# lines[@]} -eq 1 ]
1176+ }
1177+
1178+ @test " create: With an image with an entrypoint set and prompt for confirmation - assumeyes" {
1179+ containerName=" test-container-entrypoint"
1180+ image=" $( build_image_with_entrypoint) "
1181+
1182+ run --keep-empty-lines --separate-stderr " $TOOLBX " --assumeyes create --image " $image " " $containerName "
1183+
1184+ assert_success
1185+ assert_line --index 0 " $( created_container_message " $containerName " ) "
1186+ assert_line --index 1 " $( enter_with_message " $containerName " ) "
1187+ assert [ ${# lines[@]} -eq 2 ]
1188+
1189+ lines=(" ${stderr_lines[@]} " )
1190+ assert_line --index 0 " $( warning_entrypoint_image " $image " ) "
1191+ assert [ ${# stderr_lines[@]} -eq 1 ]
1192+
1193+ run podman ps --all
1194+
1195+ assert_success
1196+ assert_output --regexp " Created[[:blank:]]+$containerName "
1197+ }
1198+
1199+ @test " create: With an image having all warnings and prompt for confirmation - Yes" {
1200+ containerName=" test-container-all-warnings"
1201+ image=" $( build_image_with_all_warnings) "
1202+
1203+ run --keep-empty-lines --separate-stderr " $TOOLBX " create --image " $image " " $containerName " <<< " y"
1204+
1205+ assert_success
1206+ assert_line --index 0 " ${MSG_CONFIRMATION_PROMPT} $( created_container_message " $containerName " ) "
1207+ assert_line --index 1 " $( enter_with_message " $containerName " ) "
1208+ assert [ ${# lines[@]} -eq 2 ]
1209+
1210+ lines=(" ${stderr_lines[@]} " )
1211+ assert_line --index 0 " $( warning_non_toolbx_image " $image " ) "
1212+ assert_line --index 1 " $( warning_ld_preload_image " $image " ) "
1213+ assert_line --index 2 " $( warning_entrypoint_image " $image " ) "
1214+ assert [ ${# stderr_lines[@]} -eq 3 ]
1215+
1216+ run podman ps --all
1217+
1218+ assert_success
1219+ assert_output --regexp " Created[[:blank:]]+$containerName "
1220+ }
1221+
1222+ @test " create: With an image having all warnings and prompt for confirmation - No" {
1223+ containerName=" test-container-all-warnings"
1224+ image=" $( build_image_with_all_warnings) "
1225+
1226+ run --keep-empty-lines --separate-stderr " $TOOLBX " create --image " $image " " $containerName " <<< " n"
1227+
1228+ assert_success
1229+ assert_line --index 0 " ${MSG_CONFIRMATION_PROMPT} "
1230+ assert [ ${# lines[@]} -eq 1 ]
1231+
1232+ lines=(" ${stderr_lines[@]} " )
1233+ assert_line --index 0 " $( warning_non_toolbx_image " $image " ) "
1234+ assert_line --index 1 " $( warning_ld_preload_image " $image " ) "
1235+ assert_line --index 2 " $( warning_entrypoint_image " $image " ) "
1236+ assert [ ${# stderr_lines[@]} -eq 3 ]
1237+
1238+ run podman ps --all
1239+
1240+ assert_success
1241+ assert [ ${# lines[@]} -eq 1 ]
1242+ }
1243+
1244+ @test " create: With an image having all warnings and prompt for confirmation - assumeyes" {
1245+ containerName=" test-container-all-warnings"
1246+ image=" $( build_image_with_all_warnings) "
1247+
1248+ run --keep-empty-lines --separate-stderr " $TOOLBX " create --assumeyes --image " $image " " $containerName "
1249+
1250+ assert_success
1251+ assert_line --index 0 " $( created_container_message " $containerName " ) "
1252+ assert_line --index 1 " $( enter_with_message " $containerName " ) "
1253+ assert [ ${# lines[@]} -eq 2 ]
1254+
1255+ lines=(" ${stderr_lines[@]} " )
1256+ assert_line --index 0 " $( warning_non_toolbx_image " $image " ) "
1257+ assert_line --index 1 " $( warning_ld_preload_image " $image " ) "
1258+ assert_line --index 2 " $( warning_entrypoint_image " $image " ) "
1259+ assert [ ${# stderr_lines[@]} -eq 3 ]
10591260
10601261 run podman ps --all
10611262
0 commit comments