| 56 | * Executes testdrive with the given test script. |
| 57 | */ |
| 58 | export async function testdrive( |
| 59 | input: string, |
| 60 | options: { |
| 61 | noReset?: boolean; |
| 62 | escapeSpecialCharacters?: boolean; |
| 63 | timeoutSeconds?: number; |
| 64 | } = { |
| 65 | // Template strings automatically escape certain characters by default, but we disable |
| 66 | // that behavior. |
| 67 | escapeSpecialCharacters: true, |
| 68 | timeoutSeconds: 1, |
| 69 | }, |
| 70 | ) { |
| 71 | return docker( |
| 72 | "exec", |
| 73 | [ |
| 74 | "-i", |
| 75 | "console-testdrive-1", |
| 76 | "testdrive", |
| 77 | "--kafka-addr=kafka:9092", |
| 78 | "--schema-registry-url=http://schema-registry:8081", |
| 79 | "--materialize-url=postgres://materialize@materialized:6875", |
| 80 | "--materialize-internal-url=postgres://materialize@materialized:6877", |
| 81 | options.noReset ? "--no-reset" : "", |
| 82 | options.timeoutSeconds |
| 83 | ? `--default-timeout ${options.timeoutSeconds}s` |
| 84 | : "", |
| 85 | ], |
| 86 | options.escapeSpecialCharacters |
| 87 | ? dedenterWithEscapeSpecialCharacters(input) |
| 88 | : dedenter(input), |
| 89 | ); |
| 90 | } |
| 91 | |
| 92 | export async function docker( |
| 93 | command: string, |