-
Notifications
You must be signed in to change notification settings - Fork 19
test(mirage): correct server authority string in preview builds #1283
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
Conversation
|
Would this patch help? The mock code just needs to get the same wsUrl as in the application code. diff --git a/src/mirage/index.ts b/src/mirage/index.ts
index 61f75db..abea4bf 100644
--- a/src/mirage/index.ts
+++ b/src/mirage/index.ts
@@ -20,11 +20,12 @@ import { Server as WSServer, Client } from 'mock-socket';
import factories from './factories';
import models from './models';
import { Resource } from './typings';
-import { sizeUnits } from 'src/app/utils/utils';
export const startMirage = ({ environment = 'development' } = {}) => {
- const wsUrl = `ws://localhost:9091/api/notifications`;
- const wsServer = new WSServer(wsUrl);
+ const wsUrl = new URL(window.location.href);
+ wsUrl.protocol = wsUrl.protocol.replace('http', 'ws');
+ wsUrl.pathname = '/api/notifications';
+ const wsServer = new WSServer(wsUrl.toString());
// Create a mock server socket to send notifications
let websocket: Client;I tested with and it seemed OK :D yarn build:preview:notests
cd dist && npx browser-sync start --server |
|
Nice, that seems to work. I did the same build-and-local-webserver trick, except instead of Want to commit that patch to this branch so you get credited for the contribution? :) |
|
Haha nicee, sure :D I don't have access to your fork though so I opened: andrewazores#2 |
fix(mirage): ensure wsUrl matches that in application code
|
Ah right, that would be a maintainer privilege that I can add commits to peoples' PRs like that... |
* test(mirage): set server authority string in preview builds * fix(mirage): ensure wsUrl matches that in application code --------- Co-authored-by: Thuan Vo <[email protected]> (cherry picked from commit 3aaeead)
… (#1285) * test(mirage): set server authority string in preview builds * fix(mirage): ensure wsUrl matches that in application code --------- Co-authored-by: Thuan Vo <[email protected]> (cherry picked from commit 3aaeead) Co-authored-by: Andrew Azores <[email protected]>
Welcome to Cryostat! 👋
Before contributing, make sure you have:
mainbranch[chore, ci, docs, feat, fix, test]To recreate commits with GPG signature
git fetch upstream && git rebase --force --gpg-sign upstream/mainFixes: #1271
How to manually test:
yarn start:dev:previewshould bring up the preview/demo UI. There should be a Fake Target, with a Demo template. Topology view should work, dashboard should work, recording start/stop/archive/delete should work, expanding recording for automated analysis should work. GraphQL-powered things will not work, snapshot recording creation does not work.yarn run build:preview:notests && cd dist && python3 -m http.server, then openhttp://localhost:8000in a browser. The preview should work just the same as in the step above.