Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] fix: windows tests #2737

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sh text eol=lf
4 changes: 4 additions & 0 deletions docs/features/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,8 @@ Path to Docker's socket. Used by Ryuk, Docker Compose, and a few other container

6. Else, the default location of the docker socket is used: `/var/run/docker.sock`

In any case, if the docker socket schema is `tcp://`, the default docker socket path will be returned.

The library panics if the Docker host cannot be discovered.

## Windows
49 changes: 27 additions & 22 deletions provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ func TestProviderTypeGetProviderAutodetect(t *testing.T) {
const podmanSocket = "unix://$XDG_RUNTIME_DIR/podman/podman.sock"

tests := []struct {
name string
tr ProviderType
DockerHost string
want string
wantErr bool
name string
tr ProviderType
DockerHost string
want string
wantErr bool
skipOnWindows bool
}{
{
name: "default provider without podman.socket",
Expand All @@ -25,10 +26,11 @@ func TestProviderTypeGetProviderAutodetect(t *testing.T) {
want: Bridge,
},
{
name: "default provider with podman.socket",
tr: ProviderDefault,
DockerHost: podmanSocket,
want: Podman,
name: "default provider with podman.socket",
tr: ProviderDefault,
DockerHost: podmanSocket,
want: Podman,
skipOnWindows: true,
},
{
name: "docker provider without podman.socket",
Expand All @@ -38,27 +40,30 @@ func TestProviderTypeGetProviderAutodetect(t *testing.T) {
},
{
// Explicitly setting Docker provider should not be overridden by auto-detect
name: "docker provider with podman.socket",
tr: ProviderDocker,
DockerHost: podmanSocket,
want: Bridge,
name: "docker provider with podman.socket",
tr: ProviderDocker,
DockerHost: podmanSocket,
want: Bridge,
skipOnWindows: true,
},
{
name: "Podman provider without podman.socket",
tr: ProviderPodman,
DockerHost: dockerHost,
want: Podman,
name: "Podman provider without podman.socket",
tr: ProviderPodman,
DockerHost: dockerHost,
want: Podman,
skipOnWindows: true,
},
{
name: "Podman provider with podman.socket",
tr: ProviderPodman,
DockerHost: podmanSocket,
want: Podman,
name: "Podman provider with podman.socket",
tr: ProviderPodman,
DockerHost: podmanSocket,
want: Podman,
skipOnWindows: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if tt.tr == ProviderPodman && core.IsWindows() {
if tt.skipOnWindows && core.IsWindows() {
t.Skip("Podman provider is not implemented for Windows")
}

Expand Down