Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.
21 changes: 19 additions & 2 deletions Gopkg.lock

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

8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
PACKAGE_NAME ?= github.com/jetstack/tarmak
CONTAINER_DIR := /go/src/$(PACKAGE_NAME)
GO_VERSION := 1.10.4
TARMAK_VERSION ?= 0.5.2

BINDIR ?= $(CURDIR)/bin
PATH := $(BINDIR):$(PATH)
Expand Down Expand Up @@ -252,3 +253,10 @@ docker_%:

local_build: go_generate
go build -o tarmak_local_build ./cmd/tarmak

e2e-test: download build
go test -v -timeout 1h github.com/jetstack/tarmak/cmd/tarmak/e2e -e2e

download:
curl -sL -o tarmak_$(TARMAK_VERSION)_$(UNAME_S)_amd64 https://github.com/jetstack/tarmak/releases/download/$(TARMAK_VERSION)/tarmak_$(TARMAK_VERSION)_$(UNAME_S)_amd64
chmod +x tarmak_$(TARMAK_VERSION)_$(UNAME_S)_amd64
138 changes: 138 additions & 0 deletions cmd/tarmak/e2e/e2e_cluster_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
// Copyright Jetstack Ltd. See LICENSE for details.
package e2e_test

import (
"fmt"
"os"
"runtime"
"testing"
)

func TestAWSSingleCluster(t *testing.T) {
t.Parallel()
skipE2ETests(t)

ti := NewTarmakInstance(t)
ti.singleCluster = true
ti.singleZone = true

if err := ti.GenerateAndBuild(); err != nil {
t.Fatal(err)
}

defer func() {
t.Log("run environment destroy command")
c := ti.Command("environment", "destroy", ti.environmentName, "--auto-approve")
// write error out to my stdout
c.Stderr = os.Stderr
if err := c.Run(); err != nil {
t.Errorf("unexpected error: %+v", err)
}
}()

if err := ti.RunAndVerify(); err != nil {
t.Fatal(err)
}
}

func TestAWSMultiCluster(t *testing.T) {
t.Parallel()
skipE2ETests(t)

ti := NewTarmakInstance(t)
ti.singleCluster = false
ti.singleZone = false

if err := ti.GenerateAndBuild(); err != nil {
t.Fatal(err)
}

defer func() {
t.Log("run environment destroy command")
c := ti.Command("environment", "destroy", ti.environmentName, "--auto-approve")
// write error out to my stdout
c.Stderr = os.Stderr
if err := c.Run(); err != nil {
t.Errorf("unexpected error: %+v", err)
}
}()
t.Log("run hub apply command")
c := ti.Command("--current-cluster", fmt.Sprintf("%s-hub", ti.environmentName), "cluster", "apply")
// write error out to my stdout
c.Stderr = os.Stderr
if err := c.Run(); err != nil {
t.Fatalf("unexpected error: %+v", err)
}

if err := ti.RunAndVerify(); err != nil {
t.Fatal(err)
}
}

func TestAWSUpgradeTarmak(t *testing.T) {
t.Parallel()
skipE2ETests(t)

ti := NewTarmakInstance(t)
ti.singleCluster = true
ti.singleZone = true

ti.binPath = fmt.Sprintf("../../../tarmak_0.5.2_%s_%s", runtime.GOOS, runtime.GOARCH)

if err := ti.GenerateAndBuild(); err != nil {
t.Fatal(err)
}

defer func() {
t.Log("run environment destroy command")
c := ti.Command("environment", "destroy", ti.environmentName, "--auto-approve")
// write error out to my stdout
c.Stderr = os.Stderr
if err := c.Run(); err != nil {
t.Errorf("unexpected error: %+v", err)
}
}()

if err := ti.RunAndVerify(); err != nil {
t.Fatal(err)
}

ti.binPath = fmt.Sprintf("../../../tarmak_%s_%s", runtime.GOOS, runtime.GOARCH)

if err := ti.RunAndVerify(); err != nil {
t.Fatal(err)
}
}

func TestAWSUpgradeKubernetes(t *testing.T) {
t.Parallel()
skipE2ETests(t)

ti := NewTarmakInstance(t)
ti.singleCluster = true
ti.singleZone = true

if err := ti.GenerateAndBuild(); err != nil {
t.Fatal(err)
}

defer func() {
t.Log("run environment destroy command")
c := ti.Command("environment", "destroy", ti.environmentName, "--auto-approve")
// write error out to my stdout
c.Stderr = os.Stderr
if err := c.Run(); err != nil {
t.Errorf("unexpected error: %+v", err)
}
}()

if err := ti.RunAndVerify(); err != nil {
t.Fatal(err)
}

ti.UpdateKubernetesVersion()

if err := ti.RunAndVerify(); err != nil {
t.Fatal(err)
}
}
Loading