testcontainers 9.12.0 → 10.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (405) hide show
  1. package/{dist/src → build/common}/clock.js +1 -0
  2. package/build/common/clock.js.map +1 -0
  3. package/build/common/file-lock.js +58 -0
  4. package/build/common/file-lock.js.map +1 -0
  5. package/build/common/hash.d.ts +1 -0
  6. package/{dist/src → build/common}/hash.js +3 -2
  7. package/build/common/hash.js.map +1 -0
  8. package/build/common/index.d.ts +7 -0
  9. package/build/common/index.js +37 -0
  10. package/build/common/index.js.map +1 -0
  11. package/{dist/src → build/common}/logger.d.ts +5 -6
  12. package/{dist/src → build/common}/logger.js +5 -2
  13. package/build/common/logger.js.map +1 -0
  14. package/{dist/src/retry-strategy.d.ts → build/common/retry.d.ts} +3 -3
  15. package/build/common/retry.js +38 -0
  16. package/build/common/retry.js.map +1 -0
  17. package/build/common/streams.js +13 -0
  18. package/build/common/streams.js.map +1 -0
  19. package/{dist/src → build/common}/type-guards.js +1 -0
  20. package/build/common/type-guards.js.map +1 -0
  21. package/{dist/src → build/common}/uuid.js +1 -0
  22. package/build/common/uuid.js.map +1 -0
  23. package/build/container-runtime/auth/auths.d.ts +7 -0
  24. package/build/container-runtime/auth/auths.js +45 -0
  25. package/build/container-runtime/auth/auths.js.map +1 -0
  26. package/build/container-runtime/auth/cred-helpers.d.ts +6 -0
  27. package/{dist/src/registry-auth-locator → build/container-runtime/auth}/cred-helpers.js +1 -0
  28. package/build/container-runtime/auth/cred-helpers.js.map +1 -0
  29. package/{dist/src/registry-auth-locator → build/container-runtime/auth}/credential-provider.d.ts +3 -4
  30. package/build/container-runtime/auth/credential-provider.js +71 -0
  31. package/build/container-runtime/auth/credential-provider.js.map +1 -0
  32. package/build/container-runtime/auth/creds-store.d.ts +6 -0
  33. package/{dist/src/registry-auth-locator → build/container-runtime/auth}/creds-store.js +1 -0
  34. package/build/container-runtime/auth/creds-store.js.map +1 -0
  35. package/{dist/src/registry-auth-locator → build/container-runtime/auth}/get-auth-config.d.ts +1 -1
  36. package/{dist/src/registry-auth-locator → build/container-runtime/auth}/get-auth-config.js +11 -19
  37. package/build/container-runtime/auth/get-auth-config.js.map +1 -0
  38. package/build/container-runtime/auth/registry-auth-locator.d.ts +5 -0
  39. package/build/container-runtime/auth/registry-auth-locator.js +3 -0
  40. package/build/container-runtime/auth/registry-auth-locator.js.map +1 -0
  41. package/{dist/src/registry-auth-locator → build/container-runtime/auth}/registry-matches.js +1 -0
  42. package/build/container-runtime/auth/registry-matches.js.map +1 -0
  43. package/{dist/src/registry-auth-locator → build/container-runtime/auth}/types.d.ts +13 -1
  44. package/{dist/src/registry-auth-locator → build/container-runtime/auth}/types.js +1 -0
  45. package/build/container-runtime/auth/types.js.map +1 -0
  46. package/build/container-runtime/clients/client.d.ts +14 -0
  47. package/build/container-runtime/clients/client.js +105 -0
  48. package/build/container-runtime/clients/client.js.map +1 -0
  49. package/build/container-runtime/clients/compose/compose-client.d.ts +11 -0
  50. package/build/container-runtime/clients/compose/compose-client.js +238 -0
  51. package/build/container-runtime/clients/compose/compose-client.js.map +1 -0
  52. package/build/container-runtime/clients/compose/default-compose-options.d.ts +4 -0
  53. package/build/container-runtime/clients/compose/default-compose-options.js +31 -0
  54. package/build/container-runtime/clients/compose/default-compose-options.js.map +1 -0
  55. package/build/container-runtime/clients/compose/parse-compose-container-name.d.ts +1 -0
  56. package/{dist/src/docker-compose/container-name-resolver.js → build/container-runtime/clients/compose/parse-compose-container-name.js} +5 -4
  57. package/build/container-runtime/clients/compose/parse-compose-container-name.js.map +1 -0
  58. package/build/container-runtime/clients/compose/types.d.ts +15 -0
  59. package/{dist/src/docker → build/container-runtime/clients/compose}/types.js +1 -0
  60. package/build/container-runtime/clients/compose/types.js.map +1 -0
  61. package/build/container-runtime/clients/container/container-client.d.ts +32 -0
  62. package/build/container-runtime/clients/container/container-client.js +3 -0
  63. package/build/container-runtime/clients/container/container-client.js.map +1 -0
  64. package/build/container-runtime/clients/container/docker-container-client.d.ts +35 -0
  65. package/build/container-runtime/clients/container/docker-container-client.js +276 -0
  66. package/build/container-runtime/clients/container/docker-container-client.js.map +1 -0
  67. package/build/container-runtime/clients/container/podman-container-client.d.ts +8 -0
  68. package/build/container-runtime/clients/container/podman-container-client.js +43 -0
  69. package/build/container-runtime/clients/container/podman-container-client.js.map +1 -0
  70. package/build/container-runtime/clients/container/types.d.ts +4 -0
  71. package/{dist/src/docker/client/docker-client-types.js → build/container-runtime/clients/container/types.js} +1 -0
  72. package/build/container-runtime/clients/container/types.js.map +1 -0
  73. package/build/container-runtime/clients/image/docker-image-client.d.ts +16 -0
  74. package/build/container-runtime/clients/image/docker-image-client.js +119 -0
  75. package/build/container-runtime/clients/image/docker-image-client.js.map +1 -0
  76. package/build/container-runtime/clients/image/image-client.d.ts +9 -0
  77. package/build/container-runtime/clients/image/image-client.js +3 -0
  78. package/build/container-runtime/clients/image/image-client.js.map +1 -0
  79. package/build/container-runtime/clients/network/docker-network-client.d.ts +9 -0
  80. package/build/container-runtime/clients/network/docker-network-client.js +50 -0
  81. package/build/container-runtime/clients/network/docker-network-client.js.map +1 -0
  82. package/build/container-runtime/clients/network/network-client.d.ts +6 -0
  83. package/build/container-runtime/clients/network/network-client.js +3 -0
  84. package/build/container-runtime/clients/network/network-client.js.map +1 -0
  85. package/build/container-runtime/clients/types.d.ts +30 -0
  86. package/{dist/src/docker/client/strategy/docker-client-strategy.js → build/container-runtime/clients/types.js} +1 -0
  87. package/build/container-runtime/clients/types.js.map +1 -0
  88. package/build/container-runtime/image-name.d.ts +11 -0
  89. package/{dist/src/docker-image-name.js → build/container-runtime/image-name.js} +11 -17
  90. package/build/container-runtime/image-name.js.map +1 -0
  91. package/build/container-runtime/index.d.ts +6 -0
  92. package/build/container-runtime/index.js +13 -0
  93. package/build/container-runtime/index.js.map +1 -0
  94. package/build/container-runtime/strategies/configuration-strategy.d.ts +9 -0
  95. package/build/container-runtime/strategies/configuration-strategy.js +53 -0
  96. package/build/container-runtime/strategies/configuration-strategy.js.map +1 -0
  97. package/build/container-runtime/strategies/npipe-socket-strategy.d.ts +6 -0
  98. package/build/container-runtime/strategies/npipe-socket-strategy.js +21 -0
  99. package/build/container-runtime/strategies/npipe-socket-strategy.js.map +1 -0
  100. package/build/container-runtime/strategies/rootless-unix-socket-strategy.d.ts +14 -0
  101. package/build/container-runtime/strategies/rootless-unix-socket-strategy.js +63 -0
  102. package/build/container-runtime/strategies/rootless-unix-socket-strategy.js.map +1 -0
  103. package/build/container-runtime/strategies/strategy.d.ts +5 -0
  104. package/{dist/src/registry-auth-locator/registry-auth-locator.js → build/container-runtime/strategies/strategy.js} +1 -0
  105. package/build/container-runtime/strategies/strategy.js.map +1 -0
  106. package/build/container-runtime/strategies/testcontainers-host-strategy.d.ts +6 -0
  107. package/build/container-runtime/strategies/testcontainers-host-strategy.js +30 -0
  108. package/build/container-runtime/strategies/testcontainers-host-strategy.js.map +1 -0
  109. package/build/container-runtime/strategies/types.d.ts +8 -0
  110. package/build/container-runtime/strategies/types.js +3 -0
  111. package/build/container-runtime/strategies/types.js.map +1 -0
  112. package/build/container-runtime/strategies/unix-socket-strategy.d.ts +6 -0
  113. package/build/container-runtime/strategies/unix-socket-strategy.js +22 -0
  114. package/build/container-runtime/strategies/unix-socket-strategy.js.map +1 -0
  115. package/build/container-runtime/strategies/utils/config.d.ts +9 -0
  116. package/build/container-runtime/strategies/utils/config.js +75 -0
  117. package/build/container-runtime/strategies/utils/config.js.map +1 -0
  118. package/build/container-runtime/utils/attach-container.js +17 -0
  119. package/build/container-runtime/utils/attach-container.js.map +1 -0
  120. package/build/container-runtime/utils/demux-stream.d.ts +4 -0
  121. package/build/container-runtime/utils/demux-stream.js +24 -0
  122. package/build/container-runtime/utils/demux-stream.js.map +1 -0
  123. package/build/container-runtime/utils/image-exists.d.ts +3 -0
  124. package/build/container-runtime/utils/image-exists.js +29 -0
  125. package/build/container-runtime/utils/image-exists.js.map +1 -0
  126. package/build/container-runtime/utils/lookup-host-ips.d.ts +2 -0
  127. package/build/container-runtime/utils/lookup-host-ips.js +18 -0
  128. package/build/container-runtime/utils/lookup-host-ips.js.map +1 -0
  129. package/{dist/src/docker/functions/image → build/container-runtime/utils}/pull-image.d.ts +2 -2
  130. package/build/container-runtime/utils/pull-image.js +35 -0
  131. package/build/container-runtime/utils/pull-image.js.map +1 -0
  132. package/build/container-runtime/utils/remote-container-runtime-socket-path.d.ts +7 -0
  133. package/build/container-runtime/utils/remote-container-runtime-socket-path.js +23 -0
  134. package/build/container-runtime/utils/remote-container-runtime-socket-path.js.map +1 -0
  135. package/build/container-runtime/utils/resolve-host.d.ts +8 -0
  136. package/build/container-runtime/utils/resolve-host.js +54 -0
  137. package/build/container-runtime/utils/resolve-host.js.map +1 -0
  138. package/build/container-runtime/utils/run-in-container.js +30 -0
  139. package/build/container-runtime/utils/run-in-container.js.map +1 -0
  140. package/build/container-runtime/utils/start-container.js +15 -0
  141. package/build/container-runtime/utils/start-container.js.map +1 -0
  142. package/{dist/src → build}/docker-compose-environment/docker-compose-environment.d.ts +5 -5
  143. package/build/docker-compose-environment/docker-compose-environment.js +144 -0
  144. package/build/docker-compose-environment/docker-compose-environment.js.map +1 -0
  145. package/{dist/src → build}/docker-compose-environment/downed-docker-compose-environment.js +1 -0
  146. package/build/docker-compose-environment/downed-docker-compose-environment.js.map +1 -0
  147. package/{dist/src → build}/docker-compose-environment/started-docker-compose-environment.d.ts +3 -3
  148. package/build/docker-compose-environment/started-docker-compose-environment.js +37 -0
  149. package/build/docker-compose-environment/started-docker-compose-environment.js.map +1 -0
  150. package/build/docker-compose-environment/stopped-docker-compose-environment.d.ts +7 -0
  151. package/build/docker-compose-environment/stopped-docker-compose-environment.js +19 -0
  152. package/build/docker-compose-environment/stopped-docker-compose-environment.js.map +1 -0
  153. package/{dist/src/modules → build/generic-container}/abstract-started-container.d.ts +1 -1
  154. package/build/generic-container/abstract-started-container.js +69 -0
  155. package/build/generic-container/abstract-started-container.js.map +1 -0
  156. package/{dist/src/modules → build/generic-container}/abstract-stopped-container.js +2 -0
  157. package/build/generic-container/abstract-stopped-container.js.map +1 -0
  158. package/{dist/src → build}/generic-container/generic-container-builder.d.ts +4 -4
  159. package/build/generic-container/generic-container-builder.js +87 -0
  160. package/build/generic-container/generic-container-builder.js.map +1 -0
  161. package/{dist/src → build}/generic-container/generic-container.d.ts +18 -22
  162. package/build/generic-container/generic-container.js +350 -0
  163. package/build/generic-container/generic-container.js.map +1 -0
  164. package/{dist/src → build}/generic-container/started-generic-container.d.ts +6 -6
  165. package/build/generic-container/started-generic-container.js +161 -0
  166. package/build/generic-container/started-generic-container.js.map +1 -0
  167. package/build/generic-container/stopped-generic-container.js +23 -0
  168. package/build/generic-container/stopped-generic-container.js.map +1 -0
  169. package/build/index.d.ts +16 -0
  170. package/build/index.js +35 -0
  171. package/build/index.js.map +1 -0
  172. package/build/network/network.d.ts +19 -0
  173. package/build/network/network.js +61 -0
  174. package/build/network/network.js.map +1 -0
  175. package/{dist/src → build/port-forwarder}/port-forwarder.d.ts +2 -1
  176. package/build/port-forwarder/port-forwarder.js +73 -0
  177. package/build/port-forwarder/port-forwarder.js.map +1 -0
  178. package/build/reaper/reaper.d.ts +8 -0
  179. package/build/reaper/reaper.js +119 -0
  180. package/build/reaper/reaper.js.map +1 -0
  181. package/{dist/src → build}/test-container.d.ts +6 -6
  182. package/{dist/src → build}/test-container.js +1 -0
  183. package/build/test-container.js.map +1 -0
  184. package/build/test-containers.js +12 -0
  185. package/build/test-containers.js.map +1 -0
  186. package/{dist/src/docker → build}/types.d.ts +16 -0
  187. package/build/types.js +3 -0
  188. package/build/types.js.map +1 -0
  189. package/{dist/src → build/utils}/bound-ports.d.ts +4 -3
  190. package/{dist/src → build/utils}/bound-ports.js +22 -5
  191. package/build/utils/bound-ports.js.map +1 -0
  192. package/build/utils/dockerfile-parser.d.ts +3 -0
  193. package/build/utils/dockerfile-parser.js +28 -0
  194. package/build/utils/dockerfile-parser.js.map +1 -0
  195. package/{dist/src → build/utils}/labels.d.ts +1 -0
  196. package/build/utils/labels.js +18 -0
  197. package/build/utils/labels.js.map +1 -0
  198. package/build/utils/map-inspect-result.d.ts +3 -0
  199. package/build/utils/map-inspect-result.js +55 -0
  200. package/build/utils/map-inspect-result.js.map +1 -0
  201. package/build/utils/port-generator.js +43 -0
  202. package/build/utils/port-generator.js.map +1 -0
  203. package/{dist/src → build/utils}/port.d.ts +0 -3
  204. package/build/utils/port.js +10 -0
  205. package/build/utils/port.js.map +1 -0
  206. package/build/utils/pull-policy.d.ts +7 -0
  207. package/build/utils/pull-policy.js +23 -0
  208. package/build/utils/pull-policy.js.map +1 -0
  209. package/build/utils/test-helper.d.ts +19 -0
  210. package/build/utils/test-helper.js +107 -0
  211. package/build/utils/test-helper.js.map +1 -0
  212. package/build/version.d.ts +1 -0
  213. package/build/version.js +5 -0
  214. package/build/version.js.map +1 -0
  215. package/{dist/src/wait-strategy → build/wait-strategies}/composite-wait-strategy.d.ts +1 -1
  216. package/build/wait-strategies/composite-wait-strategy.js +49 -0
  217. package/build/wait-strategies/composite-wait-strategy.js.map +1 -0
  218. package/build/wait-strategies/health-check-wait-strategy.js +26 -0
  219. package/build/wait-strategies/health-check-wait-strategy.js.map +1 -0
  220. package/{dist/src/wait-strategy → build/wait-strategies}/host-port-wait-strategy.d.ts +1 -1
  221. package/build/wait-strategies/host-port-wait-strategy.js +42 -0
  222. package/build/wait-strategies/host-port-wait-strategy.js.map +1 -0
  223. package/{dist/src/wait-strategy → build/wait-strategies}/http-wait-strategy.d.ts +1 -1
  224. package/build/wait-strategies/http-wait-strategy.js +111 -0
  225. package/build/wait-strategies/http-wait-strategy.js.map +1 -0
  226. package/{dist/src/wait-strategy → build/wait-strategies}/log-wait-strategy.d.ts +1 -1
  227. package/build/wait-strategies/log-wait-strategy.js +62 -0
  228. package/build/wait-strategies/log-wait-strategy.js.map +1 -0
  229. package/build/wait-strategies/shell-wait-strategy.js +30 -0
  230. package/build/wait-strategies/shell-wait-strategy.js.map +1 -0
  231. package/{dist/src/wait-strategy → build/wait-strategies}/startup-check-strategy.d.ts +3 -0
  232. package/build/wait-strategies/startup-check-strategy.js +27 -0
  233. package/build/wait-strategies/startup-check-strategy.js.map +1 -0
  234. package/{dist/src → build/wait-strategies/utils}/port-check.d.ts +5 -6
  235. package/build/wait-strategies/utils/port-check.js +81 -0
  236. package/build/wait-strategies/utils/port-check.js.map +1 -0
  237. package/build/wait-strategies/wait-for-container.d.ts +5 -0
  238. package/build/wait-strategies/wait-for-container.js +24 -0
  239. package/build/wait-strategies/wait-for-container.js.map +1 -0
  240. package/{dist/src/wait-strategy → build/wait-strategies}/wait-strategy.d.ts +1 -1
  241. package/{dist/src/wait-strategy → build/wait-strategies}/wait-strategy.js +3 -4
  242. package/build/wait-strategies/wait-strategy.js.map +1 -0
  243. package/{dist/src/wait-strategy → build/wait-strategies}/wait.js +1 -0
  244. package/build/wait-strategies/wait.js.map +1 -0
  245. package/package.json +18 -63
  246. package/LICENSE +0 -21
  247. package/README.md +0 -27
  248. package/dist/package.json +0 -104
  249. package/dist/src/docker/client/docker-client-config.d.ts +0 -9
  250. package/dist/src/docker/client/docker-client-config.js +0 -82
  251. package/dist/src/docker/client/docker-client-types.d.ts +0 -23
  252. package/dist/src/docker/client/docker-client.d.ts +0 -2
  253. package/dist/src/docker/client/docker-client.js +0 -133
  254. package/dist/src/docker/client/strategy/configuration-strategy.d.ts +0 -11
  255. package/dist/src/docker/client/strategy/configuration-strategy.js +0 -66
  256. package/dist/src/docker/client/strategy/docker-client-strategy.d.ts +0 -7
  257. package/dist/src/docker/client/strategy/npipe-socket-strategy.d.ts +0 -7
  258. package/dist/src/docker/client/strategy/npipe-socket-strategy.js +0 -31
  259. package/dist/src/docker/client/strategy/rootless-unix-socket-strategy.d.ts +0 -18
  260. package/dist/src/docker/client/strategy/rootless-unix-socket-strategy.js +0 -77
  261. package/dist/src/docker/client/strategy/testcontainers-host-strategy.d.ts +0 -9
  262. package/dist/src/docker/client/strategy/testcontainers-host-strategy.js +0 -47
  263. package/dist/src/docker/client/strategy/unix-socket-strategy.d.ts +0 -7
  264. package/dist/src/docker/client/strategy/unix-socket-strategy.js +0 -32
  265. package/dist/src/docker/functions/container/attach-container.js +0 -25
  266. package/dist/src/docker/functions/container/container-logs.d.ts +0 -6
  267. package/dist/src/docker/functions/container/container-logs.js +0 -32
  268. package/dist/src/docker/functions/container/create-container.d.ts +0 -31
  269. package/dist/src/docker/functions/container/create-container.js +0 -117
  270. package/dist/src/docker/functions/container/exec-container.d.ts +0 -3
  271. package/dist/src/docker/functions/container/exec-container.js +0 -66
  272. package/dist/src/docker/functions/container/get-container-archive.d.ts +0 -11
  273. package/dist/src/docker/functions/container/get-container-archive.js +0 -23
  274. package/dist/src/docker/functions/container/get-container.d.ts +0 -3
  275. package/dist/src/docker/functions/container/get-container.js +0 -49
  276. package/dist/src/docker/functions/container/inspect-container.d.ts +0 -19
  277. package/dist/src/docker/functions/container/inspect-container.js +0 -67
  278. package/dist/src/docker/functions/container/list-containers.d.ts +0 -2
  279. package/dist/src/docker/functions/container/list-containers.js +0 -25
  280. package/dist/src/docker/functions/container/put-container-archive.d.ts +0 -9
  281. package/dist/src/docker/functions/container/put-container-archive.js +0 -26
  282. package/dist/src/docker/functions/container/remove-container.d.ts +0 -5
  283. package/dist/src/docker/functions/container/remove-container.js +0 -23
  284. package/dist/src/docker/functions/container/restart-container.d.ts +0 -5
  285. package/dist/src/docker/functions/container/restart-container.js +0 -23
  286. package/dist/src/docker/functions/container/start-container.js +0 -23
  287. package/dist/src/docker/functions/container/stop-container.d.ts +0 -5
  288. package/dist/src/docker/functions/container/stop-container.js +0 -29
  289. package/dist/src/docker/functions/create-labels.d.ts +0 -2
  290. package/dist/src/docker/functions/create-labels.js +0 -13
  291. package/dist/src/docker/functions/demux-stream.d.ts +0 -3
  292. package/dist/src/docker/functions/demux-stream.js +0 -32
  293. package/dist/src/docker/functions/get-info.d.ts +0 -11
  294. package/dist/src/docker/functions/get-info.js +0 -38
  295. package/dist/src/docker/functions/image/build-image.d.ts +0 -14
  296. package/dist/src/docker/functions/image/build-image.js +0 -81
  297. package/dist/src/docker/functions/image/image-exists.d.ts +0 -3
  298. package/dist/src/docker/functions/image/image-exists.js +0 -37
  299. package/dist/src/docker/functions/image/pull-image.js +0 -48
  300. package/dist/src/docker/functions/network/connect-network.d.ts +0 -6
  301. package/dist/src/docker/functions/network/connect-network.js +0 -28
  302. package/dist/src/docker/functions/network/create-network.d.ts +0 -16
  303. package/dist/src/docker/functions/network/create-network.js +0 -39
  304. package/dist/src/docker/functions/network/remove-network.d.ts +0 -1
  305. package/dist/src/docker/functions/network/remove-network.js +0 -31
  306. package/dist/src/docker/functions/run-in-container.js +0 -39
  307. package/dist/src/docker/lookup-host-ips.d.ts +0 -5
  308. package/dist/src/docker/lookup-host-ips.js +0 -26
  309. package/dist/src/docker/remote-docker-unix-socket-path.d.ts +0 -7
  310. package/dist/src/docker/remote-docker-unix-socket-path.js +0 -22
  311. package/dist/src/docker/resolve-host.d.ts +0 -8
  312. package/dist/src/docker/resolve-host.js +0 -63
  313. package/dist/src/docker-compose/container-name-resolver.d.ts +0 -1
  314. package/dist/src/docker-compose/docker-compose-client.d.ts +0 -9
  315. package/dist/src/docker-compose/docker-compose-client.js +0 -221
  316. package/dist/src/docker-compose/docker-compose-options.d.ts +0 -17
  317. package/dist/src/docker-compose/docker-compose-options.js +0 -51
  318. package/dist/src/docker-compose-environment/docker-compose-environment.js +0 -146
  319. package/dist/src/docker-compose-environment/started-docker-compose-environment.js +0 -47
  320. package/dist/src/docker-compose-environment/stopped-docker-compose-environment.d.ts +0 -7
  321. package/dist/src/docker-compose-environment/stopped-docker-compose-environment.js +0 -28
  322. package/dist/src/docker-image-name.d.ts +0 -15
  323. package/dist/src/dockerfile-parser.d.ts +0 -3
  324. package/dist/src/dockerfile-parser.js +0 -39
  325. package/dist/src/file-lock.js +0 -47
  326. package/dist/src/generic-container/create-container-options.d.ts +0 -3
  327. package/dist/src/generic-container/create-container-options.js +0 -18
  328. package/dist/src/generic-container/generic-container-builder.js +0 -97
  329. package/dist/src/generic-container/generic-container.js +0 -329
  330. package/dist/src/generic-container/started-generic-container.js +0 -168
  331. package/dist/src/generic-container/stopped-generic-container.js +0 -20
  332. package/dist/src/hash.d.ts +0 -1
  333. package/dist/src/images.d.ts +0 -2
  334. package/dist/src/images.js +0 -6
  335. package/dist/src/index.d.ts +0 -25
  336. package/dist/src/index.js +0 -66
  337. package/dist/src/labels.js +0 -8
  338. package/dist/src/modules/abstract-started-container.js +0 -86
  339. package/dist/src/modules/arangodb/arangodb-container.d.ts +0 -19
  340. package/dist/src/modules/arangodb/arangodb-container.js +0 -60
  341. package/dist/src/modules/elasticsearch/elasticsearch-container.d.ts +0 -12
  342. package/dist/src/modules/elasticsearch/elasticsearch-container.js +0 -49
  343. package/dist/src/modules/hivemq/hivemq-container.d.ts +0 -15
  344. package/dist/src/modules/hivemq/hivemq-container.js +0 -79
  345. package/dist/src/modules/kafka/kafka-container.d.ts +0 -45
  346. package/dist/src/modules/kafka/kafka-container.js +0 -177
  347. package/dist/src/modules/mongodb/mongodb-container.d.ts +0 -19
  348. package/dist/src/modules/mongodb/mongodb-container.js +0 -85
  349. package/dist/src/modules/mysql/mysql-container.d.ts +0 -30
  350. package/dist/src/modules/mysql/mysql-container.js +0 -111
  351. package/dist/src/modules/nats/nats-container.d.ts +0 -55
  352. package/dist/src/modules/nats/nats-container.js +0 -99
  353. package/dist/src/modules/neo4j/neo4j-container.d.ts +0 -23
  354. package/dist/src/modules/neo4j/neo4j-container.js +0 -82
  355. package/dist/src/modules/postgresql/postgresql-container.d.ts +0 -28
  356. package/dist/src/modules/postgresql/postgresql-container.js +0 -87
  357. package/dist/src/modules/selenium/selenium-container.d.ts +0 -38
  358. package/dist/src/modules/selenium/selenium-container.js +0 -161
  359. package/dist/src/network.d.ts +0 -18
  360. package/dist/src/network.js +0 -60
  361. package/dist/src/port-check.js +0 -90
  362. package/dist/src/port-forwarder.js +0 -83
  363. package/dist/src/port-generator.js +0 -51
  364. package/dist/src/port.js +0 -47
  365. package/dist/src/pull-policy.d.ts +0 -9
  366. package/dist/src/pull-policy.js +0 -15
  367. package/dist/src/reaper.d.ts +0 -5
  368. package/dist/src/reaper.js +0 -157
  369. package/dist/src/registry-auth-locator/auths.d.ts +0 -8
  370. package/dist/src/registry-auth-locator/auths.js +0 -56
  371. package/dist/src/registry-auth-locator/cred-helpers.d.ts +0 -6
  372. package/dist/src/registry-auth-locator/credential-provider.js +0 -81
  373. package/dist/src/registry-auth-locator/creds-store.d.ts +0 -6
  374. package/dist/src/registry-auth-locator/registry-auth-locator.d.ts +0 -6
  375. package/dist/src/retry-strategy.js +0 -46
  376. package/dist/src/stream-utils.js +0 -46
  377. package/dist/src/system-info.d.ts +0 -19
  378. package/dist/src/system-info.js +0 -80
  379. package/dist/src/test-containers.js +0 -22
  380. package/dist/src/wait-for-container.d.ts +0 -4
  381. package/dist/src/wait-for-container.js +0 -34
  382. package/dist/src/wait-strategy/composite-wait-strategy.js +0 -57
  383. package/dist/src/wait-strategy/health-check-wait-strategy.js +0 -36
  384. package/dist/src/wait-strategy/host-port-wait-strategy.js +0 -59
  385. package/dist/src/wait-strategy/http-wait-strategy.js +0 -120
  386. package/dist/src/wait-strategy/log-wait-strategy.js +0 -69
  387. package/dist/src/wait-strategy/shell-wait-strategy.js +0 -39
  388. package/dist/src/wait-strategy/startup-check-strategy.js +0 -35
  389. /package/{dist/src → build/common}/clock.d.ts +0 -0
  390. /package/{dist/src → build/common}/file-lock.d.ts +0 -0
  391. /package/{dist/src/stream-utils.d.ts → build/common/streams.d.ts} +0 -0
  392. /package/{dist/src → build/common}/type-guards.d.ts +0 -0
  393. /package/{dist/src → build/common}/uuid.d.ts +0 -0
  394. /package/{dist/src/registry-auth-locator → build/container-runtime/auth}/registry-matches.d.ts +0 -0
  395. /package/{dist/src/docker/functions/container → build/container-runtime/utils}/attach-container.d.ts +0 -0
  396. /package/{dist/src/docker/functions → build/container-runtime/utils}/run-in-container.d.ts +0 -0
  397. /package/{dist/src/docker/functions/container → build/container-runtime/utils}/start-container.d.ts +0 -0
  398. /package/{dist/src → build}/docker-compose-environment/downed-docker-compose-environment.d.ts +0 -0
  399. /package/{dist/src/modules → build/generic-container}/abstract-stopped-container.d.ts +0 -0
  400. /package/{dist/src → build}/generic-container/stopped-generic-container.d.ts +0 -0
  401. /package/{dist/src → build}/test-containers.d.ts +0 -0
  402. /package/{dist/src → build/utils}/port-generator.d.ts +0 -0
  403. /package/{dist/src/wait-strategy → build/wait-strategies}/health-check-wait-strategy.d.ts +0 -0
  404. /package/{dist/src/wait-strategy → build/wait-strategies}/shell-wait-strategy.d.ts +0 -0
  405. /package/{dist/src/wait-strategy → build/wait-strategies}/wait.d.ts +0 -0
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.TestContainers = void 0;
13
- const port_forwarder_1 = require("./port-forwarder");
14
- class TestContainers {
15
- static exposeHostPorts(...ports) {
16
- return __awaiter(this, void 0, void 0, function* () {
17
- const portForwarder = yield port_forwarder_1.PortForwarderInstance.getInstance();
18
- yield Promise.all(ports.map((port) => portForwarder.exposeHostPort(port)));
19
- });
20
- }
21
- }
22
- exports.TestContainers = TestContainers;
@@ -1,4 +0,0 @@
1
- import Dockerode from "dockerode";
2
- import { BoundPorts } from "./bound-ports";
3
- import { WaitStrategy } from "./wait-strategy/wait-strategy";
4
- export declare const waitForContainer: (container: Dockerode.Container, waitStrategy: WaitStrategy, boundPorts: BoundPorts, startTime?: Date) => Promise<void>;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.waitForContainer = void 0;
13
- const logger_1 = require("./logger");
14
- const stop_container_1 = require("./docker/functions/container/stop-container");
15
- const remove_container_1 = require("./docker/functions/container/remove-container");
16
- const waitForContainer = (container, waitStrategy, boundPorts, startTime) => __awaiter(void 0, void 0, void 0, function* () {
17
- logger_1.log.debug(`Waiting for container to be ready...`, { containerId: container.id });
18
- try {
19
- yield waitStrategy.waitUntilReady(container, boundPorts, startTime);
20
- logger_1.log.info(`Container is ready`, { containerId: container.id });
21
- }
22
- catch (err) {
23
- logger_1.log.error(`Container failed to be ready: ${err}`, { containerId: container.id });
24
- try {
25
- yield (0, stop_container_1.stopContainer)(container, { timeout: 0 });
26
- yield (0, remove_container_1.removeContainer)(container, { removeVolumes: true });
27
- }
28
- catch (stopErr) {
29
- logger_1.log.error(`Failed to stop container after it failed to be ready: ${stopErr}`, { containerId: container.id });
30
- }
31
- throw err;
32
- }
33
- });
34
- exports.waitForContainer = waitForContainer;
@@ -1,57 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CompositeWaitStrategy = void 0;
13
- const wait_strategy_1 = require("./wait-strategy");
14
- const logger_1 = require("../logger");
15
- class CompositeWaitStrategy extends wait_strategy_1.AbstractWaitStrategy {
16
- constructor(waitStrategies) {
17
- super();
18
- this.waitStrategies = waitStrategies;
19
- }
20
- waitUntilReady(container, boundPorts, startTime) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- logger_1.log.debug(`Waiting for composite...`, { containerId: container.id });
23
- return new Promise((resolve, reject) => {
24
- let deadlineTimeout;
25
- if (this.deadline !== undefined) {
26
- deadlineTimeout = setTimeout(() => {
27
- const message = `Composite wait strategy not successful after ${this.deadline}ms`;
28
- logger_1.log.error(message, { containerId: container.id });
29
- reject(new Error(message));
30
- }, this.deadline);
31
- }
32
- Promise.all(this.waitStrategies.map((waitStrategy) => waitStrategy.waitUntilReady(container, boundPorts, startTime)))
33
- .then(() => {
34
- logger_1.log.debug(`Composite wait strategy complete`, { containerId: container.id });
35
- resolve();
36
- })
37
- .catch((err) => reject(err))
38
- .finally(() => {
39
- if (deadlineTimeout) {
40
- clearTimeout(deadlineTimeout);
41
- }
42
- });
43
- });
44
- });
45
- }
46
- withStartupTimeout(startupTimeout) {
47
- this.waitStrategies
48
- .filter((waitStrategy) => !waitStrategy.isStartupTimeoutSet())
49
- .forEach((waitStrategy) => waitStrategy.withStartupTimeout(startupTimeout));
50
- return this;
51
- }
52
- withDeadline(deadline) {
53
- this.deadline = deadline;
54
- return this;
55
- }
56
- }
57
- exports.CompositeWaitStrategy = CompositeWaitStrategy;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.HealthCheckWaitStrategy = void 0;
13
- const logger_1 = require("../logger");
14
- const retry_strategy_1 = require("../retry-strategy");
15
- const inspect_container_1 = require("../docker/functions/container/inspect-container");
16
- const wait_strategy_1 = require("./wait-strategy");
17
- class HealthCheckWaitStrategy extends wait_strategy_1.AbstractWaitStrategy {
18
- waitUntilReady(container) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- logger_1.log.debug(`Waiting for health check...`, { containerId: container.id });
21
- const status = yield new retry_strategy_1.IntervalRetryStrategy(100).retryUntil(() => __awaiter(this, void 0, void 0, function* () { return (yield (0, inspect_container_1.inspectContainer)(container)).healthCheckStatus; }), (healthCheckStatus) => healthCheckStatus === "healthy" || healthCheckStatus === "unhealthy", () => {
22
- const timeout = this.startupTimeout;
23
- const message = `Health check not healthy after ${timeout}ms`;
24
- logger_1.log.error(message, { containerId: container.id });
25
- throw new Error(message);
26
- }, this.startupTimeout);
27
- if (status !== "healthy") {
28
- const message = `Health check failed: ${status}`;
29
- logger_1.log.error(message, { containerId: container.id });
30
- throw new Error(message);
31
- }
32
- logger_1.log.debug(`Health check wait strategy complete`, { containerId: container.id });
33
- });
34
- }
35
- }
36
- exports.HealthCheckWaitStrategy = HealthCheckWaitStrategy;
@@ -1,59 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.HostPortWaitStrategy = void 0;
13
- const port_check_1 = require("../port-check");
14
- const logger_1 = require("../logger");
15
- const retry_strategy_1 = require("../retry-strategy");
16
- const wait_strategy_1 = require("./wait-strategy");
17
- const docker_client_1 = require("../docker/client/docker-client");
18
- class HostPortWaitStrategy extends wait_strategy_1.AbstractWaitStrategy {
19
- waitUntilReady(container, boundPorts) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- const { dockerode, containerRuntime, host } = yield (0, docker_client_1.getDockerClient)();
22
- const hostPortCheck = new port_check_1.HostPortCheck(host);
23
- const internalPortCheck = new port_check_1.InternalPortCheck(dockerode, containerRuntime, container);
24
- yield Promise.all([
25
- this.waitForHostPorts(hostPortCheck, container, boundPorts),
26
- this.waitForInternalPorts(internalPortCheck, container, boundPorts),
27
- ]);
28
- });
29
- }
30
- waitForHostPorts(portCheck, container, boundPorts) {
31
- return __awaiter(this, void 0, void 0, function* () {
32
- for (const [, hostPort] of boundPorts.iterator()) {
33
- logger_1.log.debug(`Waiting for host port ${hostPort}...`, { containerId: container.id });
34
- yield this.waitForPort(container, hostPort, portCheck);
35
- logger_1.log.debug(`Host port ${hostPort} ready`, { containerId: container.id });
36
- }
37
- logger_1.log.debug(`Host port wait strategy complete`, { containerId: container.id });
38
- });
39
- }
40
- waitForInternalPorts(portCheck, container, boundPorts) {
41
- return __awaiter(this, void 0, void 0, function* () {
42
- for (const [internalPort] of boundPorts.iterator()) {
43
- logger_1.log.debug(`Waiting for internal port ${internalPort}...`, { containerId: container.id });
44
- yield this.waitForPort(container, internalPort, portCheck);
45
- logger_1.log.debug(`Internal port ${internalPort} ready`, { containerId: container.id });
46
- }
47
- });
48
- }
49
- waitForPort(container, port, portCheck) {
50
- return __awaiter(this, void 0, void 0, function* () {
51
- yield new retry_strategy_1.IntervalRetryStrategy(100).retryUntil(() => portCheck.isBound(port), (isBound) => isBound, () => {
52
- const message = `Port ${port} not bound after ${this.startupTimeout}ms`;
53
- logger_1.log.error(message, { containerId: container.id });
54
- throw new Error(message);
55
- }, this.startupTimeout);
56
- });
57
- }
58
- }
59
- exports.HostPortWaitStrategy = HostPortWaitStrategy;
@@ -1,120 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.HttpWaitStrategy = void 0;
16
- const wait_strategy_1 = require("./wait-strategy");
17
- const retry_strategy_1 = require("../retry-strategy");
18
- const node_fetch_1 = __importDefault(require("node-fetch"));
19
- const https_1 = __importDefault(require("https"));
20
- const docker_client_1 = require("../docker/client/docker-client");
21
- const logger_1 = require("../logger");
22
- class HttpWaitStrategy extends wait_strategy_1.AbstractWaitStrategy {
23
- constructor(path, port) {
24
- super();
25
- this.protocol = "http";
26
- this.method = "GET";
27
- this.headers = {};
28
- this.predicates = [];
29
- this._allowInsecure = false;
30
- this.readTimeout = 1000;
31
- this.path = path;
32
- this.port = port;
33
- }
34
- forStatusCode(statusCode) {
35
- this.predicates.push((response) => __awaiter(this, void 0, void 0, function* () { return response.status === statusCode; }));
36
- return this;
37
- }
38
- forStatusCodeMatching(predicate) {
39
- this.predicates.push((response) => __awaiter(this, void 0, void 0, function* () { return predicate(response.status); }));
40
- return this;
41
- }
42
- forResponsePredicate(predicate) {
43
- this.predicates.push((response) => __awaiter(this, void 0, void 0, function* () { return predicate(yield response.text()); }));
44
- return this;
45
- }
46
- withMethod(method) {
47
- this.method = method;
48
- return this;
49
- }
50
- withHeaders(headers) {
51
- this.headers = Object.assign(Object.assign({}, this.headers), headers);
52
- return this;
53
- }
54
- withBasicCredentials(username, password) {
55
- const base64Encoded = Buffer.from(`${username}:${password}`).toString("base64");
56
- this.headers = Object.assign(Object.assign({}, this.headers), { Authorization: `Basic ${base64Encoded}` });
57
- return this;
58
- }
59
- withReadTimeout(readTimeout) {
60
- this.readTimeout = readTimeout;
61
- return this;
62
- }
63
- usingTls() {
64
- this.protocol = "https";
65
- return this;
66
- }
67
- allowInsecure() {
68
- this._allowInsecure = true;
69
- return this;
70
- }
71
- waitUntilReady(container, boundPorts) {
72
- return __awaiter(this, void 0, void 0, function* () {
73
- logger_1.log.debug(`Waiting for HTTP...`, { containerId: container.id });
74
- const { host } = yield (0, docker_client_1.getDockerClient)();
75
- yield new retry_strategy_1.IntervalRetryStrategy(this.readTimeout).retryUntil(() => __awaiter(this, void 0, void 0, function* () {
76
- try {
77
- const url = `${this.protocol}://${host}:${boundPorts.getBinding(this.port)}${this.path}`;
78
- return yield (0, node_fetch_1.default)(url, {
79
- method: this.method,
80
- timeout: this.readTimeout,
81
- headers: this.headers,
82
- agent: this.getAgent(),
83
- });
84
- }
85
- catch (_a) {
86
- return undefined;
87
- }
88
- }), (response) => __awaiter(this, void 0, void 0, function* () {
89
- if (response === undefined) {
90
- return false;
91
- }
92
- else if (!this.predicates.length) {
93
- return response.ok;
94
- }
95
- else {
96
- for (const predicate of this.predicates) {
97
- const result = yield predicate(response);
98
- if (!result) {
99
- return false;
100
- }
101
- }
102
- return true;
103
- }
104
- }), () => {
105
- const message = `URL ${this.path} not accessible after ${this.startupTimeout}ms`;
106
- logger_1.log.error(message, { containerId: container.id });
107
- throw new Error(message);
108
- }, this.startupTimeout);
109
- logger_1.log.debug(`HTTP wait strategy complete`, { containerId: container.id });
110
- });
111
- }
112
- getAgent() {
113
- if (this._allowInsecure) {
114
- return new https_1.default.Agent({
115
- rejectUnauthorized: false,
116
- });
117
- }
118
- }
119
- }
120
- exports.HttpWaitStrategy = HttpWaitStrategy;
@@ -1,69 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.LogWaitStrategy = void 0;
16
- const logger_1 = require("../logger");
17
- const container_logs_1 = require("../docker/functions/container/container-logs");
18
- const byline_1 = __importDefault(require("byline"));
19
- const wait_strategy_1 = require("./wait-strategy");
20
- class LogWaitStrategy extends wait_strategy_1.AbstractWaitStrategy {
21
- constructor(message, times) {
22
- super();
23
- this.message = message;
24
- this.times = times;
25
- }
26
- waitUntilReady(container, boundPorts, startTime) {
27
- return __awaiter(this, void 0, void 0, function* () {
28
- logger_1.log.debug(`Waiting for log message "${this.message}"...`, { containerId: container.id });
29
- const stream = yield (0, container_logs_1.containerLogs)(container, { since: startTime });
30
- return new Promise((resolve, reject) => {
31
- const timeout = setTimeout(() => {
32
- const message = `Log message "${this.message}" not received after ${this.startupTimeout}ms`;
33
- logger_1.log.error(message, { containerId: container.id });
34
- reject(new Error(message));
35
- }, this.startupTimeout);
36
- const comparisonFn = (line) => {
37
- if (this.message instanceof RegExp) {
38
- return this.message.test(line);
39
- }
40
- else {
41
- return line.includes(this.message);
42
- }
43
- };
44
- let count = 0;
45
- const lineProcessor = (line) => {
46
- if (comparisonFn(line)) {
47
- if (++count === this.times) {
48
- stream.destroy();
49
- clearTimeout(timeout);
50
- logger_1.log.debug(`Log wait strategy complete`, { containerId: container.id });
51
- resolve();
52
- }
53
- }
54
- };
55
- (0, byline_1.default)(stream)
56
- .on("data", lineProcessor)
57
- .on("err", lineProcessor)
58
- .on("end", () => {
59
- stream.destroy();
60
- clearTimeout(timeout);
61
- const message = `Log stream ended and message "${this.message}" was not received`;
62
- logger_1.log.error(message, { containerId: container.id });
63
- reject(new Error(message));
64
- });
65
- });
66
- });
67
- }
68
- }
69
- exports.LogWaitStrategy = LogWaitStrategy;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ShellWaitStrategy = void 0;
13
- const logger_1 = require("../logger");
14
- const wait_strategy_1 = require("./wait-strategy");
15
- const retry_strategy_1 = require("../retry-strategy");
16
- const exec_container_1 = require("../docker/functions/container/exec-container");
17
- const docker_client_1 = require("../docker/client/docker-client");
18
- class ShellWaitStrategy extends wait_strategy_1.AbstractWaitStrategy {
19
- constructor(command) {
20
- super();
21
- this.command = command;
22
- }
23
- waitUntilReady(container) {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- logger_1.log.debug(`Waiting for successful shell command "${this.command}"...`, { containerId: container.id });
26
- const { dockerode, containerRuntime } = yield (0, docker_client_1.getDockerClient)();
27
- yield new retry_strategy_1.IntervalRetryStrategy(100).retryUntil(() => __awaiter(this, void 0, void 0, function* () {
28
- const { exitCode } = yield (0, exec_container_1.execContainer)(dockerode, containerRuntime, container, ["/bin/sh", "-c", this.command], false);
29
- return exitCode;
30
- }), (exitCode) => exitCode === 0, () => {
31
- const message = `Shell command "${this.command}" not successful after ${this.startupTimeout}ms`;
32
- logger_1.log.error(message, { containerId: container.id });
33
- throw new Error(message);
34
- }, this.startupTimeout);
35
- logger_1.log.debug(`Shell wait strategy complete`, { containerId: container.id });
36
- });
37
- }
38
- }
39
- exports.ShellWaitStrategy = ShellWaitStrategy;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.StartupCheckStrategy = void 0;
13
- const wait_strategy_1 = require("./wait-strategy");
14
- const retry_strategy_1 = require("../retry-strategy");
15
- const docker_client_1 = require("../docker/client/docker-client");
16
- const logger_1 = require("../logger");
17
- class StartupCheckStrategy extends wait_strategy_1.AbstractWaitStrategy {
18
- waitUntilReady(container) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- const { dockerode } = yield (0, docker_client_1.getDockerClient)();
21
- const startupStatus = yield new retry_strategy_1.IntervalRetryStrategy(1000).retryUntil(() => __awaiter(this, void 0, void 0, function* () { return yield this.checkStartupState(dockerode, container.id); }), (startupStatus) => startupStatus === "SUCCESS" || startupStatus === "FAIL", () => {
22
- const message = `Container not accessible after ${this.startupTimeout}ms`;
23
- logger_1.log.error(message, { containerId: container.id });
24
- return new Error(message);
25
- }, this.startupTimeout);
26
- if (startupStatus instanceof Error) {
27
- throw startupStatus;
28
- }
29
- else if (startupStatus === "FAIL") {
30
- throw new Error(`Container failed to start for ${container.id}`);
31
- }
32
- });
33
- }
34
- }
35
- exports.StartupCheckStrategy = StartupCheckStrategy;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes