Skip to content

Commit 6cb4f4a

Browse files
committed
chore(integration): ensure presence of image
1 parent df75712 commit 6cb4f4a

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

integration/integration_test.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"context"
66
"encoding/json"
77
"fmt"
8+
"io"
89
"os"
910
"path/filepath"
1011
"runtime"
@@ -15,6 +16,7 @@ import (
1516

1617
"github.com/docker/docker/api/types"
1718
"github.com/docker/docker/api/types/container"
19+
"github.com/docker/docker/api/types/image"
1820
"github.com/docker/docker/client"
1921
"github.com/docker/docker/pkg/stdcopy"
2022
"github.com/stretchr/testify/assert"
@@ -82,8 +84,8 @@ func TestIntegration(t *testing.T) {
8284
"workspace_owner.name": `testing`,
8385
"workspace_owner.oidc_access_token": `^$`, // TODO: test OIDC integration
8486
"workspace_owner.session_token": `.+`,
85-
"workspace_owner.ssh_private_key": `^$`, // Depends on coder/coder#13366
86-
"workspace_owner.ssh_public_key": `^$`, // Depends on coder/coder#13366
87+
"workspace_owner.ssh_private_key": `(?s)^.+?BEGIN OPENSSH PRIVATE KEY.+?END OPENSSH PRIVATE KEY.+?$`,
88+
"workspace_owner.ssh_public_key": `(?s)^ssh-ed25519.+$`,
8789
},
8890
},
8991
} {
@@ -148,9 +150,17 @@ func setup(ctx context.Context, t *testing.T) string {
148150
require.NoError(t, err, "get abs path of parent")
149151
t.Logf("src path is %s\n", srcPath)
150152

153+
// Ensure the image is available locally.
154+
refStr := coderImg + ":" + coderVersion
155+
t.Logf("ensuring image %q", refStr)
156+
resp, err := cli.ImagePull(ctx, refStr, image.PullOptions{})
157+
require.NoError(t, err)
158+
_, err = io.ReadAll(resp)
159+
require.NoError(t, err)
160+
151161
// Stand up a temporary Coder instance
152162
ctr, err := cli.ContainerCreate(ctx, &container.Config{
153-
Image: coderImg + ":" + coderVersion,
163+
Image: refStr,
154164
Env: []string{
155165
"CODER_ACCESS_URL=" + localURL, // Set explicitly to avoid creating try.coder.app URLs.
156166
"CODER_IN_MEMORY=true", // We don't necessarily care about real persistence here.

0 commit comments

Comments
 (0)