From 680ac283997c43c817ff640e7fa7c37b646d1a3e Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Tue, 25 Feb 2025 09:02:50 +0100 Subject: [PATCH 1/5] Move test_run_binary_application to 'upstream' tests Add support for testing 'test-upstream' RHEL7 is already obsoleted. Remove conditions Signed-off-by: Petr "Stone" Hracek --- .github/workflows/container-tests.yml | 2 +- test/run | 1 - test/run-upstream | 1 + test/test-lib-nodejs.sh | 35 +++++++++------------------ 4 files changed, 13 insertions(+), 26 deletions(-) diff --git a/.github/workflows/container-tests.yml b/.github/workflows/container-tests.yml index c06232b1..23bd73d7 100644 --- a/.github/workflows/container-tests.yml +++ b/.github/workflows/container-tests.yml @@ -19,7 +19,7 @@ jobs: if: | github.event.issue.pull_request - && (contains(github.event.comment.body, '[test]') || contains(github.event.comment.body, '[test-all]')) + && (contains(github.event.comment.body, '[test]') || contains(github.event.comment.body, '[test-upstream]') || contains(github.event.comment.body, '[test-all]')) && contains(fromJson('["OWNER", "MEMBER"]'), github.event.comment.author_association) steps: - uses: sclorg/tfaga-wrapper@main diff --git a/test/run b/test/run index 1104a421..434110d2 100755 --- a/test/run +++ b/test/run @@ -30,7 +30,6 @@ test_init_wrapper_false_development " TEST_LIST_BINARY="\ -test_run_binary_application test_node_cmd_development_init_wrapper_true " diff --git a/test/run-upstream b/test/run-upstream index 16a779ea..8c54d857 100755 --- a/test/run-upstream +++ b/test/run-upstream @@ -27,6 +27,7 @@ test_client_cloudevents test_client_fastify test_client_pino test_client_langchainjs +test_run_binary_application " readonly EXPRESS_REVISION="${EXPRESS_REVISION:-$(docker run --rm "${IMAGE_NAME}" -- npm show express version)}" diff --git a/test/test-lib-nodejs.sh b/test/test-lib-nodejs.sh index 1487f825..68f1cbeb 100644 --- a/test/test-lib-nodejs.sh +++ b/test/test-lib-nodejs.sh @@ -522,45 +522,32 @@ function test_dev_mode_true_development() { } function test_node_cmd_production_init_wrapper_false() { - if [ "$OS" != "rhel7" ]; then - # NODE_ENV=production INIT_WRAPPER=false NODE_CMD="node server.js" - test_node_cmd app production false "node server.js" - fi + test_node_cmd app production false "node server.js" } function test_node_cmd_development_init_wrapper_true() { - if [ "$OS" != "rhel7" ]; then - # NODE_ENV=development INIT_WRAPPER=true NODE_CMD="node server.js" - test_node_cmd app development true "node server.js" - fi + # NODE_ENV=development INIT_WRAPPER=true NODE_CMD="node server.js" + test_node_cmd app development true "node server.js" } function test_node_cmd_production_init_wrapper_true() { - if [ "$OS" != "rhel7" ]; then - # NODE_ENV=production INIT_WRAPPER=true NODE_CMD="node server.js" - test_node_cmd app production true "node server.js" - fi + # NODE_ENV=production INIT_WRAPPER=true NODE_CMD="node server.js" + test_node_cmd app production true "node server.js" } function test_node_cmd_development_init_wrapper_false() { - if [ "$OS" != "rhel7" ]; then - # NODE_ENV=development INIT_WRAPPER=false NODE_CMD="node server.js" - test_node_cmd app development false "node server.js" - fi + # NODE_ENV=development INIT_WRAPPER=false NODE_CMD="node server.js" + test_node_cmd app development false "node server.js" } function test_init_wrapper_true_development() { - if [ "$OS" != "rhel7" ]; then - # NODE_ENV=development INIT_WRAPPER=true - test_node_cmd app development true - fi + # NODE_ENV=development INIT_WRAPPER=true + test_node_cmd app development true } function test_init_wrapper_false_development() { - if [ "$OS" != "rhel7" ]; then - # NODE_ENV=development INIT_WRAPPER=true - test_node_cmd app development false - fi + # NODE_ENV=development INIT_WRAPPER=true + test_node_cmd app development false } function test_dev_mode_false_development() { From 4338b52fd45a5c184f11b9ff1d52cd3267441764 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Wed, 26 Feb 2025 12:25:12 +0100 Subject: [PATCH 2/5] Add more traces to docker inspect Signed-off-by: Petr "Stone" Hracek --- test/test-lib-nodejs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-lib-nodejs.sh b/test/test-lib-nodejs.sh index 68f1cbeb..8c7aed50 100644 --- a/test/test-lib-nodejs.sh +++ b/test/test-lib-nodejs.sh @@ -26,7 +26,7 @@ check_prep_result() { } image_exists() { - docker inspect $1 &>/dev/null + docker inspect $1 } container_exists() { From 766d2a4e460d85aba9ce73c27d9318ed7259cff9 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Wed, 26 Feb 2025 12:26:40 +0100 Subject: [PATCH 3/5] Redirect docker inspect output to /dev/null Signed-off-by: Petr "Stone" Hracek --- test/test-lib-nodejs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-lib-nodejs.sh b/test/test-lib-nodejs.sh index 8c7aed50..b9f00b21 100644 --- a/test/test-lib-nodejs.sh +++ b/test/test-lib-nodejs.sh @@ -26,7 +26,7 @@ check_prep_result() { } image_exists() { - docker inspect $1 + docker inspect $1 1>/dev/null } container_exists() { From 7b7ccb5e85b7e8ac15b74f4c966d278c53c2c81c Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Tue, 18 Mar 2025 13:48:02 +0100 Subject: [PATCH 4/5] Moving binary tests to test-upstream suite Signed-off-by: Petr "Stone" Hracek --- test/run | 18 +----------------- test/run-upstream | 20 ++++++++++++++++++++ test/test-binary/{hw.js => binary.js} | 0 test/test-binary/package.json | 6 +++--- test/test-lib-nodejs.sh | 3 +++ 5 files changed, 27 insertions(+), 20 deletions(-) rename test/test-binary/{hw.js => binary.js} (100%) diff --git a/test/run b/test/run index 434110d2..ea10d20e 100755 --- a/test/run +++ b/test/run @@ -29,10 +29,6 @@ test_init_wrapper_true_development test_init_wrapper_false_development " -TEST_LIST_BINARY="\ -test_node_cmd_development_init_wrapper_true -" - TEST_LIST_NODE_ENV="\ test_run_app_application test_connection @@ -163,16 +159,4 @@ evaluate_build_result $? "proxy" TEST_SET=${TESTS:-$TEST_LIST_HW} ct_run_tests_from_testset "hw" -if [[ "$VERSION" != "18" ]]; then - # This test is not available for NodeJS-18 - # There is a traceback in NodeJS. It reached EOL support. - #npm ERR! gyp ERR! System Linux 6.9.12-200.fc40.x86_64 - #npm ERR! gyp ERR! command "/usr/bin/node-18" "/usr/lib/node_modules_18/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" - #npm ERR! gyp ERR! cwd /opt/app-root/src/node_modules/node-rdkafka - #npm ERR! gyp ERR! node -v v18.19.0 - #npm ERR! gyp ERR! node-gyp -v v10.0.1 - #npm ERR! gyp ERR! not ok - TEST_SET=${TESTS:-$TEST_LIST_BINARY} ct_run_tests_from_testset "binary" - - cleanup -fi +cleanup diff --git a/test/run-upstream b/test/run-upstream index 8c54d857..81a658c8 100755 --- a/test/run-upstream +++ b/test/run-upstream @@ -27,6 +27,9 @@ test_client_cloudevents test_client_fastify test_client_pino test_client_langchainjs +" + +TEST_LIST_BINARY="\ test_run_binary_application " @@ -69,3 +72,20 @@ ct_init cid_file=$CID_FILE_DIR/$(mktemp -u -p . --suffix=.cid) TEST_SET=${TESTS:-$TEST_LIST_CLIENTS} ct_run_tests_from_testset "clients" + +cleanup + +if [[ "$VERSION" != "18" ]]; then + # This test is not available for NodeJS-18 + # There is a traceback in NodeJS. It reached EOL support. + #npm ERR! gyp ERR! System Linux 6.9.12-200.fc40.x86_64 + #npm ERR! gyp ERR! command "/usr/bin/node-18" "/usr/lib/node_modules_18/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" + #npm ERR! gyp ERR! cwd /opt/app-root/src/node_modules/node-rdkafka + #npm ERR! gyp ERR! node -v v18.19.0 + #npm ERR! gyp ERR! node-gyp -v v10.0.1 + #npm ERR! gyp ERR! not ok + TEST_SET=${TESTS:-$TEST_LIST_BINARY} ct_run_tests_from_testset "binary" + + cleanup + +fi \ No newline at end of file diff --git a/test/test-binary/hw.js b/test/test-binary/binary.js similarity index 100% rename from test/test-binary/hw.js rename to test/test-binary/binary.js diff --git a/test/test-binary/package.json b/test/test-binary/package.json index 15998a8d..d04ec1f7 100644 --- a/test/test-binary/package.json +++ b/test/test-binary/package.json @@ -1,7 +1,7 @@ { "name": "hello-world", "version": "0.0.1", - "main": "hw.js", + "main": "binary.js", "engine": { "node": "*", "npm": "*" @@ -10,8 +10,8 @@ "node-rdkafka": "*" }, "scripts": { - "start": "node hw.js", - "dev": "node hw.js" + "start": "node binary.js", + "dev": "node binary.js" }, "license": "" } diff --git a/test/test-lib-nodejs.sh b/test/test-lib-nodejs.sh index b9f00b21..e969de19 100644 --- a/test/test-lib-nodejs.sh +++ b/test/test-lib-nodejs.sh @@ -692,7 +692,10 @@ function test_latest_imagestreams() { function cleanup() { info "Cleaning up the test application image ${IMAGE_NAME}-testapp" if image_exists ${IMAGE_NAME}-testapp; then + info "Image ${IMAGE_NAME}-testapp exist...removing it" docker rmi -f ${IMAGE_NAME}-testapp + echo $? + info "Removed by docker rmi ${IMAGE_NAME}-testapp" fi } From 068c96391298bc3521298307feb8bf6ce1adaac3 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Tue, 18 Mar 2025 15:34:30 +0100 Subject: [PATCH 5/5] DO not call 'cleanup' in 'run-upstream' Signed-off-by: Petr "Stone" Hracek --- test/run-upstream | 4 ---- test/test-lib-nodejs.sh | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/test/run-upstream b/test/run-upstream index 81a658c8..d847549a 100755 --- a/test/run-upstream +++ b/test/run-upstream @@ -73,8 +73,6 @@ cid_file=$CID_FILE_DIR/$(mktemp -u -p . --suffix=.cid) TEST_SET=${TESTS:-$TEST_LIST_CLIENTS} ct_run_tests_from_testset "clients" -cleanup - if [[ "$VERSION" != "18" ]]; then # This test is not available for NodeJS-18 # There is a traceback in NodeJS. It reached EOL support. @@ -86,6 +84,4 @@ if [[ "$VERSION" != "18" ]]; then #npm ERR! gyp ERR! not ok TEST_SET=${TESTS:-$TEST_LIST_BINARY} ct_run_tests_from_testset "binary" - cleanup - fi \ No newline at end of file diff --git a/test/test-lib-nodejs.sh b/test/test-lib-nodejs.sh index e969de19..3a2b426c 100644 --- a/test/test-lib-nodejs.sh +++ b/test/test-lib-nodejs.sh @@ -408,9 +408,9 @@ function test_running_client_js { prepare "$1" check_prep_result $? $1 || return run_s2i_build_client "$1" - ct_check_testcase_result $? + ct_check_testcase_result $? || return run_client_test_suite "$1" - ct_check_testcase_result $? + ct_check_testcase_result $? || return } function test_client_express() {