Test that the RPC invoker returns an error when the JupyterLab server fails to start
(t *testing.T)
| 138 | |
| 139 | // Test that the RPC invoker returns an error when the JupyterLab server fails to start |
| 140 | func TestStartJupyterServerFailure(t *testing.T) { |
| 141 | resp := jupyter.GetRunningServerResponse{ |
| 142 | Port: strconv.Itoa(1234), |
| 143 | ServerUrl: "http://localhost:1234?token=1234", |
| 144 | Message: "error message", |
| 145 | Result: false, |
| 146 | } |
| 147 | |
| 148 | server := newMockServer() |
| 149 | server.JupyterServerHostServerMock.GetRunningServerFunc = func(context.Context, *jupyter.GetRunningServerRequest) (*jupyter.GetRunningServerResponse, error) { |
| 150 | return &resp, nil |
| 151 | } |
| 152 | |
| 153 | invoker, stop, err := createTestInvoker(t, server) |
| 154 | if err != nil { |
| 155 | t.Fatalf("error connecting to internal server: %v", err) |
| 156 | } |
| 157 | defer stop() |
| 158 | |
| 159 | errorMessage := fmt.Sprintf("failed to start JupyterLab: %s", resp.Message) |
| 160 | port, url, err := invoker.StartJupyterServer(context.Background()) |
| 161 | if err.Error() != errorMessage { |
| 162 | t.Fatalf("expected %v, got %v", errorMessage, err) |
| 163 | } |
| 164 | if port != 0 { |
| 165 | t.Fatalf("expected %d, got %d", 0, port) |
| 166 | } |
| 167 | if url != "" { |
| 168 | t.Fatalf("expected %s, got %s", "", url) |
| 169 | } |
| 170 | |
| 171 | verifyNotifyCodespaceOfClientActivity(t, server) |
| 172 | } |
| 173 | |
| 174 | // Test that the RPC invoker doesn't throw an error when requesting an incremental rebuild |
| 175 | func TestRebuildContainerIncremental(t *testing.T) { |
nothing calls this directly
no test coverage detected