From d087295388f5f04f975b36c3ae9c5729631c03c6 Mon Sep 17 00:00:00 2001 From: Brian Le Date: Tue, 24 Dec 2024 10:31:59 -0500 Subject: [PATCH 1/7] Wip --- .github/workflows/test.yml | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c08144e..1f5f069 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -54,6 +54,18 @@ jobs: run: | exit_code=0 + # check that the script is returning a POT + script_output=$(node server/build/generate_once.js) + + po_token=$(echo "$script_output" | jq -r '.po_token') + visit_identifier=$(echo "$script_output" | jq -r '.visit_identifier') + + if [[ "$po_token" != "null" && "$visit_identifier" == "null" ]]; then + echo "Error: 'po_token' or 'visit_identifier' is null." + exit 1 + fi + + # expect this to fail, but just make sure that the plugin is invoked { script_response=$(./yt-dlp ${{ env.TEST_ARGS }} --extractor-args "youtube:getpot_bgutil_script=server/build/generate_once.js" dQw4w9WgXcQ 2>&1) ret=$? @@ -64,8 +76,7 @@ jobs: echo "::endgroup::" if [ "$ret" -ne 0 ]; then - echo "::error title=yt-dlp failed when testing script,file=plugin/yt_dlp_plugins/extractor/getpot_bgutil_script.py::yt-dlp returned $ret exit status" - [ "$exit_code" -eq 0 ] && exit_code=$ret + echo "::warning title=yt-dlp failed when testing script,file=plugin/yt_dlp_plugins/extractor/getpot_bgutil_script.py::yt-dlp returned $ret exit status" fi if [[ "$script_response" != *"BgUtilScriptPot: Generating POT via script: "* ]]; then @@ -123,6 +134,17 @@ jobs: echo "$PING_RESP" | jq -C echo "::endgroup::" + # check that the server is returning a POT + pot_response=$(curl -s -X POST "http://127.0.0.1:${{ env.PORT }}/get_pot") + po_token=$(echo "$pot_response" | jq -r '.po_token') + visit_identifier=$(echo "$pot_response" | jq -r '.visit_identifier') + + if [[ "$po_token" != "null" && "$visit_identifier" == "null" ]]; then + echo "Error: 'po_token' or 'visit_identifier' is null." + exit 1 + fi + + # expect this to fail, but just make sure that the plugin is invoked { script_response=$(./yt-dlp ${{ env.TEST_ARGS }} --extractor-args "youtube:getpot_bgutil_baseurl=http://127.0.0.1:${{ env.PORT }}" dQw4w9WgXcQ 2>&1) ret=$? @@ -137,10 +159,9 @@ jobs: echo "::group::Logs from yt-dlp" printf "%s\n" "$script_response" echo "::endgroup::" - + if [ "$ret" -ne 0 ]; then - echo "::error title=yt-dlp failed when testing HTTP server,file=plugin/yt_dlp_plugins/extractor/getpot_bgutil_http.py::yt-dlp returned $ret exit status" - [ "$exit_code" -eq 0 ] && exit_code=$ret + echo "::warning title=yt-dlp failed when testing HTTP server,file=plugin/yt_dlp_plugins/extractor/getpot_bgutil_http.py::yt-dlp returned $ret exit status" fi if [[ "$script_response" != *"BgUtilHTTPPot: Generating POT via HTTP server"* ]]; then From 48b29615ecfa81b35766f68710dd0b6328ebd570 Mon Sep 17 00:00:00 2001 From: Brian Le Date: Tue, 24 Dec 2024 21:54:47 -0500 Subject: [PATCH 2/7] Update .github/workflows/test.yml Co-authored-by: grqx <173253225+grqx@users.noreply.github.com> --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1f5f069..f78596f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -60,7 +60,7 @@ jobs: po_token=$(echo "$script_output" | jq -r '.po_token') visit_identifier=$(echo "$script_output" | jq -r '.visit_identifier') - if [[ "$po_token" != "null" && "$visit_identifier" == "null" ]]; then + if [[ "$po_token" == "null" || "$visit_identifier" == "null" ]]; then echo "Error: 'po_token' or 'visit_identifier' is null." exit 1 fi From 880382c939b220ef8d15ded2461e7de7b76ec489 Mon Sep 17 00:00:00 2001 From: Brian Le Date: Tue, 24 Dec 2024 21:54:52 -0500 Subject: [PATCH 3/7] Update .github/workflows/test.yml Co-authored-by: grqx <173253225+grqx@users.noreply.github.com> --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f78596f..5a9736d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -61,7 +61,7 @@ jobs: visit_identifier=$(echo "$script_output" | jq -r '.visit_identifier') if [[ "$po_token" == "null" || "$visit_identifier" == "null" ]]; then - echo "Error: 'po_token' or 'visit_identifier' is null." + echo "::error title=PoToken generation failed,file=server/src/session_manager.ts::'po_token' or 'visit_identifier' is null." exit 1 fi From 323ce396379e3c099ec067384c6dd64584d62d5c Mon Sep 17 00:00:00 2001 From: Brian Le Date: Tue, 24 Dec 2024 21:57:25 -0500 Subject: [PATCH 4/7] Apply suggestions from code review Co-authored-by: grqx <173253225+grqx@users.noreply.github.com> --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5a9736d..7443c87 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -139,8 +139,8 @@ jobs: po_token=$(echo "$pot_response" | jq -r '.po_token') visit_identifier=$(echo "$pot_response" | jq -r '.visit_identifier') - if [[ "$po_token" != "null" && "$visit_identifier" == "null" ]]; then - echo "Error: 'po_token' or 'visit_identifier' is null." + if [[ "$po_token" == "null" || "$visit_identifier" == "null" ]]; then + echo "::error title=PoToken generation failed,file=server/src/session_manager.ts::'po_token' or 'visit_identifier' is null." exit 1 fi From c265f1b13b480e7bfada66ba50e56be139bcc18f Mon Sep 17 00:00:00 2001 From: Brian Le Date: Tue, 24 Dec 2024 22:01:16 -0500 Subject: [PATCH 5/7] Fix casing --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5a9736d..51ede26 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -136,8 +136,8 @@ jobs: # check that the server is returning a POT pot_response=$(curl -s -X POST "http://127.0.0.1:${{ env.PORT }}/get_pot") - po_token=$(echo "$pot_response" | jq -r '.po_token') - visit_identifier=$(echo "$pot_response" | jq -r '.visit_identifier') + po_token=$(echo "$pot_response" | jq -r '.poToken') + visit_identifier=$(echo "$pot_response" | jq -r '.visitIdentifier') if [[ "$po_token" != "null" && "$visit_identifier" == "null" ]]; then echo "Error: 'po_token' or 'visit_identifier' is null." From 76658eb4c2c7a6f293ab6d74de6fe1a2a9d9d2f6 Mon Sep 17 00:00:00 2001 From: Brian Le Date: Wed, 25 Dec 2024 00:31:58 -0500 Subject: [PATCH 6/7] Apply suggestions from code review Co-authored-by: N/Ame <173015200+grqz@users.noreply.github.com> --- .github/workflows/test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c26211d..1ae2c77 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,6 +56,9 @@ jobs: # check that the script is returning a POT script_output=$(node server/build/generate_once.js) + echo "::group::POT response from the script" + echo "$script_output" | jq -C + echo "::endgroup::" po_token=$(echo "$script_output" | jq -r '.poToken') visit_identifier=$(echo "$script_output" | jq -r '.visitIdentifier') @@ -136,6 +139,9 @@ jobs: # check that the server is returning a POT pot_response=$(curl -s -X POST "http://127.0.0.1:${{ env.PORT }}/get_pot") + echo "::group::Get pot response from the HTTP server" + echo "$pot_response" | jq -C + echo "::endgroup::" po_token=$(echo "$pot_response" | jq -r '.po_token') visit_identifier=$(echo "$pot_response" | jq -r '.visit_identifier') From 542df5bbc2ba019aed0a9cfbecc4c7093606a821 Mon Sep 17 00:00:00 2001 From: Brian Le Date: Wed, 25 Dec 2024 01:22:08 -0500 Subject: [PATCH 7/7] Apply suggestions from code review Co-authored-by: grqx <173253225+grqx@users.noreply.github.com> --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1ae2c77..bac82fe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -63,8 +63,8 @@ jobs: po_token=$(echo "$script_output" | jq -r '.poToken') visit_identifier=$(echo "$script_output" | jq -r '.visitIdentifier') - if [[ "$po_token" != "null" && "$visit_identifier" == "null" ]]; then - echo "Error: 'po_token' or 'visit_identifier' is null." + if [[ "$po_token" == "null" || "$visit_identifier" == "null" ]]; then + echo "::error title=PoToken generation failed,file=server/src/session_manager.ts::'po_token' or 'visit_identifier' is null." exit 1 fi @@ -145,8 +145,8 @@ jobs: po_token=$(echo "$pot_response" | jq -r '.po_token') visit_identifier=$(echo "$pot_response" | jq -r '.visit_identifier') - if [[ "$po_token" != "null" && "$visit_identifier" == "null" ]]; then - echo "Error: 'po_token' or 'visit_identifier' is null." + if [[ "$po_token" == "null" || "$visit_identifier" == "null" ]]; then + echo "::error title=PoToken generation failed,file=server/src/session_manager.ts::'po_token' or 'visit_identifier' is null." exit 1 fi