Skip to content

Commit 28abb1b

Browse files
authored
Merge pull request #270 from arangodb/feature/test-with-arangod-image
Test Image Option
2 parents c680c03 + 5699576 commit 28abb1b

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

Jenkinsfile.groovy

+3-1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def buildTestSteps(Map myParams, String kubeConfigRoot, String kubeconfig) {
8787
"DEPLOYMENTNAMESPACE=${myParams.TESTNAMESPACE}-${env.GIT_COMMIT}",
8888
"DOCKERNAMESPACE=${myParams.DOCKERNAMESPACE}",
8989
"ENTERPRISEIMAGE=${myParams.ENTERPRISEIMAGE}",
90+
"ARANGODIMAGE=${myParams.ARANGODIMAGE}",
9091
"IMAGETAG=jenkins-test",
9192
"KUBECONFIG=${kubeConfigRoot}/${kubeconfig}",
9293
"LONG=${myParams.LONG ? 1 : 0}",
@@ -129,7 +130,8 @@ pipeline {
129130
string(name: 'DOCKERNAMESPACE', defaultValue: 'arangodb', description: 'DOCKERNAMESPACE sets the docker registry namespace in which the operator docker image will be pushed', )
130131
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', )
131132
string(name: 'TESTNAMESPACE', defaultValue: 'jenkins', description: 'TESTNAMESPACE sets the kubernetes namespace to ru tests in (this must be short!!)', )
132-
string(name: 'ENTERPRISEIMAGE', defaultValue: '', description: 'ENTERPRISEIMAGE sets the docker image used for enterprise tests)', )
133+
string(name: 'ENTERPRISEIMAGE', defaultValue: '', description: 'ENTERPRISEIMAGE sets the docker image used for enterprise tests', )
134+
string(name: 'ARANGODIMAGE', defaultValue: '', description: 'ARANGODIMAGE sets the docker image used for tests (except enterprise and update tests)', )
133135
string(name: 'TESTOPTIONS', defaultValue: '', description: 'TESTOPTIONS is used to pass additional test options to the integration test', )
134136
}
135137
stages {

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ endif
304304
kubectl apply -f $(MANIFESTPATHDEPLOYMENTREPLICATION)
305305
kubectl apply -f $(MANIFESTPATHTEST)
306306
$(ROOTDIR)/scripts/kube_create_storage.sh $(DEPLOYMENTNAMESPACE)
307-
$(ROOTDIR)/scripts/kube_run_tests.sh $(DEPLOYMENTNAMESPACE) $(TESTIMAGE) "$(ENTERPRISEIMAGE)" $(TESTTIMEOUT) $(TESTLENGTHOPTIONS)
307+
$(ROOTDIR)/scripts/kube_run_tests.sh $(DEPLOYMENTNAMESPACE) $(TESTIMAGE) "$(ARANGODIMAGE)" "$(ENTERPRISEIMAGE)" $(TESTTIMEOUT) $(TESTLENGTHOPTIONS)
308308

309309
$(DURATIONTESTBIN): $(GOBUILDDIR) $(SOURCES)
310310
@mkdir -p $(BINDIR)

scripts/kube_run_tests.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@
44

55
DEPLOYMENTNAMESPACE=$1
66
TESTIMAGE=$2
7-
ENTERPRISEIMAGE=$3
8-
TESTTIMEOUT=$4
9-
TESTLENGTHOPTIONS=$5
7+
ARANGODIMAGE=$3
8+
ENTERPRISEIMAGE=$4
9+
TESTTIMEOUT=$5
10+
TESTLENGTHOPTIONS=$6
1011

1112
IMAGEID=$(docker inspect ${TESTIMAGE} '--format={{index .RepoDigests 0}}')
1213

1314
kubectl --namespace ${DEPLOYMENTNAMESPACE} \
1415
run arangodb-operator-test -i --rm --quiet --restart=Never \
1516
--image=${IMAGEID} \
1617
--env="ENTERPRISEIMAGE=${ENTERPRISEIMAGE}" \
18+
--env="ARANGODIMAGE=${ARANGODIMAGE}" \
1719
--env="TEST_NAMESPACE=${DEPLOYMENTNAMESPACE}" \
1820
--env="CLEANDEPLOYMENTS=${CLEANDEPLOYMENTS}" \
1921
-- \

tests/test_util.go

+14-2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import (
5252
"github.com/arangodb/kube-arangodb/pkg/util/arangod"
5353
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
5454
"github.com/arangodb/kube-arangodb/pkg/util/retry"
55+
"github.com/arangodb/kube-arangodb/pkg/util"
5556
)
5657

5758
const (
@@ -231,9 +232,9 @@ func getNamespace(t *testing.T) string {
231232
}
232233

233234
// newDeployment creates a basic ArangoDeployment with configured
234-
// type & name.
235+
// type, name and image.
235236
func newDeployment(name string) *api.ArangoDeployment {
236-
return &api.ArangoDeployment{
237+
depl := &api.ArangoDeployment{
237238
TypeMeta: metav1.TypeMeta{
238239
APIVersion: api.SchemeGroupVersion.String(),
239240
Kind: api.ArangoDeploymentResourceKind,
@@ -242,6 +243,17 @@ func newDeployment(name string) *api.ArangoDeployment {
242243
Name: strings.ToLower(name),
243244
},
244245
}
246+
247+
// set default image to the value given in env
248+
// some tests will override this value if they need a specific version
249+
// like update tests
250+
// if no value is given, use the operator default, which is arangodb/arangodb:latest
251+
image := strings.TrimSpace(os.Getenv("ARANGODIMAGE"))
252+
if image != "" {
253+
depl.Spec.Image = util.NewString(image)
254+
}
255+
256+
return depl
245257
}
246258

247259
// waitUntilDeployment waits until a deployment with given name in given namespace

0 commit comments

Comments
 (0)