mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
Added more test environment for license stuff.
This commit is contained in:
parent
82ad6b379f
commit
c00392bdc9
7 changed files with 38 additions and 5 deletions
|
@ -81,12 +81,16 @@ def buildTestSteps(Map myParams, String kubeConfigRoot, String kubeconfig) {
|
|||
return {
|
||||
timestamps {
|
||||
timeout(time: myParams.LONG ? 180 : 30) {
|
||||
withCredentials([string(credentialsId: 'ENTERPRISEIMAGE', variable: 'DEFAULTENTERPRISEIMAGE')]) {
|
||||
withCredentials([
|
||||
string(credentialsId: 'ENTERPRISEIMAGE', variable: 'DEFAULTENTERPRISEIMAGE'),
|
||||
string(credentialsId: 'ENTERPRISELICENSE', variable: 'DEFAULTENTERPRISELICENSE'),
|
||||
]) {
|
||||
withEnv([
|
||||
"CLEANDEPLOYMENTS=1",
|
||||
"DEPLOYMENTNAMESPACE=${myParams.TESTNAMESPACE}-${env.GIT_COMMIT}",
|
||||
"DOCKERNAMESPACE=${myParams.DOCKERNAMESPACE}",
|
||||
"ENTERPRISEIMAGE=${myParams.ENTERPRISEIMAGE}",
|
||||
"ENTERPRISELICENSE=${myParams.ENTERPRISELICENSE}",
|
||||
"ARANGODIMAGE=${myParams.ARANGODIMAGE}",
|
||||
"IMAGETAG=jenkins-test",
|
||||
"KUBECONFIG=${kubeConfigRoot}/${kubeconfig}",
|
||||
|
@ -132,6 +136,7 @@ pipeline {
|
|||
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: 'ARANGODIMAGE', defaultValue: '', description: 'ARANGODIMAGE sets the docker image used for tests (except enterprise and update tests)', )
|
||||
string(name: 'ENTERPRISELICENSE', defaultValue: '', description: 'ENTERPRISELICENSE sets the enterprise license key for enterprise tests', )
|
||||
string(name: 'TESTOPTIONS', defaultValue: '', description: 'TESTOPTIONS is used to pass additional test options to the integration test', )
|
||||
}
|
||||
stages {
|
||||
|
|
4
Makefile
4
Makefile
|
@ -73,6 +73,9 @@ endif
|
|||
ifndef ENTERPRISEIMAGE
|
||||
ENTERPRISEIMAGE := $(DEFAULTENTERPRISEIMAGE)
|
||||
endif
|
||||
ifndef ENTERPRISELICENSE
|
||||
ENTERPRISELICENSE := $(DEFAULTENTERPRISELICENSE)
|
||||
endif
|
||||
DASHBOARDBUILDIMAGE := kube-arangodb-dashboard-builder
|
||||
|
||||
ifndef ALLOWCHAOS
|
||||
|
@ -307,6 +310,7 @@ endif
|
|||
kubectl apply -f $(MANIFESTPATHDEPLOYMENTREPLICATION)
|
||||
kubectl apply -f $(MANIFESTPATHTEST)
|
||||
$(ROOTDIR)/scripts/kube_create_storage.sh $(DEPLOYMENTNAMESPACE)
|
||||
$(ROOTDIR)/scripts/kube_create_license_key_secret.sh
|
||||
$(ROOTDIR)/scripts/kube_run_tests.sh $(DEPLOYMENTNAMESPACE) $(TESTIMAGE) "$(ARANGODIMAGE)" "$(ENTERPRISEIMAGE)" $(TESTTIMEOUT) $(TESTLENGTHOPTIONS)
|
||||
|
||||
$(DURATIONTESTBIN): $(GOBUILDDIR) $(SOURCES)
|
||||
|
|
19
scripts/kube_create_license_key_secret.sh
Executable file
19
scripts/kube_create_license_key_secret.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -z $ENTERPRISELICENSE ]; then
|
||||
echo "Please specify ENTERPRISELICENSE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LICENSE=$(echo "${ENTERPRISELICENSE}" | base64 )
|
||||
|
||||
kubectl apply -f - <<EOF
|
||||
apiVersion: v1
|
||||
data:
|
||||
token: ${LICENSE}
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: arangodb-jenkins-license-key
|
||||
namespace: default
|
||||
type: Opaque
|
||||
EOF
|
|
@ -104,6 +104,7 @@ func TestAuthenticationSingleCustomSecret(t *testing.T) {
|
|||
if err := k8sutil.CreateTokenSecret(secrets, depl.Spec.Authentication.GetJWTSecretName(), "foo", nil); err != nil {
|
||||
t.Fatalf("Create JWT secret failed: %v", err)
|
||||
}
|
||||
defer removeSecret(kubecli, depl.Spec.Authentication.GetJWTSecretName(), ns)
|
||||
|
||||
// Create deployment
|
||||
apiObject, err := c.DatabaseV1alpha().ArangoDeployments(ns).Create(depl)
|
||||
|
@ -133,9 +134,6 @@ func TestAuthenticationSingleCustomSecret(t *testing.T) {
|
|||
if _, err := waitUntilSecret(kubecli, depl.Spec.Authentication.GetJWTSecretName(), ns, nil, time.Second); err != nil {
|
||||
t.Fatalf("JWT secret '%s' not found: %v", depl.Spec.Authentication.GetJWTSecretName(), err)
|
||||
}
|
||||
|
||||
// Cleanup secret
|
||||
removeSecret(kubecli, depl.Spec.Authentication.GetJWTSecretName(), ns)
|
||||
}
|
||||
|
||||
// TestAuthenticationNoneSingle creating a single server
|
||||
|
|
|
@ -60,7 +60,6 @@ func TestEnvironmentProduction(t *testing.T) {
|
|||
depl.Spec.StorageEngine = api.NewStorageEngine(engine)
|
||||
depl.Spec.TLS = api.TLSSpec{}
|
||||
depl.Spec.Environment = api.NewEnvironment(api.EnvironmentProduction)
|
||||
depl.Spec.Image = util.NewString("arangodb/arangodb:3.3.4")
|
||||
depl.Spec.DBServers.Count = util.NewInt(numNodes + 1)
|
||||
depl.Spec.SetDefaults(depl.GetName()) // this must be last
|
||||
assert.NoError(t, depl.Spec.Validate())
|
||||
|
|
1
tests/license_test.go
Normal file
1
tests/license_test.go
Normal file
|
@ -0,0 +1 @@
|
|||
package tests
|
|
@ -155,6 +155,12 @@ func getEnterpriseImageOrSkip(t *testing.T) string {
|
|||
return image
|
||||
}
|
||||
|
||||
const TestEnterpriseLicenseKeySecretName = "arangodb-jenkins-license-key"
|
||||
|
||||
func getEnterpriseLicenseKey() string {
|
||||
return strings.TrimSpace(os.Getenv("ENTERPRISELICENSE"))
|
||||
}
|
||||
|
||||
// shouldCleanDeployments returns true when deployments created
|
||||
// by tests should be removed, even when the test fails.
|
||||
func shouldCleanDeployments() bool {
|
||||
|
@ -244,6 +250,7 @@ func newDeployment(name string) *api.ArangoDeployment {
|
|||
},
|
||||
Spec: api.DeploymentSpec{
|
||||
ImagePullPolicy: util.NewPullPolicy(v1.PullAlways),
|
||||
LicenseKey: util.NewString(TestEnterpriseLicenseKeySecretName),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue