Skip to content

Commit

Permalink
Clean-up test execution
Browse files Browse the repository at this point in the history
This allows for using `go test -v ./...` to run all the tests without
requiring binaries to be available on the host. The integration tests
can be triggered using `go test -v -tags=integration ./...`
  • Loading branch information
mbyczkowski committed Apr 7, 2020
1 parent 92cd0f3 commit e37bb83
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 20 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
language: go
sudo: false

go:
- 1.13.x

deploy:
provider: releases
api_key:
Expand All @@ -15,7 +16,6 @@ deploy:
repo: square/certstrap
tags: true
go: "1.13.x" # ensure that this matches one of the go versions specified at the top
before_script:
- "./build"

script:
- "./test"
- "./integration_test"
11 changes: 1 addition & 10 deletions test → integration_test
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,8 @@

source ./build

if [ -z "$PKG" ]; then
PKG="cmd depot pkix tests"
fi

# tests package relies on BUILD_TAG to be exported
# BUILD_TAG is set by build script
export BUILD_TAG

# Unit tests
echo
for mod in $PKG; do
mod_path=$REPO_PATH/$mod
go test -v $mod_path
done
go test -v -tags=integration ./...
14 changes: 8 additions & 6 deletions tests/basic_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build integration

/*-
* Copyright 2015 Square Inc.
* Copyright 2014 CoreOS
Expand All @@ -19,19 +21,19 @@ package tests

import (
"bytes"
"fmt"
"io"
"os"
"os/exec"
"runtime"
"strings"
"testing"
"runtime"
"fmt"
"os"
)

const (
depotDir = ".certstrap-test"
hostname = "host1"
passphrase = "123456"
depotDir = ".certstrap-test"
hostname = "host1"
passphrase = "123456"
)

var binPath = fmt.Sprintf("../bin/certstrap-%s-%s-amd64", os.Getenv("BUILD_TAG"), runtime.GOOS)
Expand Down
2 changes: 2 additions & 0 deletions tests/ip_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build integration

/*-
* Copyright 2015 Square Inc.
* Copyright 2014 CoreOS
Expand Down
2 changes: 2 additions & 0 deletions tests/not_ca_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build integration

/*-
* Copyright 2015 Square Inc.
* Copyright 2014 CoreOS
Expand Down
2 changes: 2 additions & 0 deletions tests/uri_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build integration

/*-
* Copyright 2015 Square Inc.
* Copyright 2014 CoreOS
Expand Down
2 changes: 2 additions & 0 deletions tests/workflow_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build integration

/*-
* Copyright 2015 Square Inc.
* Copyright 2014 CoreOS
Expand Down

0 comments on commit e37bb83

Please sign in to comment.