Skip to content
Permalink
Browse files

Split out independent tests

Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
  • Loading branch information...
puiterwijk authored and mergify committed Apr 13, 2019
1 parent eeb960c commit 35a4886ff54ef3c0b1eab5f497c3fa255373cae9
@@ -12,6 +12,7 @@ env:
global:
- GO111MODULE=on
matrix:
- REPOSPANNER_FUNCTIONAL_CLONE_METHOD=indep
- REPOSPANNER_FUNCTIONAL_CLONE_METHOD=ssh
- REPOSPANNER_FUNCTIONAL_CLONE_METHOD=https
matrix:
@@ -214,13 +214,25 @@ var (
}
)

func runCloneMethodIndependentTest(t *testing.T) bool {
testedMethod := os.Getenv("REPOSPANNER_FUNCTIONAL_CLONE_METHOD")
if testedMethod == "" || testedMethod == "indep" {
return true
}
t.Log("Skipping clonemethod independent test")
return false
}

func runForTestedCloneMethods(t *testing.T, m func(*testing.T, cloneMethod)) {
torun := testedCloneMethods
testedMethod := os.Getenv("REPOSPANNER_FUNCTIONAL_CLONE_METHOD")
if testedMethod == "ssh" {
torun = []cloneMethod{cloneMethodSSH}
} else if testedMethod == "https" {
torun = []cloneMethod{cloneMethodHTTPS}
} else if testedMethod == "indep" {
t.Log("Skipping clonemethod dependent test")
return
}
for _, method := range torun {
createTestDirectory(t)
@@ -10,6 +10,10 @@ import (
)

func TestWeakKeysNotInHelp(t *testing.T) {
if !runCloneMethodIndependentTest(t) {
return
}

defer testCleanup(t)
createTestConfig(t, "ca", 0)

@@ -26,6 +30,9 @@ func TestWeakKeysNotInHelp(t *testing.T) {
}

func TestCaInit(t *testing.T) {
if !runCloneMethodIndependentTest(t) {
return
}
defer testCleanup(t)
createTestConfig(t, "ca", 0)

@@ -78,6 +85,10 @@ func TestCaInit(t *testing.T) {
}

func TestCaInitNoNameConstraint(t *testing.T) {
if !runCloneMethodIndependentTest(t) {
return
}

defer testCleanup(t)
createTestConfig(t, "ca", 0)

@@ -106,6 +117,10 @@ func TestCaInitNoNameConstraint(t *testing.T) {
}

func TestCaInitRandomCN(t *testing.T) {
if !runCloneMethodIndependentTest(t) {
return
}

defer testCleanup(t)
createTestConfig(t, "ca", 0)

@@ -159,6 +174,10 @@ func TestCaInitRandomCN(t *testing.T) {
}

func TestCANode(t *testing.T) {
if !runCloneMethodIndependentTest(t) {
return
}

defer testCleanup(t)
createTestCA(t)

@@ -169,6 +188,10 @@ func TestCANode(t *testing.T) {
}

func TestCaLeaf(t *testing.T) {
if !runCloneMethodIndependentTest(t) {
return
}

defer testCleanup(t)
createTestCA(t)

@@ -20,6 +20,10 @@ func nodeInfoVerification(t *testing.T, node nodeNrType) {
}

func TestJoin(t *testing.T) {
if !runCloneMethodIndependentTest(t) {
return
}

defer testCleanup(t)
nodea := nodeNrType(1)
nodeb := nodeNrType(2)
@@ -27,6 +27,10 @@ func performEmptyCloneTest(t *testing.T, method cloneMethod) {
}

func TestAnonymousClones(t *testing.T) {
if !runCloneMethodIndependentTest(t) {
return
}

defer testCleanup(t)
nodea := nodeNrType(1)
nodeb := nodeNrType(2)
@@ -71,6 +71,10 @@ func verifyReposExist(t *testing.T, node nodeNrType, repos ...testRepoInfo) {
}

func TestRepoManagement(t *testing.T) {
if !runCloneMethodIndependentTest(t) {
return
}

defer testCleanup(t)
nodea := nodeNrType(1)
nodeb := nodeNrType(2)
@@ -6,6 +6,10 @@ import (
)

func TestSpawn(t *testing.T) {
if !runCloneMethodIndependentTest(t) {
return
}

defer testCleanup(t)
nodea := nodeNrType(1)
createNodeCert(t, nodea)
@@ -31,6 +35,10 @@ func TestSpawn(t *testing.T) {
}

func TestSimpleRun(t *testing.T) {
if !runCloneMethodIndependentTest(t) {
return
}

defer testCleanup(t)
nodea := nodeNrType(1)
spawnNode(t, nodea)

0 comments on commit 35a4886

Please sign in to comment.
You can’t perform that action at this time.