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

Test deployments without mocks #483

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

geichelberger
Copy link
Contributor

@geichelberger geichelberger commented May 28, 2024

This change allows to configure the Axios client to use a different base
URL and set the authentication header.

NODE_ENV=development
VITE_TEST_SERVER_URL=https://develop.opencast.org/
VITE_TEST_SERVER_AUTH="admin:opencast"

Fixes #395

@ziegenberg
Copy link
Member

Can you amend the Readme.md with the new ENV options?

@geichelberger
Copy link
Contributor Author

There will be more documentation when it's ready for review. I will refactor it after #472 is merged,

@ziegenberg
Copy link
Member

Can the mock data be re-used for Unit and integration tests? So, should we throw it away with this PR or keep it for later use?

@ziegenberg ziegenberg added the type:code-enhancement Internal improvements to the codebase label May 29, 2024
@geichelberger
Copy link
Contributor Author

The data is not gone. It's still in the commit history.

Copy link
Contributor

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

@ziegenberg
Copy link
Member

The data is not gone. It's still in the commit history.

That's like, "The money isn't gone; it's just somewhere else now". Nobody will remember that the data is still in the commit history. The question is: Can the mock data be re-used for unit and integration tests? If yes, should we keep it for later use?

@geichelberger
Copy link
Contributor Author

To have data that is not used and, therefore, not maintained makes no sense. And with the argumentation that we may need it in the future, we should not remove unused stuff at all.

Copy link
Contributor

Use docker or podman to test this pull request locally.

Run test server using develop.opencast.org as backend:

podman run --rm -it -p 127.0.0.1:3000:3000 ghcr.io/opencast/opencast-admin-interface:pr-483

Specify a different backend like stable.opencast.org:

podman run --rm -it -p 127.0.0.1:3000:3000 -e PROXY_TARGET=https://stable.opencast.org ghcr.io/opencast/opencast-admin-interface:pr-483

It may take a few seconds for the interface to spin up.
It will then be available at http://127.0.0.1:3000.
For more options you can pass on to the proxy, take a look at the README.md.

Copy link
Contributor

This pull request is deployed at test.admin-interface.opencast.org/483/2024-05-31_11-26-37/ .
It might take a few minutes for it to become available.

Copy link
Contributor

This pull request is deployed at test.admin-interface.opencast.org/483/2024-05-31_11-32-22/ .
It might take a few minutes for it to become available.

Copy link
Contributor

github-actions bot commented Jun 4, 2024

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

@geichelberger
Copy link
Contributor Author

Should we document the environment variables? They should only be used in the workflows, and the other workflow-specific variables are not documented either.

@geichelberger geichelberger marked this pull request as ready for review June 4, 2024 09:36
@geichelberger geichelberger changed the title Test without mocks Test deployments without mocks Jun 4, 2024
@geichelberger geichelberger marked this pull request as draft June 4, 2024 16:08
@geichelberger geichelberger marked this pull request as ready for review June 4, 2024 16:26
If you aim to test against a remote server without using a proxy, you have the option to configure the target server with the `VITE_TEST_SERVER_URL`, and the `VITE_TEST_SERVER_AUTH` environment variables while using the node development mode:

```sh
NODE_ENV=development VITE_TEST_SERVER_URL="https://develop.opencast.org" VITE_TEST_SERVER_AUTH="admin:opencast" npm start
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure how common this will be, in testing against localhost I could not get this to work until I put a proxy with a wide open CORS config in between. So VITE_TEST_SERVER_URL="http://localhost:8080" did not work, but VITE_TEST_SERVER_URL="http://localhost" <- now with proxy! did. Would it be worth explaining that here, or am I sufficiently out of touch with frontend dev that this is something that's obvious?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think CORS is Daily Business nowadays, and the Vite proxy would be a better fit for local scenarios.

@geichelberger geichelberger added the type:github_actions Pull requests that update GitHub Actions code label Jun 5, 2024
@ziegenberg ziegenberg added type:infrastructure Build process, deployment, workflows and removed type:code-enhancement Internal improvements to the codebase type:github_actions Pull requests that update GitHub Actions code labels Jun 5, 2024
Copy link
Contributor

github-actions bot commented Jun 5, 2024

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

Copy link
Contributor

github-actions bot commented Jun 6, 2024

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

This change allows to configure the Axios client to use a different base
URL and set the authentication header.

NODE_ENV=development
VITE_TEST_SERVER_URL=https://develop.opencast.org
VITE_TEST_SERVER_AUTH="admin:opencast"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:infrastructure Build process, deployment, workflows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow configuring the base URL for API requests
3 participants