1
0
Fork 0
mirror of https://github.com/arangodb/kube-arangodb.git synced 2024-12-14 11:57:37 +00:00

Split tests in long vs short

This commit is contained in:
Ewout Prangsma 2018-03-01 11:15:18 +01:00
parent 9ea46f07bd
commit ab8b59108a
No known key found for this signature in database
GPG key ID: 4DBAD380D93D0698
6 changed files with 30 additions and 6 deletions

View file

@ -25,6 +25,7 @@ pipeline {
}
agent any
parameters {
booleanParam(name: 'LONG', defaultValue: false, description: 'Execute long running tests')
string(name: 'KUBECONFIG', defaultValue: '/home/jenkins/.kube/scw-183a3b', description: 'KUBECONFIG controls which k8s cluster is used', )
string(name: 'TESTNAMESPACE', defaultValue: 'jenkins', description: 'TESTNAMESPACE sets the kubernetes namespace to ru tests in (this must be short!!)', )
string(name: 'ENTERPRISEIMAGE', defaultValue: '', description: 'ENTERPRISEIMAGE sets the docker image used for enterprise tests)', )
@ -48,11 +49,12 @@ pipeline {
lock("${params.TESTNAMESPACE}-${env.GIT_COMMIT}") {
withCredentials([string(credentialsId: 'ENTERPRISEIMAGE', variable: 'DEFAULTENTERPRISEIMAGE')]) {
withEnv([
"KUBECONFIG=${params.KUBECONFIG}",
"TESTNAMESPACE=${params.TESTNAMESPACE}-${env.GIT_COMMIT}",
"IMAGETAG=${env.GIT_COMMIT}",
"PUSHIMAGES=1",
"ENTERPRISEIMAGE=${params.ENTERPRISEIMAGE}",
"IMAGETAG=${env.GIT_COMMIT}",
"KUBECONFIG=${params.KUBECONFIG}",
"LONG=${params.LONG ? 1 : 0}",
"PUSHIMAGES=1",
"TESTNAMESPACE=${params.TESTNAMESPACE}-${env.GIT_COMMIT}",
]) {
sh "make run-tests"
}

View file

@ -54,6 +54,12 @@ GHRELEASE := $(GOBUILDDIR)/bin/github-release
ifndef TESTNAMESPACE
TESTNAMESPACE := arangodb-operator-tests
endif
TESTLENGTHOPTIONS := -test.short
TESTTIMEOUT := 20m
ifeq ($(LONG), 1)
TESTLENGTHOPTIONS :=
TESTTIMEOUT := 40m
endif
SOURCES := $(shell find $(SRCDIR) -name '*.go' -not -path './test/*')
@ -193,7 +199,7 @@ endif
--env="ENTERPRISEIMAGE=$(ENTERPRISEIMAGE)" \
--env="TEST_NAMESPACE=$(TESTNAMESPACE)" \
-- \
-test.v
-test.v -test.timeout $(TESTTIMEOUT) $(TESTLENGTHOPTIONS)
kubectl delete namespace $(TESTNAMESPACE) --ignore-not-found --now
cleanup-tests:

View file

@ -17,6 +17,7 @@ import (
// TestAuthenticationSingleDefaultSecret creating a single server
// with default authentication (on) using a generated JWT secret.
func TestAuthenticationSingleDefaultSecret(t *testing.T) {
longOrSkip(t)
c := client.MustNewInCluster()
kubecli := mustNewKubeClient(t)
ns := getNamespace(t)
@ -63,6 +64,7 @@ func TestAuthenticationSingleDefaultSecret(t *testing.T) {
// TestAuthenticationSingleCustomSecret creating a single server
// with default authentication (on) using a user created JWT secret.
func TestAuthenticationSingleCustomSecret(t *testing.T) {
longOrSkip(t)
c := client.MustNewInCluster()
kubecli := mustNewKubeClient(t)
ns := getNamespace(t)
@ -113,6 +115,7 @@ func TestAuthenticationSingleCustomSecret(t *testing.T) {
// TestAuthenticationNoneSingle creating a single server
// with authentication set to `None`.
func TestAuthenticationNoneSingle(t *testing.T) {
longOrSkip(t)
c := client.MustNewInCluster()
kubecli := mustNewKubeClient(t)
ns := getNamespace(t)
@ -150,6 +153,7 @@ func TestAuthenticationNoneSingle(t *testing.T) {
// TestAuthenticationClusterDefaultSecret creating a cluster
// with default authentication (on) using a generated JWT secret.
func TestAuthenticationClusterDefaultSecret(t *testing.T) {
longOrSkip(t)
c := client.MustNewInCluster()
kubecli := mustNewKubeClient(t)
ns := getNamespace(t)
@ -196,6 +200,7 @@ func TestAuthenticationClusterDefaultSecret(t *testing.T) {
// TestAuthenticationClusterCustomSecret creating a cluster
// with default authentication (on) using a user created JWT secret.
func TestAuthenticationClusterCustomSecret(t *testing.T) {
longOrSkip(t)
c := client.MustNewInCluster()
kubecli := mustNewKubeClient(t)
ns := getNamespace(t)
@ -246,7 +251,7 @@ func TestAuthenticationClusterCustomSecret(t *testing.T) {
// TestAuthenticationNoneCluster creating a cluster
// with authentication set to `None`.
func TestAuthenticationNoneCluster(t *testing.T) {
// Do not allow to run this test in parallel, because it is already claiming a lot of resources.
longOrSkip(t)
c := client.MustNewInCluster()
kubecli := mustNewKubeClient(t)
ns := getNamespace(t)

View file

@ -16,6 +16,7 @@ import (
// TestRocksDBEncryptionSingle tests the creating of a single server deployment
// with RocksDB & Encryption.
func TestRocksDBEncryptionSingle(t *testing.T) {
longOrSkip(t)
image := getEnterpriseImageOrSkip(t)
c := client.MustNewInCluster()
kubecli := mustNewKubeClient(t)

View file

@ -14,6 +14,7 @@ import (
// TestScaleCluster tests scaling up/down the number of DBServers & coordinators
// of a cluster.
func TestScaleCluster(t *testing.T) {
longOrSkip(t)
c := client.MustNewInCluster()
kubecli := mustNewKubeClient(t)
ns := getNamespace(t)

View file

@ -52,6 +52,15 @@ var (
maskAny = errors.WithStack
)
// longOrSkip checks the short test flag.
// If short is set, the current test is skipped.
// If not, this function returns as normal.
func longOrSkip(t *testing.T) {
if testing.Short() {
t.Skip("Test skipped in short test")
}
}
// getEnterpriseImageOrSkip returns the docker image used for enterprise
// tests. If empty, enterprise tests are skipped.
func getEnterpriseImageOrSkip(t *testing.T) string {