Skip to content

Commit

Permalink
Move the docker tests into a test package
Browse files Browse the repository at this point in the history
This work has been extracted from testcontainers#2202 and is related to testcontainers#2180. See the original PR for the full context and reasoning.

This will help with the documentation, since all examples will now have the module prefixes.
  • Loading branch information
Minivera committed Feb 28, 2024
1 parent 5054ae1 commit 58e24a5
Show file tree
Hide file tree
Showing 7 changed files with 342 additions and 381 deletions.
16 changes: 8 additions & 8 deletions docker.go
Expand Up @@ -919,7 +919,7 @@ func (p *DockerProvider) CreateContainer(ctx context.Context, req ContainerReque
// If default network is not bridge make sure it is attached to the request
// as container won't be attached to it automatically
// in case of Podman the bridge network is called 'podman' as 'bridge' would conflict
if p.DefaultNetwork != p.defaultBridgeNetworkName {
if p.DefaultNetwork != p.DefaultBridgeNetworkName {
isAttached := false
for _, net := range req.Networks {
if net == p.DefaultNetwork {
Expand Down Expand Up @@ -1073,13 +1073,13 @@ func (p *DockerProvider) CreateContainer(ctx context.Context, req ContainerReque
// default hooks include logger hook and pre-create hook
defaultHooks := []ContainerLifecycleHooks{
DefaultLoggingHook(p.Logger),
defaultPreCreateHook(ctx, p, req, dockerInput, hostConfig, networkingConfig),
defaultCopyFileToContainerHook(req.Files),
defaultLogConsumersHook(req.LogConsumerCfg),
defaultReadinessHook(),
DefaultPreCreateHook(p, dockerInput, hostConfig, networkingConfig),
DefaultCopyFileToContainerHook(req.Files),
DefaultLogConsumersHook(req.LogConsumerCfg),
DefaultReadinessHook(),
}

req.LifecycleHooks = []ContainerLifecycleHooks{combineContainerHooks(defaultHooks, req.LifecycleHooks)}
req.LifecycleHooks = []ContainerLifecycleHooks{CombineContainerHooks(defaultHooks, req.LifecycleHooks)}

err = req.creatingHook(ctx)
if err != nil {
Expand Down Expand Up @@ -1430,8 +1430,8 @@ func (p *DockerProvider) getDefaultNetwork(ctx context.Context, cli client.APICl
reaperNetworkExists := false

for _, net := range networkResources {
if net.Name == p.defaultBridgeNetworkName {
return p.defaultBridgeNetworkName, nil
if net.Name == p.DefaultBridgeNetworkName {
return p.DefaultBridgeNetworkName, nil
}

if net.Name == reaperNetwork {
Expand Down

0 comments on commit 58e24a5

Please sign in to comment.