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

Add an e2e for ignite run #412

Merged
merged 4 commits into from
Sep 10, 2019
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,6 @@ test-docs: build-docs
serve-docs: build-docs
@echo Stating docs website on http://localhost:${DOCS_PORT}/_build/html/index.html
@docker run -i --rm -p ${DOCS_PORT}:8000 -e USER_ID=$$UID ignite-docs

e2e: build-all
sudo IGNITE_E2E_HOME=$(shell pwd) $(shell which go) test ./e2e/. -count 1
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/. -count 1
//

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))
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ require (
google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107 // indirect
google.golang.org/grpc v1.21.1 // indirect
gopkg.in/alessio/shellescape.v1 v1.0.0-20170105083845-52074bc9df61
gotest.tools v2.2.0+incompatible // indirect
gotest.tools v2.2.0+incompatible
k8s.io/apimachinery v0.0.0-20190612205821-1799e75a0719
k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf
sigs.k8s.io/yaml v1.1.0
Expand Down
27 changes: 27 additions & 0 deletions vendor/github.com/google/go-cmp/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading