Skip to content

Conversation

@anondo1969
Copy link
Member

@anondo1969 anondo1969 commented Apr 22, 2025

Status

Ready for review.

Description

Source: https://scilifelab.atlassian.net/browse/SS-1219

Creating Django views to manage e2e_test data.

  1. Data can be managed (creation and deletion of users, projects, and apps) via Django view endpoints.

  2. Integrated with Cypress e2e tests.

  3. The Cypress test configuration is customizable, making it easy to revert to the previous script-based seeding method if needed.

  4. Two levels of security are ensured:

    • (a) Accessible only when DEBUG mode is True
    • (b) CSRF token required
  5. Unit test cases have also been written.

Types of changes

new feature

Checklist

If you're unsure about any of the items below, don't hesitate to ask. We're here to help!
This is simply a reminder of what we are going to look for before merging your code.

  • This pull request is against develop branch (not applicable for hotfixes)
  • I have included a link to the issue on GitHub or JIRA (if any)
  • I have included migration files (if there are changes to the model classes)
  • I have included, reviewed and executed tests (unit and end2end) to complement my changes
  • I have updated the related documentation (if necessary)
  • I have added a reviewer for this pull request
  • I have added myself as an author for this pull request
  • In the case I have modified settings.py, then I have also updated the studio-settings-configmap.yaml file in serve-charts

Further comments

@anondo1969 anondo1969 self-assigned this Apr 22, 2025
@anondo1969 anondo1969 added the enhancement Improvement of existing feature or request label Apr 22, 2025
@anondo1969 anondo1969 requested a review from j-awada April 22, 2025 11:39
@anondo1969 anondo1969 marked this pull request as ready for review April 22, 2025 11:39
@anondo1969 anondo1969 requested a review from a team as a code owner April 22, 2025 11:40
wait_db_reset: 60000,
create_resources: true,
run_extended_k8s_checks: false,
populate_test_data_management_views_secret: process.env.POPULATE_TEST_DATA_MANAGEMENT_VIEWS_SECRET,
Copy link
Contributor

Choose a reason for hiding this comment

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

It only works if I hard-code this variable here

Copy link
Member Author

Choose a reason for hiding this comment

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

I re-wrote it with 'dotenv'

@j-awada
Copy link
Contributor

j-awada commented Apr 23, 2025

In general I think an endpoint to seed data in the database is something useful. This endpoint would be hidden and used against the dev database when it is wiped out (or can be used locally). I imagined test suites running somewhat isolated when it comes to fixtures/data eg. Pytest and Cypress running with their respective data. From what I understand it here in this PR, we are allowing local Cypress tests to run against the dev database on the dev cluster remotely. I can't think of a use-case for such flexibility. Usually I run Cypress locally as well as manually on my branch on GitHub. This is just a thought but maybe I'm missing another use-case for this feature here.

@churnikov
Copy link
Contributor

churnikov commented Apr 24, 2025

From what I understand it here in this PR, we are allowing local Cypress tests to run against the dev database on the dev cluster remotely. I can't think of a use-case for such flexibility.

There are a few use cases that I can remember that made us consider creating this task:

  1. Some of us at the time of the tasks creation could not run serve locally with apps deployment working or didn't have enough resources locally to do this.
  2. We would be able to modify the current e2e github action setup with this. I believe it's supposed to help us speed up this workflow. This goes hand in hand with restoring automatic deployment of code on dev.

I might be wrong here, but I believe that's where this idea comes from.

@anondo1969
Copy link
Member Author

Thanks Jana and Nikita. For now I am keeping it in this way. This is configurable in cpypress.config.js, so we can disable it if we want in the future anytime.

@j-awada
Copy link
Contributor

j-awada commented Apr 25, 2025

Fair enough.
E2E and pytest now pass locally.
Was curious if you've tried running the E2E tests locally against the dev database?

@churnikov
Copy link
Contributor

Was curious if you've tried running the E2E tests locally against the dev database?

Do you mean using this branch or ever before?:)

I believe we tried doing it before.

@j-awada
Copy link
Contributor

j-awada commented Apr 28, 2025

Was curious if you've tried running the E2E tests locally against the dev database?

Do you mean using this branch or ever before?:)

I believe we tried doing it before.

This branch. I think @anondo1969 is in the process of trying to run the E2E tests locally against the dev instance but is facing some IP/permissions issues.

@anondo1969
Copy link
Member Author

Was curious if you've tried running the E2E tests locally against the dev database?

Do you mean using this branch or ever before?:)
I believe we tried doing it before.

This branch. I think @anondo1969 is in the process of trying to run the E2E tests locally against the dev instance but is facing some IP/permissions issues.

I am not sure if it is due to running the scripts. I can access it via browser though.

@anondo1969
Copy link
Member Author

Was curious if you've tried running the E2E tests locally against the dev database?

Do you mean using this branch or ever before?:)
I believe we tried doing it before.

This branch. I think @anondo1969 is in the process of trying to run the E2E tests locally against the dev instance but is facing some IP/permissions issues.

I am not sure if it is due to running the scripts. I can access it via browser though.

I checked and now I don't have this error anymore.

@anondo1969 anondo1969 requested a review from a team April 29, 2025 07:49
Copy link
Contributor

@j-awada j-awada left a comment

Choose a reason for hiding this comment

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

lgtm

@anondo1969 anondo1969 merged commit 15e224c into develop May 5, 2025
3 checks passed
@anondo1969 anondo1969 deleted the SS-1219_django_view_to_create_and_remove_e2e_test_data branch May 5, 2025 14:58
anondo1969 added a commit that referenced this pull request May 8, 2025
Source: https://scilifelab.atlassian.net/browse/SS-1219

Creating Django views to manage e2e_test data.

Data can be managed (creation and deletion of users, projects, and apps) via Django view endpoints.

Integrated with Cypress e2e tests.

The Cypress test configuration is customizable, making it easy to revert to the previous script-based seeding method if needed.

Two levels of security are ensured:

(a) Accessible only when DEBUG mode is True
(b) CSRF token required

 Unit test cases have also been written.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement of existing feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants