Skip to content

Run web API test suite in GitHub Actions#1009

Merged
nucleogenic merged 23 commits intodevelopfrom
nucleogenic-webui-gha-tests
Dec 4, 2022
Merged

Run web API test suite in GitHub Actions#1009
nucleogenic merged 23 commits intodevelopfrom
nucleogenic-webui-gha-tests

Conversation

@nucleogenic
Copy link
Copy Markdown
Member

@nucleogenic nucleogenic commented Nov 29, 2022

Added Pytest API test suite to GitHub Actions web workflow.

Example run:

Changes

Refactored Docker infrastructure:

  • Moved various files/directories (sorry for the messy diff!)
  • Added healthchecks to backend and web containers
  • Reduced Docker image sizes
  • Fixed ignore patterns in .dockerignore
  • Various other adjustments (e.g. entrypoints)

Misc:

  • Removed RaSCSI references in various areas (e.g. rascsi -> backend)
  • Added compilation-only step to easyinstall.sh
  • Moved apt package lists to variables in easyinstall.sh
  • Revert to triggering GitHub Actions runs on push as this works better for forks
  • Added logging of Protobuf commands
  • Added logging of HTTP requests
  • Fixed bug in supported browser detection for requests when an absent/unrecognized user agent
  • Updated tests to prefix file names with the test name

@nucleogenic
Copy link
Copy Markdown
Member Author

Note: This should be merged after PR #1010 as the web/frontend_checks paths have been updated to match their new locations in that branch.

Added Pytest API test suite to GitHub Actions web workflow

Refactored Docker infrastructure:
- Fixed ignore patterns in .dockerignore
- Added healthchecks to backend and web containers
- Reduced Docker image sizes

Misc:
- Removed RaSCSI references in various areas (e.g. rascsi -> backend)
- Added compilation-only step to easyinstall.sh
- Moved apt package lists to variables
- Revert to triggering GitHub Actions runs on push
- Updated web/frontend_checks workflow to run black and flake8 against all Python sources
@nucleogenic nucleogenic force-pushed the nucleogenic-webui-gha-tests branch from cb788f6 to d3eac3d Compare November 30, 2022 05:20
@nucleogenic nucleogenic marked this pull request as draft December 3, 2022 04:06
@nucleogenic nucleogenic marked this pull request as ready for review December 3, 2022 20:06
Comment on lines +712 to +716
{% if locale.language == env['locale'] %}
<option value="{{ locale.language }}" selected="selected">
{% else %}
<option value="{{ locale.language }}">
{% endif %}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about adding this logic while implementing localization, but decided against it at the time. It doesn't hurt though. Maybe you were sick of seeing "Deutsch" being selected all the time? ;)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty much! I don't think there's anywhere to see the current locale, otherwise?

# Hardcoded fallback to "en" when the user agent does not send an accept-language header
language = request.accept_languages.best_match(LANGUAGES) or "en"
return language
return session.get("language", request.accept_languages.best_match(LANGUAGES) or "en")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely neater logic. Did you test this will vintage browsers? I recall running into corner cases with Netscape 3/4 last year which is when I added the elaborate logic above.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See updated commit, which restores the log. Will test in Netscape to confirm no regressions.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, so I only tested in Netscape 2.x, as it's what I had available, but works as expected.

I did however find an issue with browser_supports_modern_themes() which I've pushed a commit to fix!

image

except KeyboardInterrupt:
pass
else:
print("Serving rascsi-web...")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove this? It is marginally helpful to know when the startup sequence has reached the bjoern step.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-added generic message higher up, see latest commit. Suggestions for wording welcome (or feel free to change in a future change set!)

cd src

if [[ $ARG_DEV_MODE ]]; then
echo "Starting web UI (auto-reload) ..."
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"auto-reload" is equivalent to "dev mode", right? Any particular reason for not using the same terminology?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-reload is certainly a consequence of the dev mode flag. Swapped it back to dev mode for consistency in latest commit.

@nucleogenic nucleogenic merged commit 88ff542 into develop Dec 4, 2022
@nucleogenic nucleogenic deleted the nucleogenic-webui-gha-tests branch December 5, 2022 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants