Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,19 @@ jobs:
go mod download

- name: Build
env:
CGO_ENABLED: "0"
Comment on lines +36 to +37
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: this is required because coder/coder is based on alpine and it will otherwise look for libc

run: |
go build -v .

- name: Run integration test
timeout-minutes: 10
env:
CODER_IMAGE: "ghcr.io/coder/coder"
CODER_VERSION: "latest"
run: |
go test -v ./integration

# run acceptance tests in a matrix with Terraform core versions
test:
name: Matrix Test
Expand Down
16 changes: 13 additions & 3 deletions integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"encoding/json"
"fmt"
"io"
"os"
"path/filepath"
"runtime"
Expand All @@ -15,6 +16,7 @@ import (

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/client"
"github.com/docker/docker/pkg/stdcopy"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -82,8 +84,8 @@ func TestIntegration(t *testing.T) {
"workspace_owner.name": `testing`,
"workspace_owner.oidc_access_token": `^$`, // TODO: test OIDC integration
"workspace_owner.session_token": `.+`,
"workspace_owner.ssh_private_key": `^$`, // Depends on coder/coder#13366
"workspace_owner.ssh_public_key": `^$`, // Depends on coder/coder#13366
"workspace_owner.ssh_private_key": `(?s)^.+?BEGIN OPENSSH PRIVATE KEY.+?END OPENSSH PRIVATE KEY.+?$`,
"workspace_owner.ssh_public_key": `(?s)^ssh-ed25519.+$`,
},
},
} {
Expand Down Expand Up @@ -148,9 +150,17 @@ func setup(ctx context.Context, t *testing.T) string {
require.NoError(t, err, "get abs path of parent")
t.Logf("src path is %s\n", srcPath)

// Ensure the image is available locally.
refStr := coderImg + ":" + coderVersion
t.Logf("ensuring image %q", refStr)
resp, err := cli.ImagePull(ctx, refStr, image.PullOptions{})
require.NoError(t, err)
_, err = io.ReadAll(resp)
require.NoError(t, err)

// Stand up a temporary Coder instance
ctr, err := cli.ContainerCreate(ctx, &container.Config{
Image: coderImg + ":" + coderVersion,
Image: refStr,
Env: []string{
"CODER_ACCESS_URL=" + localURL, // Set explicitly to avoid creating try.coder.app URLs.
"CODER_IN_MEMORY=true", // We don't necessarily care about real persistence here.
Expand Down