| 125 | } |
| 126 | |
| 127 | async startMySQL() { |
| 128 | this.container = await new GenericContainer("mysql:8.0") |
| 129 | .withEnvironment({ |
| 130 | MYSQL_ROOT_PASSWORD: this.password, |
| 131 | MYSQL_DATABASE: this.database, |
| 132 | }) |
| 133 | .withExposedPorts(3306) |
| 134 | .withWaitStrategy( |
| 135 | Wait.forAll([ |
| 136 | Wait.forLogMessage("ready for connections"), |
| 137 | Wait.forListeningPorts() |
| 138 | ]) |
| 139 | ) |
| 140 | .withStartupTimeout(60000) // 60 seconds timeout |
| 141 | .start(); |
| 142 | |
| 143 | this.port = this.container.getMappedPort(3306); |
| 144 | |
| 145 | // Additional wait to ensure MySQL is truly ready |
| 146 | console.log("⏳ Waiting for MySQL to be fully ready..."); |
| 147 | await new Promise((resolve) => setTimeout(resolve, 2000)); |
| 148 | } |
| 149 | |
| 150 | async startPostgres() { |
| 151 | this.container = await new GenericContainer("postgres:15") |