Skip to content

Commit

Permalink
Merge pull request #1337 from buildpacks/feature/gitpod-config
Browse files Browse the repository at this point in the history
Configure gitpod test execution to work out-of-the-box
Signed-off-by: David Freilich <[email protected]>
  • Loading branch information
dfreilich authored Dec 6, 2021
2 parents 4459a0a + e96bd8d commit 52a3caa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

tasks:
- init: make build
- name: Setup
before: chmod ugo+w /var/run/docker.sock
init: make build
command: chmod ugo+w /var/run/docker.sock

github:
prebuilds:
master: true
Expand All @@ -11,4 +15,4 @@ github:

vscode:
extensions:
- golang.go
- golang.go
7 changes: 7 additions & 0 deletions internal/build/phase_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ func testPhase(t *testing.T, when spec.G, it spec.S) {
it.Before(func() {
h.SkipIf(t, runtime.GOOS != "linux", "Skipped on non-linux")
})

it("allows daemon access inside the container", func() {
tmp, err := ioutil.TempDir("", "testSocketDir")
if err != nil {
Expand All @@ -320,7 +321,12 @@ func testPhase(t *testing.T, when spec.G, it spec.S) {
when("with TCP docker-host", func() {
it.Before(func() {
h.SkipIf(t, runtime.GOOS != "linux", "Skipped on non-linux")

// this test is problematic in GitPod due to the special networking used
// see: https://github.com/gitpod-io/gitpod/issues/6446
h.SkipIf(t, os.Getenv("GITPOD_WORKSPACE_ID") != "", "Skipped on GitPod")
})

it("allows daemon access inside the container", func() {
forwardCtx, cancelForward := context.WithCancel(context.Background())
defer cancelForward()
Expand All @@ -331,6 +337,7 @@ func testPhase(t *testing.T, when spec.G, it spec.S) {
forwardUnix2TCP(forwardCtx, t, portChan)
forwardExited <- struct{}{}
}()

dockerHost := fmt.Sprintf("tcp://127.0.0.1:%d", <-portChan)
configProvider := build.NewPhaseConfigProvider(phaseName, lifecycleExec,
build.WithArgs("daemon"),
Expand Down

0 comments on commit 52a3caa

Please sign in to comment.