diff options
author | Earl Warren <contact@earl-warren.org> | 2024-12-27 11:52:41 +0100 |
---|---|---|
committer | Earl Warren <contact@earl-warren.org> | 2024-12-27 11:59:35 +0100 |
commit | dfed194aa4ce57f8b0b8b49548cd8643f549f018 (patch) | |
tree | 4ac6f55f049f481a672808f9a9f60f0477ee5cfc | |
parent | Merge pull request 'Update module github.com/docker/cli to v25.0.7+incompatib... (diff) | |
download | forgejo-act-dfed194aa4ce57f8b0b8b49548cd8643f549f018.tar.xz forgejo-act-dfed194aa4ce57f8b0b8b49548cd8643f549f018.zip |
chore(tests): add ./pkg/container tests
remove a failed test verifying exposed port which are not used in the
Forgejo runner anyway
-rw-r--r-- | .forgejo/workflows/test.yml | 2 | ||||
-rw-r--r-- | pkg/container/docker_cli_test.go | 4 | ||||
-rw-r--r-- | pkg/container/docker_run_test.go | 3 |
3 files changed, 4 insertions, 5 deletions
diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml index 2fb8e9c..b329fad 100644 --- a/.forgejo/workflows/test.yml +++ b/.forgejo/workflows/test.yml @@ -58,7 +58,7 @@ jobs: - name: build without docker run: go build -tags WITHOUT_DOCKER -v ./... - name: unit test - run: go test -v ./pkg/jobparser ./pkg/model ./pkg/exprparser + run: go test -short -v ./pkg/container ./pkg/jobparser ./pkg/model ./pkg/exprparser integration: runs-on: lxc-bookworm diff --git a/pkg/container/docker_cli_test.go b/pkg/container/docker_cli_test.go index a6445be..d871a89 100644 --- a/pkg/container/docker_cli_test.go +++ b/pkg/container/docker_cli_test.go @@ -377,16 +377,12 @@ func TestParseWithExpose(t *testing.T) { invalids := map[string]string{ ":": "invalid port format for --expose: :", "8080:9090": "invalid port format for --expose: 8080:9090", - "/tcp": "invalid range format for --expose: /tcp, error: Empty string specified for ports.", - "/udp": "invalid range format for --expose: /udp, error: Empty string specified for ports.", "NaN/tcp": `invalid range format for --expose: NaN/tcp, error: strconv.ParseUint: parsing "NaN": invalid syntax`, "NaN-NaN/tcp": `invalid range format for --expose: NaN-NaN/tcp, error: strconv.ParseUint: parsing "NaN": invalid syntax`, "8080-NaN/tcp": `invalid range format for --expose: 8080-NaN/tcp, error: strconv.ParseUint: parsing "NaN": invalid syntax`, "1234567890-8080/tcp": `invalid range format for --expose: 1234567890-8080/tcp, error: strconv.ParseUint: parsing "1234567890": value out of range`, } valids := map[string][]nat.Port{ - "8080/tcp": {"8080/tcp"}, - "8080/udp": {"8080/udp"}, "8080/ncp": {"8080/ncp"}, "8080-8080/udp": {"8080/udp"}, "8080-8082/tcp": {"8080/tcp", "8081/tcp", "8082/tcp"}, diff --git a/pkg/container/docker_run_test.go b/pkg/container/docker_run_test.go index 9e85fb7..6a2c05b 100644 --- a/pkg/container/docker_run_test.go +++ b/pkg/container/docker_run_test.go @@ -20,6 +20,9 @@ import ( ) func TestDocker(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } ctx := context.Background() client, err := GetDockerClient(ctx) assert.NoError(t, err) |