5
5
"context"
6
6
"encoding/json"
7
7
"fmt"
8
+ "io"
8
9
"os"
9
10
"path/filepath"
10
11
"runtime"
@@ -15,6 +16,7 @@ import (
15
16
16
17
"github.com/docker/docker/api/types"
17
18
"github.com/docker/docker/api/types/container"
19
+ "github.com/docker/docker/api/types/image"
18
20
"github.com/docker/docker/client"
19
21
"github.com/docker/docker/pkg/stdcopy"
20
22
"github.com/stretchr/testify/assert"
@@ -82,8 +84,8 @@ func TestIntegration(t *testing.T) {
82
84
"workspace_owner.name" : `testing` ,
83
85
"workspace_owner.oidc_access_token" : `^$` , // TODO: test OIDC integration
84
86
"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.+ $` ,
87
89
},
88
90
},
89
91
} {
@@ -148,9 +150,17 @@ func setup(ctx context.Context, t *testing.T) string {
148
150
require .NoError (t , err , "get abs path of parent" )
149
151
t .Logf ("src path is %s\n " , srcPath )
150
152
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
+
151
161
// Stand up a temporary Coder instance
152
162
ctr , err := cli .ContainerCreate (ctx , & container.Config {
153
- Image : coderImg + ":" + coderVersion ,
163
+ Image : refStr ,
154
164
Env : []string {
155
165
"CODER_ACCESS_URL=" + localURL , // Set explicitly to avoid creating try.coder.app URLs.
156
166
"CODER_IN_MEMORY=true" , // We don't necessarily care about real persistence here.
0 commit comments