Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
first e2e test case for command run in docker / docker-bridge environ…
Browse files Browse the repository at this point in the history
…ment
  • Loading branch information
chanwit committed Sep 8, 2019
1 parent e82ba00 commit 841de6a
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions e2e/run_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// This is the e2e package to run tests for Ignite
// Currently, we do local e2e tests only
// we have to wait until the CI setup to allow Ignite to run with sudo and in a KVM environment.
//
// How to run tests:
// sudo IGNITE_E2E_HOME=$PWD $(which go) test ./e2e/.
//

package e2e

import (
"fmt"
"os"
"os/exec"
"path"
"testing"

"gotest.tools/assert"
)

func TestIgniteRunWithDockerAndDockerBridge(t *testing.T) {
// vmName should be unique for each test
const vmName = "e2e_test_ignite_run_docker_docker_bridge"

dir := os.Getenv("IGNITE_E2E_HOME")
assert.Assert(t, dir != "", "IGNITE_E2E_HOME should be set")

binary := path.Join(dir, "bin/ignite")
cmd := exec.Command(binary,
"--runtime=docker",
"--network-plugin=docker-bridge",
"run", "--name=" + vmName,
"weaveworks/ignite-ubuntu")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()

defer func() {
cmd := exec.Command(binary,
"--runtime=docker",
"--network-plugin=docker-bridge",
"rm", "-f", vmName)
assert.Check(t, cmd.Run(), "vm removal should not fail")
}()

assert.Check(t, err, fmt.Sprintf("%q should not fail to run", cmd.Args))
}

0 comments on commit 841de6a

Please sign in to comment.