Skip to content

Test Image Option #270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Jenkinsfile.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def buildTestSteps(Map myParams, String kubeConfigRoot, String kubeconfig) {
"DEPLOYMENTNAMESPACE=${myParams.TESTNAMESPACE}-${env.GIT_COMMIT}",
"DOCKERNAMESPACE=${myParams.DOCKERNAMESPACE}",
"ENTERPRISEIMAGE=${myParams.ENTERPRISEIMAGE}",
"ARANGODIMAGE=${myParams.ARANGODIMAGE}",
"IMAGETAG=jenkins-test",
"KUBECONFIG=${kubeConfigRoot}/${kubeconfig}",
"LONG=${myParams.LONG ? 1 : 0}",
Expand Down Expand Up @@ -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: '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: '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', )
}
stages {
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ endif
kubectl apply -f $(MANIFESTPATHDEPLOYMENTREPLICATION)
kubectl apply -f $(MANIFESTPATHTEST)
$(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)
@mkdir -p $(BINDIR)
Expand Down
8 changes: 5 additions & 3 deletions scripts/kube_run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@

DEPLOYMENTNAMESPACE=$1
TESTIMAGE=$2
ENTERPRISEIMAGE=$3
TESTTIMEOUT=$4
TESTLENGTHOPTIONS=$5
ARANGODIMAGE=$3
ENTERPRISEIMAGE=$4
TESTTIMEOUT=$5
TESTLENGTHOPTIONS=$6

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

kubectl --namespace ${DEPLOYMENTNAMESPACE} \
run arangodb-operator-test -i --rm --quiet --restart=Never \
--image=${IMAGEID} \
--env="ENTERPRISEIMAGE=${ENTERPRISEIMAGE}" \
--env="ARANGODIMAGE=${ARANGODIMAGE}" \
--env="TEST_NAMESPACE=${DEPLOYMENTNAMESPACE}" \
--env="CLEANDEPLOYMENTS=${CLEANDEPLOYMENTS}" \
-- \
Expand Down
16 changes: 14 additions & 2 deletions tests/test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import (
"github.com/arangodb/kube-arangodb/pkg/util/arangod"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
"github.com/arangodb/kube-arangodb/pkg/util/retry"
"github.com/arangodb/kube-arangodb/pkg/util"
)

const (
Expand Down Expand Up @@ -231,9 +232,9 @@ func getNamespace(t *testing.T) string {
}

// newDeployment creates a basic ArangoDeployment with configured
// type & name.
// type, name and image.
func newDeployment(name string) *api.ArangoDeployment {
return &api.ArangoDeployment{
depl := &api.ArangoDeployment{
TypeMeta: metav1.TypeMeta{
APIVersion: api.SchemeGroupVersion.String(),
Kind: api.ArangoDeploymentResourceKind,
Expand All @@ -242,6 +243,17 @@ func newDeployment(name string) *api.ArangoDeployment {
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
Expand Down