Skip to content

Test deployments without mocks#483

Merged
Arnei merged 1 commit intoopencast:mainfrom
geichelberger:test-without-mocks
Apr 1, 2025
Merged

Test deployments without mocks#483
Arnei merged 1 commit intoopencast:mainfrom
geichelberger:test-without-mocks

Conversation

@geichelberger
Copy link
Copy Markdown
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
Copy Markdown
Member

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

@geichelberger
Copy link
Copy Markdown
Contributor Author

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

@ziegenberg
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

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

@github-actions
Copy link
Copy Markdown
Contributor

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

@ziegenberg
Copy link
Copy Markdown
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
Copy Markdown
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.

@github-actions
Copy link
Copy Markdown
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.

@github-actions
Copy link
Copy Markdown
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.

@github-actions
Copy link
Copy Markdown
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.

@github-actions
Copy link
Copy Markdown
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
Copy Markdown
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
Comment thread README.md
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
Copy Markdown
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
Copy Markdown
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
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2024

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 6, 2024

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

Copy link
Copy Markdown
Member

@Arnei Arnei left a comment

Choose a reason for hiding this comment

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

Wow, this has been utterly forgotten >.>. Looks good to me though, just one checkstyle complaint.

Comment thread src/index.tsx Outdated
@geichelberger geichelberger force-pushed the test-without-mocks branch 2 times, most recently from e751cef to 75bc669 Compare March 31, 2025 11:07
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"
@Arnei Arnei merged commit 4d555c4 into opencast:main Apr 1, 2025
4 of 5 checks passed
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

4 participants