Test that the RPC invoker returns the correct port and URL when the JupyterLab server starts successfully
(t *testing.T)
| 105 | |
| 106 | // Test that the RPC invoker returns the correct port and URL when the JupyterLab server starts successfully |
| 107 | func TestStartJupyterServerSuccess(t *testing.T) { |
| 108 | resp := jupyter.GetRunningServerResponse{ |
| 109 | Port: strconv.Itoa(1234), |
| 110 | ServerUrl: "http://localhost:1234?token=1234", |
| 111 | Message: "", |
| 112 | Result: true, |
| 113 | } |
| 114 | |
| 115 | server := newMockServer() |
| 116 | server.JupyterServerHostServerMock.GetRunningServerFunc = func(context.Context, *jupyter.GetRunningServerRequest) (*jupyter.GetRunningServerResponse, error) { |
| 117 | return &resp, nil |
| 118 | } |
| 119 | |
| 120 | invoker, stop, err := createTestInvoker(t, server) |
| 121 | if err != nil { |
| 122 | t.Fatalf("error connecting to internal server: %v", err) |
| 123 | } |
| 124 | defer stop() |
| 125 | |
| 126 | port, url, err := invoker.StartJupyterServer(context.Background()) |
| 127 | if err != nil { |
| 128 | t.Fatalf("expected %v, got %v", nil, err) |
| 129 | } |
| 130 | if strconv.Itoa(port) != resp.Port { |
| 131 | t.Fatalf("expected %s, got %d", resp.Port, port) |
| 132 | } |
| 133 | if url != resp.ServerUrl { |
| 134 | t.Fatalf("expected %s, got %s", resp.ServerUrl, url) |
| 135 | } |
| 136 | |
| 137 | verifyNotifyCodespaceOfClientActivity(t, server) |
| 138 | } |
| 139 | |
| 140 | // Test that the RPC invoker returns an error when the JupyterLab server fails to start |
| 141 | func TestStartJupyterServerFailure(t *testing.T) { |
nothing calls this directly
no test coverage detected