Skip to content

Commit

Permalink
fix: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelapenya committed Mar 15, 2023
1 parent bfaafe7 commit 9532872
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ func TestReadTCConfig(t *testing.T) {

config := readConfig()

assert.Empty(t, config, "TC props file should not exist")
expected := TestcontainersConfig{}
expected.Host = "unix:///var/run/docker.sock"

assert.Equal(t, expected, config)
})

t.Run("HOME is not set - TESTCONTAINERS_ env is set", func(t *testing.T) {
Expand All @@ -48,6 +51,7 @@ func TestReadTCConfig(t *testing.T) {
expected := TestcontainersConfig{}
expected.RyukDisabled = true
expected.RyukPrivileged = true
expected.Host = "unix:///var/run/docker.sock"

assert.Equal(t, expected, config)
})
Expand All @@ -58,7 +62,10 @@ func TestReadTCConfig(t *testing.T) {

config := readConfig()

assert.Empty(t, config, "TC props file should not exist")
expected := TestcontainersConfig{}
expected.Host = "unix:///var/run/docker.sock"

assert.Equal(t, expected, config)
})

t.Run("HOME does not contain TC props file - DOCKER_HOST env is set", func(t *testing.T) {
Expand All @@ -83,6 +90,7 @@ func TestReadTCConfig(t *testing.T) {
expected := TestcontainersConfig{}
expected.RyukDisabled = true
expected.RyukPrivileged = true
expected.Host = "unix:///var/run/docker.sock"

assert.Equal(t, expected, config)
})
Expand Down Expand Up @@ -135,7 +143,7 @@ func TestReadTCConfig(t *testing.T) {
"",
map[string]string{},
TestcontainersConfig{
Host: "",
Host: "unix:///var/run/docker.sock",
TLSVerify: 0,
CertPath: "",
},
Expand Down Expand Up @@ -167,7 +175,7 @@ func TestReadTCConfig(t *testing.T) {
`#docker.host=tcp://127.0.0.1:33293`,
map[string]string{},
TestcontainersConfig{
Host: "",
Host: "unix:///var/run/docker.sock",
TLSVerify: 0,
CertPath: "",
},
Expand All @@ -190,7 +198,7 @@ func TestReadTCConfig(t *testing.T) {
`ryuk.disabled=true`,
map[string]string{},
TestcontainersConfig{
Host: "",
Host: "unix:///var/run/docker.sock",
TLSVerify: 0,
CertPath: "",
RyukDisabled: true,
Expand All @@ -201,7 +209,7 @@ func TestReadTCConfig(t *testing.T) {
`ryuk.container.privileged=true`,
map[string]string{},
TestcontainersConfig{
Host: "",
Host: "unix:///var/run/docker.sock",
TLSVerify: 0,
CertPath: "",
RyukPrivileged: true,
Expand All @@ -214,7 +222,7 @@ func TestReadTCConfig(t *testing.T) {
"TESTCONTAINERS_RYUK_DISABLED": "true",
},
TestcontainersConfig{
Host: "",
Host: "unix:///var/run/docker.sock",
TLSVerify: 0,
CertPath: "",
RyukDisabled: true,
Expand All @@ -227,7 +235,7 @@ func TestReadTCConfig(t *testing.T) {
"TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED": "true",
},
TestcontainersConfig{
Host: "",
Host: "unix:///var/run/docker.sock",
TLSVerify: 0,
CertPath: "",
RyukPrivileged: true,
Expand All @@ -240,7 +248,7 @@ func TestReadTCConfig(t *testing.T) {
"TESTCONTAINERS_RYUK_DISABLED": "true",
},
TestcontainersConfig{
Host: "",
Host: "unix:///var/run/docker.sock",
TLSVerify: 0,
CertPath: "",
RyukDisabled: true,
Expand All @@ -253,7 +261,7 @@ func TestReadTCConfig(t *testing.T) {
"TESTCONTAINERS_RYUK_DISABLED": "true",
},
TestcontainersConfig{
Host: "",
Host: "unix:///var/run/docker.sock",
TLSVerify: 0,
CertPath: "",
RyukDisabled: true,
Expand All @@ -266,7 +274,7 @@ func TestReadTCConfig(t *testing.T) {
"TESTCONTAINERS_RYUK_DISABLED": "false",
},
TestcontainersConfig{
Host: "",
Host: "unix:///var/run/docker.sock",
TLSVerify: 0,
CertPath: "",
RyukDisabled: false,
Expand All @@ -279,7 +287,7 @@ func TestReadTCConfig(t *testing.T) {
"TESTCONTAINERS_RYUK_DISABLED": "false",
},
TestcontainersConfig{
Host: "",
Host: "unix:///var/run/docker.sock",
TLSVerify: 0,
CertPath: "",
RyukDisabled: false,
Expand All @@ -292,7 +300,7 @@ func TestReadTCConfig(t *testing.T) {
"TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED": "true",
},
TestcontainersConfig{
Host: "",
Host: "unix:///var/run/docker.sock",
TLSVerify: 0,
CertPath: "",
RyukPrivileged: true,
Expand All @@ -305,7 +313,7 @@ func TestReadTCConfig(t *testing.T) {
"TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED": "true",
},
TestcontainersConfig{
Host: "",
Host: "unix:///var/run/docker.sock",
TLSVerify: 0,
CertPath: "",
RyukPrivileged: true,
Expand All @@ -318,7 +326,7 @@ func TestReadTCConfig(t *testing.T) {
"TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED": "false",
},
TestcontainersConfig{
Host: "",
Host: "unix:///var/run/docker.sock",
TLSVerify: 0,
CertPath: "",
RyukPrivileged: false,
Expand All @@ -331,7 +339,7 @@ func TestReadTCConfig(t *testing.T) {
"TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED": "false",
},
TestcontainersConfig{
Host: "",
Host: "unix:///var/run/docker.sock",
TLSVerify: 0,
CertPath: "",
RyukPrivileged: false,
Expand All @@ -346,7 +354,7 @@ func TestReadTCConfig(t *testing.T) {
"TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED": "true",
},
TestcontainersConfig{
Host: "",
Host: "unix:///var/run/docker.sock",
TLSVerify: 0,
CertPath: "",
RyukDisabled: true,
Expand All @@ -360,7 +368,7 @@ func TestReadTCConfig(t *testing.T) {
"TESTCONTAINERS_RYUK_DISABLED": "foo",
},
TestcontainersConfig{
Host: "",
Host: "unix:///var/run/docker.sock",
TLSVerify: 0,
CertPath: "",
RyukDisabled: false,
Expand All @@ -373,7 +381,7 @@ func TestReadTCConfig(t *testing.T) {
"TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED": "foo",
},
TestcontainersConfig{
Host: "",
Host: "unix:///var/run/docker.sock",
TLSVerify: 0,
CertPath: "",
RyukPrivileged: false,
Expand Down

0 comments on commit 9532872

Please sign in to comment.