aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2016-08-20 20:58:49 +0100
committerNiall Sheridan <nsheridan@gmail.com>2016-08-20 20:58:49 +0100
commit7e29b8a770a45b68638f5dba9ad58b755ccb4749 (patch)
tree8e1a36d970191dfb8d95c86db3f87163f6d15047
parent70b5eb8e1f220a2849a6759eda321205fcb79111 (diff)
Run some tests in parallel
-rw-r--r--cmd/cashier/client_test.go3
-rw-r--r--cmd/cashierd/handlers_test.go5
-rw-r--r--server/certutil/util_test.go1
-rw-r--r--server/config/config_test.go3
-rw-r--r--server/signer/signer_test.go2
-rw-r--r--server/store/config_test.go2
-rw-r--r--server/store/store_test.go5
7 files changed, 21 insertions, 0 deletions
diff --git a/cmd/cashier/client_test.go b/cmd/cashier/client_test.go
index dcf674b..8fe3cd0 100644
--- a/cmd/cashier/client_test.go
+++ b/cmd/cashier/client_test.go
@@ -19,6 +19,7 @@ import (
)
func TestLoadCert(t *testing.T) {
+ t.Parallel()
priv, _ := ssh.ParseRawPrivateKey(testdata.Priv)
key := priv.(*rsa.PrivateKey)
pub, _ := ssh.NewPublicKey(&key.PublicKey)
@@ -58,6 +59,7 @@ func TestLoadCert(t *testing.T) {
}
func TestSignGood(t *testing.T) {
+ t.Parallel()
res := &lib.SignResponse{
Status: "ok",
Response: string(testdata.Cert),
@@ -86,6 +88,7 @@ func TestSignGood(t *testing.T) {
}
func TestSignBad(t *testing.T) {
+ t.Parallel()
res := &lib.SignResponse{
Status: "error",
Response: `{"response": "error"}`,
diff --git a/cmd/cashierd/handlers_test.go b/cmd/cashierd/handlers_test.go
index db5efb4..38251ce 100644
--- a/cmd/cashierd/handlers_test.go
+++ b/cmd/cashierd/handlers_test.go
@@ -51,6 +51,7 @@ func newContext(t *testing.T) *appContext {
}
func TestLoginHandler(t *testing.T) {
+ t.Parallel()
req, _ := http.NewRequest("GET", "/auth/login", nil)
resp := httptest.NewRecorder()
loginHandler(newContext(t), resp, req)
@@ -60,6 +61,7 @@ func TestLoginHandler(t *testing.T) {
}
func TestCallbackHandler(t *testing.T) {
+ t.Parallel()
req, _ := http.NewRequest("GET", "/auth/callback", nil)
req.Form = url.Values{"state": []string{"state"}, "code": []string{"abcdef"}}
resp := httptest.NewRecorder()
@@ -72,6 +74,7 @@ func TestCallbackHandler(t *testing.T) {
}
func TestRootHandler(t *testing.T) {
+ t.Parallel()
req, _ := http.NewRequest("GET", "/", nil)
resp := httptest.NewRecorder()
ctx := newContext(t)
@@ -87,6 +90,7 @@ func TestRootHandler(t *testing.T) {
}
func TestRootHandlerNoSession(t *testing.T) {
+ t.Parallel()
req, _ := http.NewRequest("GET", "/", nil)
resp := httptest.NewRecorder()
ctx := newContext(t)
@@ -97,6 +101,7 @@ func TestRootHandlerNoSession(t *testing.T) {
}
func TestSignRevoke(t *testing.T) {
+ t.Parallel()
s, _ := json.Marshal(&lib.SignRequest{
Key: string(testdata.Pub),
ValidUntil: time.Now().UTC().Add(1 * time.Hour),
diff --git a/server/certutil/util_test.go b/server/certutil/util_test.go
index abb8f10..df42b90 100644
--- a/server/certutil/util_test.go
+++ b/server/certutil/util_test.go
@@ -8,6 +8,7 @@ import (
)
func TestGetPublicKey(t *testing.T) {
+ t.Parallel()
c, _, _, _, _ := ssh.ParseAuthorizedKey(testdata.Cert)
if GetPublicKey(c.(*ssh.Certificate)) != string(testdata.Cert) {
t.Fail()
diff --git a/server/config/config_test.go b/server/config/config_test.go
index 982e6e6..3a9d4c1 100644
--- a/server/config/config_test.go
+++ b/server/config/config_test.go
@@ -10,6 +10,7 @@ import (
)
func TestServerConfig(t *testing.T) {
+ t.Parallel()
a := assert.New(t)
c, err := ReadConfig(bytes.NewBuffer(testdata.ServerConfig))
if err != nil {
@@ -26,6 +27,7 @@ func TestServerConfig(t *testing.T) {
}
func TestAuthConfig(t *testing.T) {
+ t.Parallel()
a := assert.New(t)
c, err := ReadConfig(bytes.NewBuffer(testdata.AuthConfig))
if err != nil {
@@ -41,6 +43,7 @@ func TestAuthConfig(t *testing.T) {
}
func TestSSHConfig(t *testing.T) {
+ t.Parallel()
a := assert.New(t)
c, err := ReadConfig(bytes.NewBuffer(testdata.SSHConfig))
if err != nil {
diff --git a/server/signer/signer_test.go b/server/signer/signer_test.go
index 9c76f4b..5fbf2c6 100644
--- a/server/signer/signer_test.go
+++ b/server/signer/signer_test.go
@@ -24,6 +24,7 @@ var (
)
func TestCert(t *testing.T) {
+ t.Parallel()
r := &lib.SignRequest{
Key: string(testdata.Pub),
Principal: "gopher1",
@@ -53,6 +54,7 @@ func TestCert(t *testing.T) {
}
func TestRevocationList(t *testing.T) {
+ t.Parallel()
r := &lib.SignRequest{
Key: string(testdata.Pub),
Principal: "revoked",
diff --git a/server/store/config_test.go b/server/store/config_test.go
index f262b57..9a77027 100644
--- a/server/store/config_test.go
+++ b/server/store/config_test.go
@@ -9,6 +9,7 @@ import (
)
func TestMySQLConfig(t *testing.T) {
+ t.Parallel()
var tests = []struct {
in string
out []string
@@ -26,6 +27,7 @@ func TestMySQLConfig(t *testing.T) {
}
func TestMongoConfig(t *testing.T) {
+ t.Parallel()
var tests = []struct {
in string
out *mgo.DialInfo
diff --git a/server/store/store_test.go b/server/store/store_test.go
index 629230b..18fa0d1 100644
--- a/server/store/store_test.go
+++ b/server/store/store_test.go
@@ -17,6 +17,7 @@ import (
)
func TestParseCertificate(t *testing.T) {
+ t.Parallel()
a := assert.New(t)
now := uint64(time.Now().Unix())
r, _ := rsa.GenerateKey(rand.Reader, 1024)
@@ -88,11 +89,13 @@ func testStore(t *testing.T, db CertStorer) {
}
func TestMemoryStore(t *testing.T) {
+ t.Parallel()
db := NewMemoryStore()
testStore(t, db)
}
func TestMySQLStore(t *testing.T) {
+ t.Parallel()
config := os.Getenv("MYSQL_TEST_CONFIG")
if config == "" {
t.Skip("No MYSQL_TEST_CONFIG environment variable")
@@ -105,6 +108,7 @@ func TestMySQLStore(t *testing.T) {
}
func TestMongoStore(t *testing.T) {
+ t.Parallel()
config := os.Getenv("MONGO_TEST_CONFIG")
if config == "" {
t.Skip("No MONGO_TEST_CONFIG environment variable")
@@ -117,6 +121,7 @@ func TestMongoStore(t *testing.T) {
}
func TestSQLiteStore(t *testing.T) {
+ t.Parallel()
f, err := ioutil.TempFile("", "sqlite_test_db")
if err != nil {
t.Error(err)