@@ -49,25 +49,22 @@ describe("health (https)", () => {
49
49
}
50
50
} )
51
51
52
- it ( "/healthz (websocket) with --cert" , async ( ) => {
52
+ it ( "/ (websocket) with --cert" , async ( ) => {
53
53
// NOTES@jsjoeio
54
54
// We connect to /healthz via a websocket
55
55
// and send a message and then we expect it to work
56
56
// with our HTTPS server
57
57
// 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?
67
58
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 = [ ]
69
64
const message = await new Promise ( ( resolve , reject ) => {
70
- ws . on ( "error" , console . error )
65
+ ws . on ( "error" , ( err ) => {
66
+ errorMessages . push ( err )
67
+ } )
71
68
ws . on ( "message" , ( message ) => {
72
69
try {
73
70
const j = JSON . parse ( message . toString ( ) )
@@ -79,6 +76,7 @@ describe("health (https)", () => {
79
76
ws . on ( "open" , ( ) => ws . send ( JSON . stringify ( { event : "health" } ) ) )
80
77
} )
81
78
ws . terminate ( )
79
+ expect ( errorMessages . length ) . toBe ( 0 )
82
80
expect ( message ) . toStrictEqual ( { event : "health" , status : "expired" , lastHeartbeat : 0 } )
83
81
} )
84
82
} )
0 commit comments