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