Skip to content
Merged
Changes from all 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
18 changes: 16 additions & 2 deletions integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import (
"fmt"
"io"
"os"
"os/signal"
"path/filepath"
"runtime"
"strconv"
"strings"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -203,12 +205,24 @@ func setup(ctx context.Context, t *testing.T, name, coderImg, coderVersion strin
require.NoError(t, err, "create test deployment")

t.Logf("created container %s\n", ctr.ID)
t.Cleanup(func() { // Make sure we clean up after ourselves.
// TODO: also have this execute if you Ctrl+C!
var cleanupOnce sync.Once
removeContainer := func() {
t.Logf("stopping container %s\n", ctr.ID)
_ = cli.ContainerRemove(ctx, ctr.ID, container.RemoveOptions{
Force: true,
})
}
// Ensure the container is cleaned up if you press Ctrl+C.
sigCh := make(chan os.Signal, 1)
signal.Notify(sigCh, os.Interrupt)
go func() {
<-sigCh
cleanupOnce.Do(removeContainer)
os.Exit(1)
}()

t.Cleanup(func() { // Make sure we clean up after ourselves.
cleanupOnce.Do(removeContainer)
})

err = cli.ContainerStart(ctx, ctr.ID, container.StartOptions{})
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy