Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-45314: add workflow for pytest #30

Merged
merged 15 commits into from
Jul 24, 2024
Merged

DM-45314: add workflow for pytest #30

merged 15 commits into from
Jul 24, 2024

Conversation

bbrondel
Copy link
Collaborator

This change adds a GitHub workflow for pytest and makes modifications that allow the tests to run. It does not correct one failing test. This PR includes changes responsive to comments by @ktlim and @timj. It doesn't fully address DM-45314, but I'd like to go ahead and get this in and then add another ticket.


jobs:
run_lint:
uses: lsst/rubin_workflows/.github/workflows/lint.yaml@main
Copy link
Member

Choose a reason for hiding this comment

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

I'll remake the comment from #29 that these lines should not be here because there is already a lint.yaml workflow in this repo -- it's just that that repo needs to be modernized to the current standard of a reusable workflow (see my comment on the other PR).

Copy link
Member

@timj timj left a comment

Choose a reason for hiding this comment

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

Please change the lint.yaml to using the modern DM standard. I pointed at the location on a previous review comment.

If you are using black and isort (the pre-commit config implies that and you have configuration for it in your pyproject.toml) please also add a conformance github action to ensure that. You can find a formatters.yaml in daf_butler that should work -- just copy it over.

For a service we usually do not float dependencies but have a requirements.txt file that is generated from dependencies. Then we explicitly regenerate the pins and use those.

@ktlim is this service going to be turned into a phalanx service?

run: |
pytest --cov=./ --cov-report=html --html=pytest_report.html --self-contained-html

- name: Upload test report
Copy link
Member

Choose a reason for hiding this comment

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

Please change to using codecov as discussed. I've added the secret to the repo.

Example code at https://github.com/lsst/daf_butler/blob/main/.github/workflows/build.yaml#L92-L98

python-version: "3.11"
cache: "pip"

- name: Editable mode install
Copy link
Member

Choose a reason for hiding this comment

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

You may want to consider separating the install of dependencies from the editable install of the package.

@bbrondel bbrondel merged commit 26cfb50 into main Jul 24, 2024
6 checks passed

name: Run PyTest

on: [push, pull_request]
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this run the action twice on a push to a branch that's already in a PR?

# Environment variables that must be set:
# DB_HOST DB_PASS DB_USER DB_NAME or POSTGRES_URL

# Expose the port.
EXPOSE 8080

ENTRYPOINT [ "gunicorn", "-b", "0.0.0.0:8080", "-w", "2", "pqserver:app" ]
ENTRYPOINT [ "gunicorn", "-b", "0.0.0.0:8080", "-w", "2", "consdb-pq.pqserver:app" ]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm kind of surprised that this works with a hyphen in the name. If it doesn't, changing to just consdb should be fine, too.

@@ -198,16 +198,14 @@ def test_flexible_metadata(client):
assert result["required_keys"] == ["values"]

response = client.post(
"/consdb/insert/latiss",
"/consdb/insert/latiss/exposure/obs/2024032100003",
Copy link
Contributor

Choose a reason for hiding this comment

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

A little weird to have this be different from the values, but perhaps that's an even better test.

@ktlim
Copy link
Contributor

ktlim commented Jul 24, 2024

@timj consdb-pq is deployed under phalanx already (as is consdb-hinfo at the Summit). https://github.com/lsst-sqre/phalanx/tree/main/applications/consdb
But they don't fully embrace the "Phalanx Way".

Among other things, consdb-pq is not supposed to live for a long time, as it should be replaced by Sasquatch + TAP.

@bbrondel bbrondel deleted the tickets/DM-45314 branch August 1, 2024 03:12
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.

3 participants