Import/1.0.0#1
Merged
Merged
Conversation
Add Gleam formulas under src/testcontainer_formulas for Mongo, MySQL, Postgres, RabbitMQ and Redis. Each module provides a Config builder (new/with_*) and a formula() that builds a testcontainer spec which exposes ports, sets env/credentials or command, supports network and container naming, and composes wait strategies. The formulas return typed container records including connection URLs, host/port(s) and relevant credentials/database info. Default images: mongo:7, mysql:8.4, postgres:16-alpine, rabbitmq:3-management, redis:7-alpine.
Introduce comprehensive tests for testcontainer formulas: adds formula_contract helpers and two test suites (integration and unit). The integration tests (guarded by TESTCONTAINER_FORMULAS_INTEGRATION) exercise Postgres, Redis (including password), MySQL, RabbitMQ and Mongo formulas and verify endpoint contracts, container readiness via exec, and URL prefixes/ports. The unit tests include builder smoke tests, secret redaction checks (ensure passwords aren't revealed in inspect), and numerous URL-encoding checks for credentials, databases, and vhosts using a synthetic_container helper.
Introduce three new docs: quickstart (usage examples for Postgres, Redis, MySQL, Mongo, RabbitMQ, and shared-network stacks), testing-model (unit vs integration contract guidance and how to run integration tests), and writing-formulas (minimal formula shape, design guidelines, and suggested builders). These pages help contributors get started, write consistent formulas, and run/verify integration tests.
Expand README with badges, installation instructions, a quick example, available formulas, documentation links, and license information. Add a Gleam-generated manifest.toml listing project dependencies and requirements, including a local testcontainer package reference for build tooling.
Add a new CHANGELOG.md documenting the 1.0.0 release and prior 0.1.0. Notes include added docs (quickstart, writing-formulas, testing-model), new formulas (mongo, mysql, rabbitmq), numerous builders for Mongo/MySQL/RabbitMQ/Redis, network-name builders, and test/contract changes. Also documents behavioral changes (percent-encoding credentials in DSNs, updated Mongo wait strategy), README trimming, and removal of RabbitMQ's custom vhost encoder. Includes 0.1.0 entry listing initial Postgres/Redis formulas and MIT license.
Replace the local path dependency for testcontainer with a version range in gleam.toml and remove the CI steps that checked out the sibling repository in .github/workflows/test.yml. The manifest was updated accordingly to reflect the published package so the workflow no longer needs a local checkout of ../testcontiner.
Apply formatting and readability improvements across formulas and tests: - Use underscored numeric literals for port constants (27017 -> 27_017, 15672 -> 15_672) in mongo and rabbitmq formulas. - Reformat rabbitmq function signature, argument lists, and string concatenation for clarity; wrap container.host_port call arguments. - Reorder/import spacing in test/formula_contract.gleam. - Reflow testcontainer.exec command argument lists in integration tests to consistent single-line or multi-line arrays.
Bump testcontainer dependency to 1.0.1 in manifest (updated checksum).
In src/testcontainer_formulas/mongo.gleam replace wait.log(...) with wait.log_times("Waiting for connections", 2) and update docs/comments. This matches the second emission of the "Waiting for connections" line (post-bootstrap restart when --auth is enabled) to avoid racing the auth bootstrap which could cause "Authentication failed" errors. Also adjust the composed wait strategy to include the new log_times check.
Replace fuzzy log matching of "ready for connections" with the mysqld-specific message id "MY-010931" so the wait strategy reliably matches the final TCP-ready server (after init scripts). Also update the integration test to pass --get-server-public-key to mysqladmin so clients using the default caching_sha2_password plugin can fetch the server RSA public key over plain TCP and avoid "Authentication requires secure connection" on first connect.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces the initial public release of
testcontainer_formulasversion 1.0.0, providing ready-to-use, highly customizable formulas for common services (Postgres, Redis, MongoDB, MySQL, RabbitMQ) on top of the Gleamtestcontainerlibrary.Major new features and formulas:
with_image/2,with_database/2,with_username/2,with_password/2, network composition, and more). Also added Redis authentication builders and network-name variants for Postgres and Redis.testcontainer_formulas/mongo.gleamwith a typed output, sensible defaults, and full support for builder pattern configuration and network composition.Other improvements:
gleam.tomlwith dependencies, version, and metadata for Hex publishing.