chore: remove most uses of TestcontainersConfig and deprecated TestcontainersConfig fields. by thaJeztah · Pull Request #2614 · testcontainers/testcontainers-go
added 5 commits
June 29, 2024 11:17This test was verifying that DockerProvider.Config() returned a non-nil value, but Config() does not return a pointer, so it would always pass (even with an empty struct). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The TestcontainersConfig.RyukDisabled field is deprecated. NewDockerProvider() uses ReadConfig() internally to load the config, which always copies its value from config.Config.RyukDisabled field, which is not deprecated. This patch removes the extra redirection, and changes the code to use Config.RyukDisabled instead. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
All fields in TestcontainersConfig are deprecated, making it a wrapper around config.Config and DockerProvider internally only depends on config.Config. All deprecated fields contain a copy of values available in config.Config. However, the exported `Config()` has TestcontainersConfig as return type; filling the deprecated fields is is currently handled by ReadConfig, but straightforward, so we can inline that code in the `Config()` method. This patch: - changes the (non-exported) config field to hold a config.Config (which provides all the data used). - removes internal uses of the `Config()` method; the `Config()` method did not provide value for internal use; the `config` field is not mutated (so no synchronisation needed for concurrency). - updates the `Config()` method to handle conversion of the config.Config to a `TestcontainersConfig` (effectively inlining a copy of `ReadConfig`) After this patch, the only remaining use of `ReadConfig` in testcontainers-go itself is in tests (`TestReadConfig`); as a follow-up, we can consider deprecating `ReadConfig` and `TestcontainersConfig`, although `DockerProvider` may need a new `Config()` method with a different signature if its config must be accessible for others, which would require the `ContainerProvider` and `ReaperProvider` interfaces to be updated. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
mdelapenya added a commit that referenced this pull request
Jul 2, 2024* main: fix: never cache JSON representation of a container (#2606) chore: remove most uses of TestcontainersConfig and deprecated TestcontainersConfig fields. (#2614) chore(deps): bump github.com/docker/docker from v27.0.2 to v27.0.3 (#2615) chore(deps): bump github.com/docker/docker from v26.1.4 to v27.0.2 (#2593)
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