Skip to content

Commit

Permalink
Add extra logging to PythonTestServer data received before parsed as …
Browse files Browse the repository at this point in the history
…json (#22265)

gives additional insight into cases where the data returned to the
extension occurs but tests are still not populating the UI.
  • Loading branch information
eleanorjboyd authored Oct 19, 2023
1 parent 0ffce19 commit c82702e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/client/testing/testController/common/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class PythonTestServer implements ITestServer, Disposable {
this.server = net.createServer((socket: net.Socket) => {
let buffer: Buffer = Buffer.alloc(0); // Buffer to accumulate received data
socket.on('data', (data: Buffer) => {
traceVerbose('data received from python server: ', data.toString());
buffer = Buffer.concat([buffer, data]); // get the new data and add it to the buffer
while (buffer.length > 0) {
try {
Expand Down Expand Up @@ -92,6 +93,10 @@ export class PythonTestServer implements ITestServer, Disposable {
// if a full json was found in the buffer, fire the data received event then keep cycling with the remaining raw data.
traceVerbose(`Firing data received event, ${extractedJsonPayload.cleanedJsonData}`);
this._fireDataReceived(extractedJsonPayload.uuid, extractedJsonPayload.cleanedJsonData);
} else {
traceVerbose(
`extract json payload incomplete, uuid= ${extractedJsonPayload.uuid} and cleanedJsonData= ${extractedJsonPayload.cleanedJsonData}`,
);
}
buffer = Buffer.from(extractedJsonPayload.remainingRawData);
if (buffer.length === 0) {
Expand Down

0 comments on commit c82702e

Please sign in to comment.