forked from testcontainers/testcontainers-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
container_ignore_test.go
43 lines (39 loc) · 1.18 KB
/
container_ignore_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// This test is testing very internal logic that should not be exported away from this package. We'll
// leave it in the main testcontainers package. Do not use for user facing examples.
package testcontainers
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestParseDockerIgnore(t *testing.T) {
testCases := []struct {
filePath string
exists bool
expectedErr error
expectedExcluded []string
}{
{
filePath: "./testdata/dockerignore",
expectedErr: nil,
exists: true,
expectedExcluded: []string{"vendor", "foo", "bar"},
},
{
filePath: "./testdata",
expectedErr: nil,
exists: true,
expectedExcluded: []string{"Dockerfile", "echo.Dockerfile"},
},
{
filePath: "./testdata/data",
expectedErr: nil,
expectedExcluded: nil, // it's nil because the parseDockerIgnore function uses the zero value of a slice
},
}
for _, testCase := range testCases {
exists, excluded, err := parseDockerIgnore(testCase.filePath)
assert.Equal(t, testCase.exists, exists)
assert.Equal(t, testCase.expectedErr, err)
assert.Equal(t, testCase.expectedExcluded, excluded)
}
}