From d9c41c757aba721e8da7545914df89a4e05dec24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Thu, 6 Jun 2024 13:44:44 +0200 Subject: [PATCH] chore: remove more deprecated types --- mount/docker_mounts.go | 34 ---------------------------------- mount/mounts.go | 35 ++--------------------------------- 2 files changed, 2 insertions(+), 67 deletions(-) diff --git a/mount/docker_mounts.go b/mount/docker_mounts.go index 8b48297d5c0..4ba482a1545 100644 --- a/mount/docker_mounts.go +++ b/mount/docker_mounts.go @@ -7,19 +7,11 @@ import ( ) var mountTypeMapping = map[Type]mount.Type{ - TypeBind: mount.TypeBind, // Deprecated, it will be removed in a future release TypeVolume: mount.TypeVolume, TypeTmpfs: mount.TypeTmpfs, TypePipe: mount.TypeNamedPipe, } -// Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments -// BindMounter can optionally be implemented by mount sources -// to support advanced scenarios based on mount.BindOptions -type BindMounter interface { - GetBindOptions() *mount.BindOptions -} - // VolumeMounter can optionally be implemented by mount sources // to support advanced scenarios based on mount.VolumeOptions type VolumeMounter interface { @@ -32,30 +24,6 @@ type TmpfsMounter interface { GetTmpfsOptions() *mount.TmpfsOptions } -// Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments -type DockerBindSource struct { - *mount.BindOptions - - // HostPath is the path mounted into the container - // the same host path might be mounted to multiple locations within a single container - HostPath string -} - -// Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments -func (s DockerBindSource) Source() string { - return s.HostPath -} - -// Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments -func (DockerBindSource) Type() Type { - return TypeBind -} - -// Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments -func (s DockerBindSource) GetBindOptions() *mount.BindOptions { - return s.BindOptions -} - type DockerVolumeSource struct { *mount.VolumeOptions @@ -112,8 +80,6 @@ func (m ContainerMounts) Prepare() []mount.Mount { containerMount.VolumeOptions = typedMounter.GetVolumeOptions() case TmpfsMounter: containerMount.TmpfsOptions = typedMounter.GetTmpfsOptions() - case BindMounter: - // Logger.Printf("Mount type %s is not supported by Testcontainers for Go", m.Source.Type()) default: // The provided source type has no custom options } diff --git a/mount/mounts.go b/mount/mounts.go index 7679d8bad8f..7cccabd0732 100644 --- a/mount/mounts.go +++ b/mount/mounts.go @@ -3,8 +3,7 @@ package mount import "errors" const ( - TypeBind Type = iota // Deprecated: Use TypeVolume instead - TypeVolume + TypeVolume Type = iota TypeTmpfs TypePipe ) @@ -15,7 +14,6 @@ var ( ) var ( - _ ContainerSource = (*GenericBindSource)(nil) // Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments _ ContainerSource = (*GenericVolumeSource)(nil) _ ContainerSource = (*GenericTmpfsSource)(nil) ) @@ -37,25 +35,6 @@ type ContainerSource interface { Type() Type } -// Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments -// GenericBindSource implements ContainerSource and represents a bind mount -// Optionally mount.BindOptions might be added for advanced scenarios -type GenericBindSource struct { - // HostPath is the path mounted into the container - // the same host path might be mounted to multiple locations within a single container - HostPath string -} - -// Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments -func (s GenericBindSource) Source() string { - return s.HostPath -} - -// Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments -func (GenericBindSource) Type() Type { - return TypeBind -} - // GenericVolumeSource implements ContainerSource and represents a volume mount type GenericVolumeSource struct { // Name refers to the name of the volume to be mounted @@ -91,16 +70,6 @@ func (t ContainerTarget) Target() string { return string(t) } -// Deprecated: use Files or HostConfigModifier in the ContainerRequest, or copy files container APIs to make containers portable across Docker environments -// BindMount returns a new ContainerMount with a GenericBindMountSource as source -// This is a convenience method to cover typical use cases. -func BindMount(hostPath string, mountTarget ContainerTarget) ContainerMount { - return ContainerMount{ - Source: GenericBindSource{HostPath: hostPath}, - Target: mountTarget, - } -} - // VolumeMount returns a new ContainerMount with a GenericVolumeMountSource as source // This is a convenience method to cover typical use cases. func VolumeMount(volumeName string, mountTarget ContainerTarget) ContainerMount { @@ -117,7 +86,7 @@ func Mounts(mounts ...ContainerMount) ContainerMounts { // ContainerMount models a mount into a container type ContainerMount struct { - // Source is typically either a GenericVolumeSource, as BindMount is not supported by all Docker environments + // Source is typically either a GenericVolumeSource or a GenericTmpfsSource Source ContainerSource // Target is the path where the mount should be mounted within the container Target ContainerTarget