Skip to content

Commit

Permalink
Begin creating integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mpchadwick committed Nov 6, 2020
1 parent 4555ca5 commit c7897ec
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ build:
$$GOPATH/bin/go-bindata -pkg dbanon -o src/bindata.go etc/*
GO111MODULE=on go get ./...
GO111MODULE=on go test $$GOPATH/src/github.com/mpchadwick/dbanon/src
GO111MODULE=on go build -ldflags "$(LDFLAGS)" -o dbanon main.go
GO111MODULE=on go build -ldflags "$(LDFLAGS)" -o dbanon main.go
GO111MODULE=on go test $$GOPATH/src/github.com/mpchadwick/dbanon/integration
26 changes: 26 additions & 0 deletions integration/dbanon_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package main

import (
"os"
"os/exec"
"path"
"path/filepath"
"strings"
"testing"
)

var binaryName = "dbanon"

func TestDbanon(t *testing.T) {
dir, _ := os.Getwd()
parent := filepath.Dir(dir)
cmd := exec.Command(path.Join(parent, binaryName))
output, _ := cmd.CombinedOutput()

actual := strings.TrimSpace(string(output))

if actual != "You must specify a config" {
t.Errorf("Got %s expected missing config error", actual)
}

}

0 comments on commit c7897ec

Please sign in to comment.