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

Added test option for default arangodb docker image.

This commit is contained in:
lamai93 2018-10-19 14:47:44 +02:00
parent c680c033c2
commit 5699576279
4 changed files with 23 additions and 7 deletions

View file

@ -87,6 +87,7 @@ def buildTestSteps(Map myParams, String kubeConfigRoot, String kubeconfig) {
"DEPLOYMENTNAMESPACE=${myParams.TESTNAMESPACE}-${env.GIT_COMMIT}", "DEPLOYMENTNAMESPACE=${myParams.TESTNAMESPACE}-${env.GIT_COMMIT}",
"DOCKERNAMESPACE=${myParams.DOCKERNAMESPACE}", "DOCKERNAMESPACE=${myParams.DOCKERNAMESPACE}",
"ENTERPRISEIMAGE=${myParams.ENTERPRISEIMAGE}", "ENTERPRISEIMAGE=${myParams.ENTERPRISEIMAGE}",
"ARANGODIMAGE=${myParams.ARANGODIMAGE}",
"IMAGETAG=jenkins-test", "IMAGETAG=jenkins-test",
"KUBECONFIG=${kubeConfigRoot}/${kubeconfig}", "KUBECONFIG=${kubeConfigRoot}/${kubeconfig}",
"LONG=${myParams.LONG ? 1 : 0}", "LONG=${myParams.LONG ? 1 : 0}",
@ -129,7 +130,8 @@ pipeline {
string(name: 'DOCKERNAMESPACE', defaultValue: 'arangodb', description: 'DOCKERNAMESPACE sets the docker registry namespace in which the operator docker image will be pushed', ) string(name: 'DOCKERNAMESPACE', defaultValue: 'arangodb', description: 'DOCKERNAMESPACE sets the docker registry namespace in which the operator docker image will be pushed', )
string(name: 'KUBECONFIGS', defaultValue: 'kube-ams1,scw-183a3b', description: 'KUBECONFIGS is a comma separated list of Kubernetes configuration files (relative to /home/jenkins/.kube) on which the tests are run', ) string(name: 'KUBECONFIGS', defaultValue: 'kube-ams1,scw-183a3b', description: 'KUBECONFIGS is a comma separated list of Kubernetes configuration files (relative to /home/jenkins/.kube) on which the tests are run', )
string(name: 'TESTNAMESPACE', defaultValue: 'jenkins', description: 'TESTNAMESPACE sets the kubernetes namespace to ru tests in (this must be short!!)', ) 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)', ) string(name: 'ENTERPRISEIMAGE', defaultValue: '', description: 'ENTERPRISEIMAGE sets the docker image used for enterprise tests', )
string(name: 'ARANGODIMAGE', defaultValue: '', description: 'ARANGODIMAGE sets the docker image used for tests (except enterprise and update tests)', )
string(name: 'TESTOPTIONS', defaultValue: '', description: 'TESTOPTIONS is used to pass additional test options to the integration test', ) string(name: 'TESTOPTIONS', defaultValue: '', description: 'TESTOPTIONS is used to pass additional test options to the integration test', )
} }
stages { stages {

View file

@ -304,7 +304,7 @@ endif
kubectl apply -f $(MANIFESTPATHDEPLOYMENTREPLICATION) kubectl apply -f $(MANIFESTPATHDEPLOYMENTREPLICATION)
kubectl apply -f $(MANIFESTPATHTEST) kubectl apply -f $(MANIFESTPATHTEST)
$(ROOTDIR)/scripts/kube_create_storage.sh $(DEPLOYMENTNAMESPACE) $(ROOTDIR)/scripts/kube_create_storage.sh $(DEPLOYMENTNAMESPACE)
$(ROOTDIR)/scripts/kube_run_tests.sh $(DEPLOYMENTNAMESPACE) $(TESTIMAGE) "$(ENTERPRISEIMAGE)" $(TESTTIMEOUT) $(TESTLENGTHOPTIONS) $(ROOTDIR)/scripts/kube_run_tests.sh $(DEPLOYMENTNAMESPACE) $(TESTIMAGE) "$(ARANGODIMAGE)" "$(ENTERPRISEIMAGE)" $(TESTTIMEOUT) $(TESTLENGTHOPTIONS)
$(DURATIONTESTBIN): $(GOBUILDDIR) $(SOURCES) $(DURATIONTESTBIN): $(GOBUILDDIR) $(SOURCES)
@mkdir -p $(BINDIR) @mkdir -p $(BINDIR)

View file

@ -4,9 +4,10 @@
DEPLOYMENTNAMESPACE=$1 DEPLOYMENTNAMESPACE=$1
TESTIMAGE=$2 TESTIMAGE=$2
ENTERPRISEIMAGE=$3 ARANGODIMAGE=$3
TESTTIMEOUT=$4 ENTERPRISEIMAGE=$4
TESTLENGTHOPTIONS=$5 TESTTIMEOUT=$5
TESTLENGTHOPTIONS=$6
IMAGEID=$(docker inspect ${TESTIMAGE} '--format={{index .RepoDigests 0}}') IMAGEID=$(docker inspect ${TESTIMAGE} '--format={{index .RepoDigests 0}}')
@ -14,6 +15,7 @@ kubectl --namespace ${DEPLOYMENTNAMESPACE} \
run arangodb-operator-test -i --rm --quiet --restart=Never \ run arangodb-operator-test -i --rm --quiet --restart=Never \
--image=${IMAGEID} \ --image=${IMAGEID} \
--env="ENTERPRISEIMAGE=${ENTERPRISEIMAGE}" \ --env="ENTERPRISEIMAGE=${ENTERPRISEIMAGE}" \
--env="ARANGODIMAGE=${ARANGODIMAGE}" \
--env="TEST_NAMESPACE=${DEPLOYMENTNAMESPACE}" \ --env="TEST_NAMESPACE=${DEPLOYMENTNAMESPACE}" \
--env="CLEANDEPLOYMENTS=${CLEANDEPLOYMENTS}" \ --env="CLEANDEPLOYMENTS=${CLEANDEPLOYMENTS}" \
-- \ -- \

View file

@ -52,6 +52,7 @@ import (
"github.com/arangodb/kube-arangodb/pkg/util/arangod" "github.com/arangodb/kube-arangodb/pkg/util/arangod"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil" "github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
"github.com/arangodb/kube-arangodb/pkg/util/retry" "github.com/arangodb/kube-arangodb/pkg/util/retry"
"github.com/arangodb/kube-arangodb/pkg/util"
) )
const ( const (
@ -231,9 +232,9 @@ func getNamespace(t *testing.T) string {
} }
// newDeployment creates a basic ArangoDeployment with configured // newDeployment creates a basic ArangoDeployment with configured
// type & name. // type, name and image.
func newDeployment(name string) *api.ArangoDeployment { func newDeployment(name string) *api.ArangoDeployment {
return &api.ArangoDeployment{ depl := &api.ArangoDeployment{
TypeMeta: metav1.TypeMeta{ TypeMeta: metav1.TypeMeta{
APIVersion: api.SchemeGroupVersion.String(), APIVersion: api.SchemeGroupVersion.String(),
Kind: api.ArangoDeploymentResourceKind, Kind: api.ArangoDeploymentResourceKind,
@ -242,6 +243,17 @@ func newDeployment(name string) *api.ArangoDeployment {
Name: strings.ToLower(name), Name: strings.ToLower(name),
}, },
} }
// set default image to the value given in env
// some tests will override this value if they need a specific version
// like update tests
// if no value is given, use the operator default, which is arangodb/arangodb:latest
image := strings.TrimSpace(os.Getenv("ARANGODIMAGE"))
if image != "" {
depl.Spec.Image = util.NewString(image)
}
return depl
} }
// waitUntilDeployment waits until a deployment with given name in given namespace // waitUntilDeployment waits until a deployment with given name in given namespace