From 2b87c946b0153ff7152c6ba58a2f435a60d1681c Mon Sep 17 00:00:00 2001 From: Daniel Garcia Briseno Date: Tue, 9 Dec 2025 12:29:53 -0500 Subject: [PATCH 01/18] Update php.yml to use new gh actions --- .github/workflows/php.yml | 118 ++++++-------------------------------- 1 file changed, 16 insertions(+), 102 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 4e1f45ab..2d7f2b7b 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -13,44 +13,26 @@ jobs: php-integration-tests: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - - name: Checkout the Dockerfile for local Helioviewer - uses: actions/checkout@v4 + - name: Setup Helioviewer Docker environment + uses: Helioviewer-Project/helioviewer.org-docker/.github/actions/helioviewer-docker@main with: - repository: 'Helioviewer-Project/helioviewer.org-docker' - path: 'compose' - sparse-checkout: | - compose.yaml - .env.example - sparse-checkout-cone-mode: false - - name: Setup environment file - run: mv compose/.env.example ../.env - - - name: Start local Helioviewer environment - id: docker - run: | - mv compose/compose.yaml .. - cd .. - # I quit. This keeps failing saying coordinator is unhealthy. - # It is healthy. The next step 'Print container logs' says it is healthy - # Just ignore. docker compose up is already tested that it goes "up" - # in order to be on the main branch. - docker compose up --wait api || true + api-ref: ${{ github.sha }} - name: Print container logs if: always() + working-directory: helioviewer.org-docker run: | - cd .. docker container list docker compose logs # Run the tests inside the api container - name: Run phpunit tests - run: docker exec -t helioviewer-api-1 composer run-script test + working-directory: helioviewer.org-docker + run: docker compose exec -T api composer run-script test - name: Run python tests - run: docker exec -t helioviewer-api-1 composer run-script test-python + working-directory: helioviewer.org-docker + run: docker compose exec -T api composer run-script test-python playwright-e2e-tests: strategy: matrix: @@ -62,65 +44,12 @@ jobs: timeout-minutes: 60 runs-on: ubuntu-latest steps: - - name: Checkout the code under test - uses: actions/checkout@v4 - with: - submodules: true - path: 'api' - - name: Checkout the latest Helioviewer Front End - uses: actions/checkout@v4 - with: - repository: 'Helioviewer-Project/helioviewer.org' - path: 'helioviewer.org' - - name: Checkout test code - uses: actions/checkout@v4 - with: - repository: 'Helioviewer-Project/helioviewer.org-tests' - path: 'tests' - # See https://github.com/actions/checkout?tab=readme-ov-file#fetch-only-a-single-file - - name: Checkout the Dockerfile for local Helioviewer - uses: actions/checkout@v4 - with: - repository: 'Helioviewer-Project/helioviewer.org-docker' - path: 'compose' - sparse-checkout: | - compose.yaml - .env.example - sparse-checkout-cone-mode: false - - name: Setup environment file - run: mv compose/.env.example .env - - name: Start local Helioviewer environment - id: docker - run: | - mv compose/compose.yaml . - docker compose up -d --wait - - name: Show docker compose logs - if: always() - run: | - docker compose logs - cat compose.yaml - - name: Fix cache directory permissions - if: always() - run: | - docker compose exec web chown 33:33 cache - - uses: actions/setup-node@v4 - with: - node-version: lts/* - - name: Install Playwright Browsers - run: | - cd tests - npm ci - npx playwright install --with-deps - name: Run Playwright tests - run: | - cd tests - npx playwright test --shard=${{matrix.shardIndex}}/${{matrix.shardTotal}} - - uses: actions/upload-artifact@v4 - if: always() + uses: Helioviewer-Project/helioviewer.org-tests/.github/actions/playwright-test@main with: - name: blob-report-${{matrix.shardIndex}} - path: tests/blob-report/ - retention-days: 1 + api-ref: ${{ github.sha }} + shard-index: ${{ matrix.shardIndex }} + shard-total: ${{ matrix.shardTotal }} merge-reports: # Merge reports after playwright-tests, even if some shards have failed if: ${{ !cancelled() }} @@ -132,24 +61,9 @@ jobs: uses: actions/checkout@v4 with: repository: 'Helioviewer-Project/helioviewer.org-tests' - - uses: actions/setup-node@v4 - with: - node-version: lts/* - - name: Install dependencies - run: npm ci - - name: Download blob reports from GitHub Actions Artifacts - uses: actions/download-artifact@v4 - with: - path: all-blob-reports - pattern: blob-report-* - merge-multiple: true - - - name: Merge into HTML Report - run: npx playwright merge-reports --reporter html ./all-blob-reports + path: 'helioviewer.org-tests' - - name: Upload HTML report - uses: actions/upload-artifact@v4 + - name: Merge Playwright reports + uses: Helioviewer-Project/helioviewer.org-tests/.github/actions/playwright-merge-reports@main with: - name: html-report--attempt-${{ github.run_attempt }} - path: playwright-report - retention-days: 5 + test-repo-path: 'helioviewer.org-tests' From d1cd7631c73a70595a4fa696ab06067d098569f0 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Briseno Date: Tue, 9 Dec 2025 12:30:22 -0500 Subject: [PATCH 02/18] Rename php.yml to ci.yml for gh actions --- .github/workflows/{php.yml => ci.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{php.yml => ci.yml} (100%) diff --git a/.github/workflows/php.yml b/.github/workflows/ci.yml similarity index 100% rename from .github/workflows/php.yml rename to .github/workflows/ci.yml From 0cdefbf07b0937032a459d05a1bd52faad479c6b Mon Sep 17 00:00:00 2001 From: Daniel Garcia Briseno Date: Tue, 9 Dec 2025 12:33:42 -0500 Subject: [PATCH 03/18] Use github.ref instead of github.sha --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d7f2b7b..3db4de4f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - name: Setup Helioviewer Docker environment uses: Helioviewer-Project/helioviewer.org-docker/.github/actions/helioviewer-docker@main with: - api-ref: ${{ github.sha }} + api-ref: ${{ github.ref }} - name: Print container logs if: always() From 29f43ad99eea1fef2d2d2ee40f1ead2e922cfe8f Mon Sep 17 00:00:00 2001 From: Daniel Garcia Briseno Date: Thu, 11 Dec 2025 10:28:53 -0500 Subject: [PATCH 04/18] Print docker logs after php tests --- .github/workflows/ci.yml | 80 ++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3db4de4f..36a10976 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,14 +18,7 @@ jobs: with: api-ref: ${{ github.ref }} - - name: Print container logs - if: always() - working-directory: helioviewer.org-docker - run: | - docker container list - docker compose logs - - # Run the tests inside the api container + # Run tests inside the api container - name: Run phpunit tests working-directory: helioviewer.org-docker run: docker compose exec -T api composer run-script test @@ -33,37 +26,44 @@ jobs: - name: Run python tests working-directory: helioviewer.org-docker run: docker compose exec -T api composer run-script test-python - playwright-e2e-tests: - strategy: - matrix: - shardIndex: [1, 2, 3, 4, 5] - shardTotal: [5] - # If one of the shards fails, continue running the remaining tests - fail-fast: false - - timeout-minutes: 60 - runs-on: ubuntu-latest - steps: - - name: Run Playwright tests - uses: Helioviewer-Project/helioviewer.org-tests/.github/actions/playwright-test@main - with: - api-ref: ${{ github.sha }} - shard-index: ${{ matrix.shardIndex }} - shard-total: ${{ matrix.shardTotal }} - merge-reports: - # Merge reports after playwright-tests, even if some shards have failed - if: ${{ !cancelled() }} - needs: [playwright-e2e-tests] - runs-on: ubuntu-latest - steps: - - name: Checkout test code - uses: actions/checkout@v4 - with: - repository: 'Helioviewer-Project/helioviewer.org-tests' - path: 'helioviewer.org-tests' + - name: Print container logs + if: always() + working-directory: helioviewer.org-docker + run: | + docker compose logs - - name: Merge Playwright reports - uses: Helioviewer-Project/helioviewer.org-tests/.github/actions/playwright-merge-reports@main - with: - test-repo-path: 'helioviewer.org-tests' +# playwright-e2e-tests: +# strategy: +# matrix: +# shardIndex: [1, 2, 3, 4, 5] +# shardTotal: [5] +# # If one of the shards fails, continue running the remaining tests +# fail-fast: false +# +# timeout-minutes: 60 +# runs-on: ubuntu-latest +# steps: +# - name: Run Playwright tests +# uses: Helioviewer-Project/helioviewer.org-tests/.github/actions/playwright-test@main +# with: +# api-ref: ${{ github.sha }} +# shard-index: ${{ matrix.shardIndex }} +# shard-total: ${{ matrix.shardTotal }} +# merge-reports: +# # Merge reports after playwright-tests, even if some shards have failed +# if: ${{ !cancelled() }} +# needs: [playwright-e2e-tests] +# +# runs-on: ubuntu-latest +# steps: +# - name: Checkout test code +# uses: actions/checkout@v4 +# with: +# repository: 'Helioviewer-Project/helioviewer.org-tests' +# path: 'helioviewer.org-tests' +# +# - name: Merge Playwright reports +# uses: Helioviewer-Project/helioviewer.org-tests/.github/actions/playwright-merge-reports@main +# with: +# test-repo-path: 'helioviewer.org-tests' From ce01b3ac289e547c95760f94392e8c7a87c3c580 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Briseno Date: Thu, 11 Dec 2025 11:28:24 -0500 Subject: [PATCH 05/18] Add more logging to workflow --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36a10976..1305abb8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,11 @@ jobs: run: | docker compose logs + - name: Print API error logs + if: always() + working-directory: helioviewer.org-docker/api + run: cat * + # playwright-e2e-tests: # strategy: # matrix: From 694bd282a51cc9660c5eb9e33c7b621d17c1704e Mon Sep 17 00:00:00 2001 From: Daniel Garcia Briseno Date: Thu, 11 Dec 2025 11:35:22 -0500 Subject: [PATCH 06/18] Fix log path --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1305abb8..ec0094aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: - name: Print API error logs if: always() - working-directory: helioviewer.org-docker/api + working-directory: helioviewer.org-docker/data/log run: cat * # playwright-e2e-tests: From 3c4d269a04b810d82885f23d32ce99ac28339055 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Briseno Date: Thu, 11 Dec 2025 11:51:15 -0500 Subject: [PATCH 07/18] Add more logging to movie builder --- src/Movie/HelioviewerMovie.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Movie/HelioviewerMovie.php b/src/Movie/HelioviewerMovie.php index cef0b9d5..d8fb0cdc 100644 --- a/src/Movie/HelioviewerMovie.php +++ b/src/Movie/HelioviewerMovie.php @@ -275,7 +275,7 @@ public function build() { } catch (Exception $e) { Sentry::capture($e); - $this->_abort('Error encountered during movie frame compilation: ' . $e->getFile() . ":" . $e->getLine() . " - " . $e->getMessage() ); + $this->_abort('Error encountered during movie frame compilation: ' . $e->getFile() . ":" . $e->getLine() . " - " . $e->getMessage() . "\n" . $e->getTraceAsString()); } $t3 = time(); @@ -289,7 +289,8 @@ public function build() { $t4 = time(); $this->_abort('Error encountered during video encoding. ' . 'This may be caused by an FFmpeg configuration issue, ' . - 'or by insufficient permissions in the cache.', $t4 - $t3); + 'or by insufficient permissions in the cache.' . "\n" . + $e->getFile() . ":" . $e->getLine() . " - " . $e->getMessage() . "\n" . $e->getTraceAsString(), $t4 - $t3); } // Log buildMovie in statistics table From cf957ca824ca3517a433a74af07def0e711be1a0 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Briseno Date: Thu, 11 Dec 2025 12:19:56 -0500 Subject: [PATCH 08/18] Add more debug info --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec0094aa..0eb0a2d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,8 +35,12 @@ jobs: - name: Print API error logs if: always() - working-directory: helioviewer.org-docker/data/log - run: cat * + working-directory: helioviewer.org-docker + run: | + docker compose exec -T api whoami + docker compose exec -T api ls -lh docroot/cache + ls -lh data/cache + cat data/log/* # playwright-e2e-tests: # strategy: From 5490b8d43f9b4eec0227e24b2c03301dd4db153e Mon Sep 17 00:00:00 2001 From: Daniel Garcia Briseno Date: Thu, 11 Dec 2025 12:35:31 -0500 Subject: [PATCH 09/18] update logging --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0eb0a2d2..666f7755 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,6 @@ jobs: if: always() working-directory: helioviewer.org-docker run: | - docker compose exec -T api whoami docker compose exec -T api ls -lh docroot/cache ls -lh data/cache cat data/log/* From 6d4bf699d29f0bcf59f2c032f5d2fd48e2d2b72e Mon Sep 17 00:00:00 2001 From: Daniel Garcia Briseno Date: Thu, 11 Dec 2025 12:48:22 -0500 Subject: [PATCH 10/18] trying to figure out why movie is failing even though it's not. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 666f7755..68af49b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,8 +37,8 @@ jobs: if: always() working-directory: helioviewer.org-docker run: | - docker compose exec -T api ls -lh docroot/cache - ls -lh data/cache + ls -lh data/cache/movies/2025/12/11/V666n + cat data/cache/movies/2025/12/11/V666n/ffmpeg.log cat data/log/* # playwright-e2e-tests: From 4075e09e5200dd0b8a6e49b7968afface16983c3 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Briseno Date: Thu, 11 Dec 2025 14:17:11 -0500 Subject: [PATCH 11/18] Add more logging to ffmpeg --- src/Movie/FFMPEGEncoder.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Movie/FFMPEGEncoder.php b/src/Movie/FFMPEGEncoder.php index 08d98920..c1da8c47 100644 --- a/src/Movie/FFMPEGEncoder.php +++ b/src/Movie/FFMPEGEncoder.php @@ -73,8 +73,13 @@ public function createVideo($convertHQ = false) } // If FFmpeg segfaults, an empty movie container may still be produced, - if (!file_exists($outputFile) || filesize($outputFile) < 1000) - throw new Exception("FFmpeg error encountered.", 43); + if (!file_exists($outputFile)) { + throw new Exception("FFMpeg error encountered - movie file $outputFile does not exist"); + } + $fsize = filesize($outputFile); + if ($fsize < 1000) { + throw new Exception("FFmpeg error encountered - Expected movie to be at least 1000 bytes, got $fsize ($outputFile)", 43); + } return $outputFile; } From 6cd0f7b4fd8cfc2f6ce324cfceba1874157b995f Mon Sep 17 00:00:00 2001 From: Daniel Garcia Briseno Date: Thu, 11 Dec 2025 14:29:59 -0500 Subject: [PATCH 12/18] . --- .github/workflows/ci.yml | 2 +- src/Movie/FFMPEGEncoder.php | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68af49b6..3c273a9e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: working-directory: helioviewer.org-docker run: | ls -lh data/cache/movies/2025/12/11/V666n - cat data/cache/movies/2025/12/11/V666n/ffmpeg.log + ls -lh data/cache/movies/2025/12/11/1666n cat data/log/* # playwright-e2e-tests: diff --git a/src/Movie/FFMPEGEncoder.php b/src/Movie/FFMPEGEncoder.php index c1da8c47..90974688 100644 --- a/src/Movie/FFMPEGEncoder.php +++ b/src/Movie/FFMPEGEncoder.php @@ -55,6 +55,17 @@ public function __construct($directory, $filename, $frameRate, $width, $height, $this->_log = fopen($directory . 'ffmpeg.log', 'a'); } + private function checkVideoOutput($outputFile) { + // If FFmpeg segfaults, an empty movie container may still be produced, + if (!file_exists($outputFile)) { + throw new Exception("FFMpeg error encountered - movie file $outputFile does not exist"); + } + $fsize = filesize($outputFile); + if ($fsize < 1000) { + throw new Exception("FFmpeg error encountered - Expected movie to be at least 1000 bytes, got $fsize ($outputFile)", 43); + } + } + /** * Creates a medium quality video */ @@ -72,14 +83,7 @@ public function createVideo($convertHQ = false) $this->_createWebMVideo($outputFile); } - // If FFmpeg segfaults, an empty movie container may still be produced, - if (!file_exists($outputFile)) { - throw new Exception("FFMpeg error encountered - movie file $outputFile does not exist"); - } - $fsize = filesize($outputFile); - if ($fsize < 1000) { - throw new Exception("FFmpeg error encountered - Expected movie to be at least 1000 bytes, got $fsize ($outputFile)", 43); - } + $this->checkVideoOutput($outputFile); return $outputFile; } @@ -98,9 +102,8 @@ public function createHQVideo() $this->_createWebMVideo($outputFile, 1); } - // If FFmpeg segfaults, an empty movie container may still be produced - if (!file_exists($outputFile) || filesize($outputFile) < 1000) - throw new Exception("FFmpeg error encountered.", 43); + // If FFmpeg segfaults, an empty movie container may still be produced, + $this->checkVideoOutput($outputFile); return $outputFile; } From 935c7abc924548ccea9b91fe475f4b57ed68b25f Mon Sep 17 00:00:00 2001 From: Daniel Garcia Briseno Date: Thu, 11 Dec 2025 14:46:29 -0500 Subject: [PATCH 13/18] Add pytest command from docker repo --- .github/workflows/ci.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c273a9e..5d72d096 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,8 +24,9 @@ jobs: run: docker compose exec -T api composer run-script test - name: Run python tests - working-directory: helioviewer.org-docker - run: docker compose exec -T api composer run-script test-python + uses: Helioviewer-Project/helioviewer.org-docker/.github/actions/pytest-api@main + with: + working-directory: helioviewer.org-docker - name: Print container logs if: always() @@ -36,10 +37,7 @@ jobs: - name: Print API error logs if: always() working-directory: helioviewer.org-docker - run: | - ls -lh data/cache/movies/2025/12/11/V666n - ls -lh data/cache/movies/2025/12/11/1666n - cat data/log/* + run: cat data/log/* # playwright-e2e-tests: # strategy: From 74041760f466e573cea4022f2464a24ce4fdd42e Mon Sep 17 00:00:00 2001 From: Daniel Garcia Briseno Date: Thu, 11 Dec 2025 14:48:38 -0500 Subject: [PATCH 14/18] Update test to use env for API host --- install/__test__/test_vso_sunpy_download.py | 82 +++++++++++---------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/install/__test__/test_vso_sunpy_download.py b/install/__test__/test_vso_sunpy_download.py index 48bb2a44..7f4c4db8 100644 --- a/install/__test__/test_vso_sunpy_download.py +++ b/install/__test__/test_vso_sunpy_download.py @@ -1,40 +1,42 @@ -from unittest.mock import patch -import responses -import unittest -import requests -import os - -class TestVsoDownload(unittest.TestCase): - - @patch("sunpy.net.Fido.fetch") - @responses.activate - def test_getImageGroup(self, fido_fetch_response): - # Allow requests to localhost to go through. - responses.add_passthru("http://localhost") - URL = "http://localhost/?action=getSciDataScript&imageScale=4.84088176&sourceIds=[13,10]&startDate=2021-06-01T00:01:00Z&endDate=2021-06-01T00:01:15Z&lang=sunpy&provider=vso"; - - response = requests.get(URL) - - self.assertEqual(200, response.status_code) - self.assertEqual("OK", response.reason) - - script_with_paths = response.content.replace(b'os.path.expanduser(\'~/\')', bytes('\'/tmp/\'', encoding='utf-8')) - - try: - script_for_compile = compile(script_with_paths, '', 'exec', flags=0, dont_inherit=True) - except SyntaxError: - self.fail("Test Fail: Could not compile downloaded sunpy vso script , possible error in script") - - test_dir = os.path.dirname(os.path.abspath(__file__)) - request_path = os.path.join(test_dir, 'mocked_requests', 'vso_sunpy_download.yaml') - responses._add_from_file(file_path=request_path) - - fido_fetch_response.return_value = ['theoretical_file.fits'] - locals = {}; - exec(script_for_compile,globals(), locals) - - self.assertEqual(len(locals['data_aia_304']), 1) - self.assertEqual(len(locals['data_aia_171']), 1) - -if __name__ == '__main__': - unittest.main() +from unittest.mock import patch +import responses +import unittest +import requests +import os + +class TestVsoDownload(unittest.TestCase): + + @patch("sunpy.net.Fido.fetch") + @responses.activate + def test_getImageGroup(self, fido_fetch_response): + # Get API host from environment variable, default to localhost + host = os.environ.get('PYTEST_API_HOST', 'localhost') + # Allow requests to the configured host to go through. + responses.add_passthru(f"http://{host}") + URL = f"http://{host}/?action=getSciDataScript&imageScale=4.84088176&sourceIds=[13,10]&startDate=2021-06-01T00:01:00Z&endDate=2021-06-01T00:01:15Z&lang=sunpy&provider=vso" + + response = requests.get(URL) + + self.assertEqual(200, response.status_code) + self.assertEqual("OK", response.reason) + + script_with_paths = response.content.replace(b'os.path.expanduser(\'~/\')', bytes('\'/tmp/\'', encoding='utf-8')) + + try: + script_for_compile = compile(script_with_paths, '', 'exec', flags=0, dont_inherit=True) + except SyntaxError: + self.fail("Test Fail: Could not compile downloaded sunpy vso script , possible error in script") + + test_dir = os.path.dirname(os.path.abspath(__file__)) + request_path = os.path.join(test_dir, 'mocked_requests', 'vso_sunpy_download.yaml') + responses._add_from_file(file_path=request_path) + + fido_fetch_response.return_value = ['theoretical_file.fits'] + locals = {}; + exec(script_for_compile,globals(), locals) + + self.assertEqual(len(locals['data_aia_304']), 1) + self.assertEqual(len(locals['data_aia_171']), 1) + +if __name__ == '__main__': + unittest.main() From efbdb09dc748c097b3ae799561094e0865e23c23 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Briseno Date: Thu, 11 Dec 2025 15:02:02 -0500 Subject: [PATCH 15/18] Do the unthinkable --- src/Movie/FFMPEGEncoder.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Movie/FFMPEGEncoder.php b/src/Movie/FFMPEGEncoder.php index 90974688..8478e62d 100644 --- a/src/Movie/FFMPEGEncoder.php +++ b/src/Movie/FFMPEGEncoder.php @@ -58,7 +58,15 @@ public function __construct($directory, $filename, $frameRate, $width, $height, private function checkVideoOutput($outputFile) { // If FFmpeg segfaults, an empty movie container may still be produced, if (!file_exists($outputFile)) { - throw new Exception("FFMpeg error encountered - movie file $outputFile does not exist"); + // Wait a moment for buffers to flush? + // Idk, this kept failing on github actions, but the file exists and + // all other logs indicated making the movie was successful, and yet this exception + // got thrown repeatedly. + sleep(1) + // If it's still not there, then fine, throw the error. + if (!file_exists($outputFile)) { + throw new Exception("FFMpeg error encountered - movie file $outputFile does not exist"); + } } $fsize = filesize($outputFile); if ($fsize < 1000) { From 3588d07d25dcd8543dd6968652758c81f442d8ab Mon Sep 17 00:00:00 2001 From: Daniel Garcia Briseno Date: Thu, 11 Dec 2025 15:08:21 -0500 Subject: [PATCH 16/18] oop --- src/Movie/FFMPEGEncoder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Movie/FFMPEGEncoder.php b/src/Movie/FFMPEGEncoder.php index 8478e62d..6215f5f2 100644 --- a/src/Movie/FFMPEGEncoder.php +++ b/src/Movie/FFMPEGEncoder.php @@ -62,7 +62,7 @@ private function checkVideoOutput($outputFile) { // Idk, this kept failing on github actions, but the file exists and // all other logs indicated making the movie was successful, and yet this exception // got thrown repeatedly. - sleep(1) + sleep(1); // If it's still not there, then fine, throw the error. if (!file_exists($outputFile)) { throw new Exception("FFMpeg error encountered - movie file $outputFile does not exist"); From 03469ec88301f6b75855cb06c8df191200217253 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Briseno Date: Fri, 12 Dec 2025 10:09:56 -0500 Subject: [PATCH 17/18] Disable movie builder while running php tests --- .github/workflows/ci.yml | 4 ++++ src/Movie/FFMPEGEncoder.php | 10 +--------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d72d096..313a8151 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,10 @@ jobs: with: api-ref: ${{ github.ref }} + - name: Disable movie builder (required for tests) + working-directory: helioviewer.org-docker + run: docker compose down movies + # Run tests inside the api container - name: Run phpunit tests working-directory: helioviewer.org-docker diff --git a/src/Movie/FFMPEGEncoder.php b/src/Movie/FFMPEGEncoder.php index 6215f5f2..90974688 100644 --- a/src/Movie/FFMPEGEncoder.php +++ b/src/Movie/FFMPEGEncoder.php @@ -58,15 +58,7 @@ public function __construct($directory, $filename, $frameRate, $width, $height, private function checkVideoOutput($outputFile) { // If FFmpeg segfaults, an empty movie container may still be produced, if (!file_exists($outputFile)) { - // Wait a moment for buffers to flush? - // Idk, this kept failing on github actions, but the file exists and - // all other logs indicated making the movie was successful, and yet this exception - // got thrown repeatedly. - sleep(1); - // If it's still not there, then fine, throw the error. - if (!file_exists($outputFile)) { - throw new Exception("FFMpeg error encountered - movie file $outputFile does not exist"); - } + throw new Exception("FFMpeg error encountered - movie file $outputFile does not exist"); } $fsize = filesize($outputFile); if ($fsize < 1000) { From ae7f81a6e79787f6fbe1a93cba60c0ee40018fb3 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Briseno Date: Fri, 12 Dec 2025 10:35:44 -0500 Subject: [PATCH 18/18] Enable playwright tests --- .github/workflows/ci.yml | 68 ++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 313a8151..ee8e4fbe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,37 +43,37 @@ jobs: working-directory: helioviewer.org-docker run: cat data/log/* -# playwright-e2e-tests: -# strategy: -# matrix: -# shardIndex: [1, 2, 3, 4, 5] -# shardTotal: [5] -# # If one of the shards fails, continue running the remaining tests -# fail-fast: false -# -# timeout-minutes: 60 -# runs-on: ubuntu-latest -# steps: -# - name: Run Playwright tests -# uses: Helioviewer-Project/helioviewer.org-tests/.github/actions/playwright-test@main -# with: -# api-ref: ${{ github.sha }} -# shard-index: ${{ matrix.shardIndex }} -# shard-total: ${{ matrix.shardTotal }} -# merge-reports: -# # Merge reports after playwright-tests, even if some shards have failed -# if: ${{ !cancelled() }} -# needs: [playwright-e2e-tests] -# -# runs-on: ubuntu-latest -# steps: -# - name: Checkout test code -# uses: actions/checkout@v4 -# with: -# repository: 'Helioviewer-Project/helioviewer.org-tests' -# path: 'helioviewer.org-tests' -# -# - name: Merge Playwright reports -# uses: Helioviewer-Project/helioviewer.org-tests/.github/actions/playwright-merge-reports@main -# with: -# test-repo-path: 'helioviewer.org-tests' + playwright-e2e-tests: + strategy: + matrix: + shardIndex: [1, 2, 3, 4, 5] + shardTotal: [5] + # If one of the shards fails, continue running the remaining tests + fail-fast: false + + timeout-minutes: 60 + runs-on: ubuntu-latest + steps: + - name: Run Playwright tests + uses: Helioviewer-Project/helioviewer.org-tests/.github/actions/playwright-test@main + with: + api-ref: ${{ github.sha }} + shard-index: ${{ matrix.shardIndex }} + shard-total: ${{ matrix.shardTotal }} + merge-reports: + # Merge reports after playwright-tests, even if some shards have failed + if: ${{ !cancelled() }} + needs: [playwright-e2e-tests] + + runs-on: ubuntu-latest + steps: + - name: Checkout test code + uses: actions/checkout@v4 + with: + repository: 'Helioviewer-Project/helioviewer.org-tests' + path: 'helioviewer.org-tests' + + - name: Merge Playwright reports + uses: Helioviewer-Project/helioviewer.org-tests/.github/actions/playwright-merge-reports@main + with: + test-repo-path: 'helioviewer.org-tests'