@@ -49,25 +49,22 @@ describe("health (https)", () => {
4949 }
5050 } )
5151
52- it ( "/healthz (websocket) with --cert" , async ( ) => {
52+ it ( "/ (websocket) with --cert" , async ( ) => {
5353 // NOTES@jsjoeio
5454 // We connect to /healthz via a websocket
5555 // and send a message and then we expect it to work
5656 // with our HTTPS server
5757 // and the cert arg passed in as well.
58- // Notes from Slack
59- // Ahser said "we could connect it to /vscode
60- // Add the appropriate query variables (it expects connectionType and some other things, probably easiest to look at the browser and see)
61- // Then it might be enough to just see if that connection errors or not
62- // If it does not error then you probably have to try actually sending some data on it"
63- // Not sure what do do there. Guess I need to spin up code-server
64- // and look at the network tab.
65- // Also confused on the /healthz vs /vscode part
66- // The websocket runs on /healthz. Is that it?
6758 codeServer = await integration . setup ( [ "--auth=none" , "--cert" ] , "" )
68- const ws = codeServer . ws ( "/healthz" )
59+ // NOTE@jsjoeio - do we need to use a dynamic reconnection token that we get from somewhere?
60+ const ws = codeServer . ws (
61+ "/?type=ExtensionHost&reconnectionToken=dc170cd8-e33c-4519-a6a3-5ef050c27e59&reconnection=false&skipWebSocketFrames=false" ,
62+ )
63+ const errorMessages = [ ]
6964 const message = await new Promise ( ( resolve , reject ) => {
70- ws . on ( "error" , console . error )
65+ ws . on ( "error" , ( err ) => {
66+ errorMessages . push ( err )
67+ } )
7168 ws . on ( "message" , ( message ) => {
7269 try {
7370 const j = JSON . parse ( message . toString ( ) )
@@ -79,6 +76,7 @@ describe("health (https)", () => {
7976 ws . on ( "open" , ( ) => ws . send ( JSON . stringify ( { event : "health" } ) ) )
8077 } )
8178 ws . terminate ( )
79+ expect ( errorMessages . length ) . toBe ( 0 )
8280 expect ( message ) . toStrictEqual ( { event : "health" , status : "expired" , lastHeartbeat : 0 } )
8381 } )
8482} )
0 commit comments