diff --git a/acceptance/bundle/debug/out.stderr.parallel.txt b/acceptance/bundle/debug/out.stderr.parallel.txt index ca4a1d95a..13c81c511 100644 --- a/acceptance/bundle/debug/out.stderr.parallel.txt +++ b/acceptance/bundle/debug/out.stderr.parallel.txt @@ -9,7 +9,7 @@ 10:07:59 Debug: ApplyReadOnly pid=12345 mutator=validate mutator (read-only)=parallel mutator (read-only)=validate:folder_permissions 10:07:59 Debug: ApplyReadOnly pid=12345 mutator=validate mutator (read-only)=parallel mutator (read-only)=validate:validate_sync_patterns 10:07:59 Debug: Path /Workspace/Users/[USERNAME]/.bundle/debug/default/files has type directory (ID: 0) pid=12345 mutator=validate mutator (read-only)=parallel mutator (read-only)=validate:files_to_sync -10:07:59 Debug: non-retriable error: Not Found pid=12345 mutator=validate mutator (read-only)=parallel mutator (read-only)=validate:files_to_sync sdk=true -< HTTP/0.0 000 Not Found (Error: Not Found) pid=12345 mutator=validate mutator (read-only)=parallel mutator (read-only)=validate:files_to_sync sdk=true +10:07:59 Debug: non-retriable error: Workspace path not found pid=12345 mutator=validate mutator (read-only)=parallel mutator (read-only)=validate:files_to_sync sdk=true < HTTP/0.0 000 OK pid=12345 mutator=validate mutator (read-only)=parallel mutator (read-only)=validate:files_to_sync sdk=true < } pid=12345 mutator=validate mutator (read-only)=parallel mutator (read-only)=validate:files_to_sync sdk=true +< } pid=12345 mutator=validate mutator (read-only)=parallel mutator (read-only)=validate:files_to_sync sdk=true diff --git a/acceptance/bundle/debug/out.stderr.txt b/acceptance/bundle/debug/out.stderr.txt index adec09c87..e5867e008 100644 --- a/acceptance/bundle/debug/out.stderr.txt +++ b/acceptance/bundle/debug/out.stderr.txt @@ -78,6 +78,9 @@ 10:07:59 Debug: No script defined for postinit, skipping pid=12345 mutator=initialize mutator=seq mutator=scripts.postinit 10:07:59 Debug: Apply pid=12345 mutator=validate 10:07:59 Debug: GET /api/2.0/workspace/get-status?path=/Workspace/Users/[USERNAME]/.bundle/debug/default/files +< HTTP/1.1 404 Not Found +< { +< "message": "Workspace path not found" 10:07:59 Debug: POST /api/2.0/workspace/mkdirs > { > "path": "/Workspace/Users/[USERNAME]/.bundle/debug/default/files" diff --git a/acceptance/selftest/server/output.txt b/acceptance/selftest/server/output.txt index 0710c6e8a..7147f9c9b 100644 --- a/acceptance/selftest/server/output.txt +++ b/acceptance/selftest/server/output.txt @@ -16,6 +16,6 @@ custom response >>> errcode [CLI] workspace get-status /a/b/c -Error: Not Found +Error: Workspace path not found Exit code: 1 diff --git a/libs/testserver/fake_workspace.go b/libs/testserver/fake_workspace.go index 1138e48e0..4e943f828 100644 --- a/libs/testserver/fake_workspace.go +++ b/libs/testserver/fake_workspace.go @@ -32,20 +32,27 @@ func NewFakeWorkspace() *FakeWorkspace { } } -func (s *FakeWorkspace) WorkspaceGetStatus(path string) *workspace.ObjectInfo { +func (s *FakeWorkspace) WorkspaceGetStatus(path string) Response { if s.directories[path] { - return &workspace.ObjectInfo{ - ObjectType: "DIRECTORY", - Path: path, + return Response{ + Body: &workspace.ObjectInfo{ + ObjectType: "DIRECTORY", + Path: path, + }, } } else if _, ok := s.files[path]; ok { - return &workspace.ObjectInfo{ - ObjectType: "FILE", - Path: path, - Language: "SCALA", + return Response{ + Body: &workspace.ObjectInfo{ + ObjectType: "FILE", + Path: path, + Language: "SCALA", + }, } } else { - return nil + return Response{ + StatusCode: 404, + Body: map[string]string{"message": "Workspace path not found"}, + } } } diff --git a/libs/testserver/server.go b/libs/testserver/server.go index f29fa0e84..fa15973d7 100644 --- a/libs/testserver/server.go +++ b/libs/testserver/server.go @@ -87,7 +87,8 @@ func normalizeResponse(t testutil.TestingT, resp any) encodedResponse { func normalizeResponseBody(t testutil.TestingT, resp any) encodedResponse { if isNil(resp) { - return encodedResponse{StatusCode: 404, Body: []byte{}} + t.Errorf("Handler must not return nil") + return encodedResponse{StatusCode: 500} } respBytes, ok := resp.([]byte) @@ -108,6 +109,14 @@ func normalizeResponseBody(t testutil.TestingT, resp any) encodedResponse { respStruct, ok := resp.(Response) if ok { + if isNil(respStruct.Body) { + return encodedResponse{ + StatusCode: respStruct.StatusCode, + Headers: respStruct.Headers, + Body: []byte{}, + } + } + bytesVal, isBytes := respStruct.Body.([]byte) if isBytes { return encodedResponse{