Skip to content

Commit 3c02077

Browse files
committed
tests: backward-compatibility with v0.8.2
We recently introduced bad-looking regressions in v0.9.0. These were not caught by our test suite. This commit adds a new `backward_compatibility` suite to make sure it doesn't happen again. Signed-off-by: Albin Kerouanton <[email protected]>
1 parent 833d2c3 commit 3c02077

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+7753
-1
lines changed

.github/workflows/build.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,16 @@ jobs:
5050
- macOS-14
5151
- macOS-13
5252
- windows-2022
53+
env:
54+
TEST_BC_BASE_VERSION: 0.8.2
55+
TEST_BC_SKIP_VERSION_COMPARE: "true"
5356
steps:
5457
-
5558
name: Checkout
5659
uses: actions/checkout@v4
60+
with:
61+
# fetch-tags is required for backward compatibility tests
62+
fetch-tags: true
5763
-
5864
name: Set up Go
5965
uses: actions/setup-go@v5
@@ -106,6 +112,70 @@ jobs:
106112
run: |
107113
make test COVERAGEDIR=${{ env.DESTDIR }}
108114
shell: bash
115+
-
116+
name: Test backward compatibility (pass)
117+
if: startsWith(matrix.os, 'ubuntu-') || startsWith(matrix.os, 'macOS-')
118+
run: |
119+
export TMPDIR=${TMPDIR:-/tmp}
120+
export helper=pass
121+
122+
wget -O ${TMPDIR}/docker-credential-${helper} https://github.com/docker/docker-credential-helpers/releases/download/v${TEST_BC_BASE_VERSION}/docker-credential-${helper}-v${TEST_BC_BASE_VERSION}.$(go env GOOS)-$(go env GOARCH)
123+
chmod +x ${TMPDIR}/docker-credential-${helper}
124+
125+
make build-${helper}
126+
127+
export TEST_BC_PREVIOUS_COMMAND=${TMPDIR}/docker-credential-${helper}
128+
export TEST_BC_COMMAND=$(realpath ${DESTDIR}/docker-credential-${helper})
129+
130+
make test-backward-compatibility
131+
shell: bash
132+
-
133+
name: Test backward compatibility (secretservice)
134+
if: startsWith(matrix.os, 'ubuntu-')
135+
run: |
136+
export TMPDIR=${TMPDIR:-/tmp}
137+
export helper=secretservice
138+
139+
wget -O ${TMPDIR}/docker-credential-${helper} https://github.com/docker/docker-credential-helpers/releases/download/v${TEST_BC_BASE_VERSION}/docker-credential-${helper}-v${TEST_BC_BASE_VERSION}.$(go env GOOS)-$(go env GOARCH)
140+
chmod +x ${TMPDIR}/docker-credential-${helper}
141+
142+
make build-${helper}
143+
144+
export TEST_BC_PREVIOUS_COMMAND=${TMPDIR}/docker-credential-${helper}
145+
export TEST_BC_COMMAND=$(realpath ${DESTDIR}/docker-credential-${helper})
146+
147+
make test-backward-compatibility
148+
shell: bash
149+
-
150+
name: Test backward compatibility (osxkeychain)
151+
if: startsWith(matrix.os, 'macOS-')
152+
run: |
153+
export TMPDIR=${TMPDIR:-/tmp}
154+
export helper=osxkeychain
155+
156+
wget -O ${TMPDIR}/docker-credential-${helper} https://github.com/docker/docker-credential-helpers/releases/download/v${TEST_BC_BASE_VERSION}/docker-credential-${helper}-v${TEST_BC_BASE_VERSION}.$(go env GOOS)-$(go env GOARCH)
157+
chmod +x ${TMPDIR}/docker-credential-${helper}
158+
159+
make build-${helper}
160+
161+
export TEST_BC_PREVIOUS_COMMAND=${TMPDIR}/docker-credential-${helper}
162+
export TEST_BC_COMMAND=$(realpath ${DESTDIR}/docker-credential-${helper})
163+
164+
make test-backward-compatibility
165+
shell: bash
166+
-
167+
name: Test backward compatibility (wincred)
168+
if: startsWith(matrix.os, 'windows-')
169+
run: |
170+
export helper=wincred
171+
172+
Invoke-WebRequest -OutFile ${TMPDIR}/docker-credential-${helper}.exe https://github.com/docker/docker-credential-helpers/releases/download/v${TEST_BC_BASE_VERSION}/docker-credential-${helper}-v${TEST_BC_BASE_VERSION}.$(go env GOOS)-$(go env GOARCH).exe
173+
174+
export TEST_BC_PREVIOUS_COMMAND=${TMPDIR}/docker-credential-${helper}.exe
175+
export TEST_BC_COMMAND=$(Resolve-Path ${DESTDIR}/docker-credential-${helper}.exe)
176+
177+
make test-backward-compatibility
178+
shell: bash
109179
-
110180
name: Upload coverage
111181
uses: codecov/codecov-action@v5

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ test:
6262
go test -short -v -coverprofile=$(COVERAGEDIR)/coverage.txt -covermode=atomic ./...
6363
go tool cover -func=$(COVERAGEDIR)/coverage.txt
6464

65+
.PHONY: test-backward-compatibility
66+
test-backward-compatibility:
67+
go test -short -v ./tests/backward_compatibility
68+
6569
.PHONY: lint
6670
lint:
6771
$(BUILDX_CMD) bake lint

go.mod

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ retract v0.9.0 // osxkeychain: a regression caused backward-incompatibility with
77
require (
88
github.com/danieljoos/wincred v1.2.2
99
github.com/keybase/go-keychain v0.0.1
10+
gotest.tools/v3 v3.5.2
1011
)
1112

12-
require golang.org/x/sys v0.20.0 // indirect
13+
require (
14+
github.com/google/go-cmp v0.5.9 // indirect
15+
golang.org/x/sys v0.20.0 // indirect
16+
)

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ github.com/danieljoos/wincred v1.2.2 h1:774zMFJrqaeYCK2W57BgAem/MLi6mtSE47MB6BOJ
22
github.com/danieljoos/wincred v1.2.2/go.mod h1:w7w4Utbrz8lqeMbDAK0lkNJUv5sAOkFi7nd/ogr0Uh8=
33
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
44
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5+
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
6+
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
57
github.com/keybase/go-keychain v0.0.1 h1:way+bWYa6lDppZoZcgMbYsvC7GxljxrskdNInRtuthU=
68
github.com/keybase/go-keychain v0.0.1/go.mod h1:PdEILRW3i9D8JcdM+FmY6RwkHGnhHxXwkPPMeUgOK1k=
79
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@@ -14,3 +16,5 @@ golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
1416
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
1517
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
1618
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
19+
gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
20+
gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=

0 commit comments

Comments
 (0)