Skip to content

Commit

Permalink
Handle breaking change to docker compose ps output format
Browse files Browse the repository at this point in the history
docker/compose#10958

Signed-off-by: Andrew Haines <haines@cerbos.dev>
  • Loading branch information
haines committed Sep 12, 2023
1 parent 9bbbe4e commit 5f5e4af
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions packages/test/src/servers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,33 @@ export async function ports(): Promise<Ports> {
"json",
]);

const output = JSON.parse(stdout) as DockerComposeContainer[];
const containers = stdout
.split("\n")
.flatMap(
(line) =>
JSON.parse(line) as DockerComposeContainer | DockerComposeContainer[],
);

return {
grpc: {
plaintext: port(output, "plaintext", 3593),
tls: port(output, "tls", 3593),
mtls: port(output, "mtls", 3593),
mutable: port(output, "mutable", 3593),
plaintext: port(containers, "plaintext", 3593),
tls: port(containers, "tls", 3593),
mtls: port(containers, "mtls", 3593),
mutable: port(containers, "mutable", 3593),
get tracing(): number {
return port(output, "tracing", 3593);
return port(containers, "tracing", 3593);
},
},
http: {
plaintext: port(output, "plaintext", 3592),
tls: port(output, "tls", 3592),
mutable: port(output, "mutable", 3592),
plaintext: port(containers, "plaintext", 3592),
tls: port(containers, "tls", 3592),
mutable: port(containers, "mutable", 3592),
get tracing(): number {
return port(output, "tracing", 3592);
return port(containers, "tracing", 3592);
},
},
get jaeger(): number {
return port(output, "jaeger", 16685);
return port(containers, "jaeger", 16685);
},
};
}
Expand Down

0 comments on commit 5f5e4af

Please sign in to comment.