Skip to content

Commit

Permalink
fix: e2e probe logs after restart
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-yarmosh committed Apr 16, 2024
1 parent ad85194 commit 03db8a7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/e2e/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const logger = scopedLogger('docker-manager');
class DockerManager {
docker: Docker;

private lastLogTimestamp: number = 0;

constructor () {
this.docker = new Docker();
}
Expand Down Expand Up @@ -96,14 +98,18 @@ class DockerManager {
}

await container.start({});
await this.attachLogs(container);
}

private async attachLogs (container: Docker.Container) {
const stream = await container.logs({
follow: true,
stdout: true,
stderr: true,
since: this.lastLogTimestamp,
});
stream.on('close', () => this.lastLogTimestamp = Math.floor(Date.now() / 1000));

container.modem.demuxStream(stream, process.stdout, process.stderr);
}

Expand Down

0 comments on commit 03db8a7

Please sign in to comment.