Test that the RPC invoker throws an error when the rebuild fails
(t *testing.T)
| 224 | |
| 225 | // Test that the RPC invoker throws an error when the rebuild fails |
| 226 | func TestRebuildContainerFailure(t *testing.T) { |
| 227 | resp := codespace.RebuildContainerResponse{ |
| 228 | RebuildContainer: false, |
| 229 | } |
| 230 | |
| 231 | server := newMockServer() |
| 232 | server.RebuildContainerAsyncFunc = func(context.Context, *codespace.RebuildContainerRequest) (*codespace.RebuildContainerResponse, error) { |
| 233 | return &resp, nil |
| 234 | } |
| 235 | |
| 236 | invoker, stop, err := createTestInvoker(t, server) |
| 237 | if err != nil { |
| 238 | t.Fatalf("error connecting to internal server: %v", err) |
| 239 | } |
| 240 | defer stop() |
| 241 | |
| 242 | errorMessage := "couldn't rebuild codespace" |
| 243 | err = invoker.RebuildContainer(context.Background(), true) |
| 244 | if err.Error() != errorMessage { |
| 245 | t.Fatalf("expected %v, got %v", errorMessage, err) |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | // Test that the RPC invoker returns the correct port and user when the SSH server starts successfully |
| 250 | func TestStartSSHServerSuccess(t *testing.T) { |
nothing calls this directly
no test coverage detected