mirror of
https://github.com/owncloud/ocis
synced 2026-04-25 17:25:21 +02:00
test: refactor feature files to make services use their own configs
This commit is contained in:
65
.drone.star
65
.drone.star
@@ -1094,7 +1094,7 @@ def localApiTestPipeline(ctx):
|
||||
params[item] = matrix[item] if item in matrix else defaults[item]
|
||||
for storage in params["storages"]:
|
||||
for run_with_remote_php in params["withRemotePhp"]:
|
||||
run_on_k8s = params["k8s"]
|
||||
run_on_k8s = params["k8s"] and ctx.build.event == "cron"
|
||||
ocis_url = OCIS_URL
|
||||
if run_on_k8s:
|
||||
ocis_url = "https://%s" % OCIS_SERVER_NAME
|
||||
@@ -1111,7 +1111,7 @@ def localApiTestPipeline(ctx):
|
||||
([] if run_on_k8s else restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin")) +
|
||||
(tikaService() if params["tikaNeeded"] and not run_on_k8s else tikaServiceK8s() if params["tikaNeeded"] and run_on_k8s else []) +
|
||||
(waitForServices("online-offices", ["collabora:9980", "onlyoffice:443", "fakeoffice:8080"]) if params["collaborationServiceNeeded"] else []) +
|
||||
(waitK3sCluster() + (enableAntivirusServiceK8s() if params["antivirusNeeded"] and run_on_k8s else []) + (emailServiceK8s() if params["emailNeeded"] and run_on_k8s else []) + deployOcis() + waitForOcis(ocis_url = ocis_url) + ociswrapper() + waitForOciswrapper() if run_on_k8s else ocisServer(storage, extra_server_environment = params["extraServerEnvironment"], with_wrapper = True, tika_enabled = params["tikaNeeded"], volumes = ([stepVolumeOcisStorage]))) +
|
||||
(waitK3sCluster() + (enableAntivirusServiceK8s() if params["antivirusNeeded"] and run_on_k8s else []) + (emailServiceK8s() if params["emailNeeded"] and run_on_k8s else []) + prepareOcisDeployment(name) + setupOcisConfigMaps(name) + deployOcis() + waitForOcis(ocis_url = ocis_url) + ociswrapper() + waitForOciswrapper() if run_on_k8s else ocisServer(storage, extra_server_environment = params["extraServerEnvironment"], with_wrapper = True, tika_enabled = params["tikaNeeded"], volumes = ([stepVolumeOcisStorage]))) +
|
||||
(waitForClamavService() if params["antivirusNeeded"] and not run_on_k8s else exposeAntivirusServiceK8s() if params["antivirusNeeded"] and run_on_k8s else []) +
|
||||
(waitForEmailService() if params["emailNeeded"] and not run_on_k8s else exposeEmailServiceK8s() if params["emailNeeded"] and run_on_k8s else []) +
|
||||
(ocisServer(storage, deploy_type = "federation", extra_server_environment = params["extraServerEnvironment"]) if params["federationServer"] else []) +
|
||||
@@ -1396,7 +1396,7 @@ def coreApiTestPipeline(ctx):
|
||||
for run_with_remote_php in params["withRemotePhp"]:
|
||||
filter_tags = "~@skipOnGraph&&~@skipOnOcis-%s-Storage" % ("OC" if storage == "owncloud" else "OCIS")
|
||||
expected_failures_file = "%s/expected-failures-API-on-%s-storage.md" % (test_dir, storage.upper())
|
||||
run_on_k8s = params["k8s"]
|
||||
run_on_k8s = params["k8s"] and ctx.build.event == "cron"
|
||||
ocis_url = OCIS_URL
|
||||
if run_on_k8s:
|
||||
ocis_url = "https://%s" % OCIS_SERVER_NAME
|
||||
@@ -1413,7 +1413,7 @@ def coreApiTestPipeline(ctx):
|
||||
(tikaService() if params["tikaNeeded"] else []) +
|
||||
(waitForClamavService() if params["antivirusNeeded"] else []) +
|
||||
(waitForEmailService() if params["emailNeeded"] else []) +
|
||||
(waitK3sCluster() + prepareOcisDeployment() + setupOcisConfigMaps() + deployOcis() + waitForOcis(ocis_url = ocis_url) + ociswrapper() + waitForOciswrapper() if run_on_k8s else ocisServer(storage, extra_server_environment = params["extraServerEnvironment"], with_wrapper = True, tika_enabled = params["tikaNeeded"], volumes = ([stepVolumeOcisStorage]))) +
|
||||
(waitK3sCluster() + prepareOcisDeployment(name) + setupOcisConfigMaps(name) + deployOcis() + waitForOcis(ocis_url = ocis_url) + ociswrapper() + waitForOciswrapper() if run_on_k8s else ocisServer(storage, extra_server_environment = params["extraServerEnvironment"], with_wrapper = True, tika_enabled = params["tikaNeeded"], volumes = ([stepVolumeOcisStorage]))) +
|
||||
[
|
||||
{
|
||||
"name": "run-api-tests",
|
||||
@@ -3815,25 +3815,32 @@ def waitK3sCluster():
|
||||
],
|
||||
}]
|
||||
|
||||
def prepareOcisDeployment():
|
||||
return [{
|
||||
"name": "prepare-ocis-deployment",
|
||||
"image": "owncloudci/golang:latest",
|
||||
"commands": [
|
||||
"make -C %s build" % dirs["ocisWrapper"],
|
||||
"mv %s/tests/config/drone/k8s/values.yaml %s/ocis-charts/charts/ocis/ci/deployment-values.yaml" % (dirs["base"], dirs["base"]),
|
||||
"cp -r %s/tests/config/drone/k8s/authbasic %s/ocis-charts/charts/ocis/templates/" % (dirs["base"], dirs["base"]),
|
||||
"cd %s/ocis-charts" % dirs["base"],
|
||||
"sed -i '/{{- define \"ocis.basicServiceTemplates\" -}}/a\\\\ {{- $_ := set .scope \"appNameAuthBasic\" \"authbasic\" -}}' ./charts/ocis/templates/_common/_tplvalues.tpl",
|
||||
"sed -i '/- name: IDM_ADMIN_PASSWORD/{n;N;N;N;d;}' ./charts/ocis/templates/idm/deployment.yaml",
|
||||
"sed -i '/- name: IDM_ADMIN_PASSWORD/a\\\\\\n value: \"admin\"' ./charts/ocis/templates/idm/deployment.yaml",
|
||||
"sed -i '/- name: PROXY_HTTP_ADDR/i\\\\ - name: PROXY_ENABLE_BASIC_AUTH\\\n value: \"true\"' ./charts/ocis/templates/proxy/deployment.yaml",
|
||||
# Patch sharing deployment for banned password list (for @env-config tests)
|
||||
def prepareOcisDeployment(suite_name = ""):
|
||||
commands = [
|
||||
"make -C %s build" % dirs["ocisWrapper"],
|
||||
"mv %s/tests/config/drone/k8s/values.yaml %s/ocis-charts/charts/ocis/ci/deployment-values.yaml" % (dirs["base"], dirs["base"]),
|
||||
"cp -r %s/tests/config/drone/k8s/authbasic %s/ocis-charts/charts/ocis/templates/" % (dirs["base"], dirs["base"]),
|
||||
"cd %s/ocis-charts" % dirs["base"],
|
||||
"sed -i '/{{- define \"ocis.basicServiceTemplates\" -}}/a\\\\ {{- $_ := set .scope \"appNameAuthBasic\" \"authbasic\" -}}' ./charts/ocis/templates/_common/_tplvalues.tpl",
|
||||
"sed -i '/- name: IDM_ADMIN_PASSWORD/{n;N;N;N;d;}' ./charts/ocis/templates/idm/deployment.yaml",
|
||||
"sed -i '/- name: IDM_ADMIN_PASSWORD/a\\\\\\n value: \"admin\"' ./charts/ocis/templates/idm/deployment.yaml",
|
||||
"sed -i '/- name: PROXY_HTTP_ADDR/i\\\\ - name: PROXY_ENABLE_BASIC_AUTH\\\n value: \"true\"' ./charts/ocis/templates/proxy/deployment.yaml",
|
||||
]
|
||||
|
||||
# Only add banned password patches for sharingNgLinkShare suite
|
||||
if suite_name == "sharingNgLinkShare":
|
||||
commands.extend([
|
||||
# Patch sharing deployment for banned password list
|
||||
"sed -i 's|/etc/ocis/sharing-banned-passwords.txt|/etc/ocis/config/drone/banned-password-list.txt|' ./charts/ocis/templates/sharing/deployment.yaml",
|
||||
"sed -i 's|- name: configs|- name: banned-passwords|' ./charts/ocis/templates/sharing/deployment.yaml",
|
||||
"sed -i 's|mountPath: /etc/ocis$|mountPath: /etc/ocis/config/drone|' ./charts/ocis/templates/sharing/deployment.yaml",
|
||||
"sed -i 's|name: sharing-banned-passwords-{{ .appName }}|name: sharing-banned-passwords|' ./charts/ocis/templates/sharing/deployment.yaml",
|
||||
],
|
||||
])
|
||||
|
||||
return [{
|
||||
"name": "prepare-ocis-deployment",
|
||||
"image": "owncloudci/golang:latest",
|
||||
"commands": commands,
|
||||
"volumes": [
|
||||
{
|
||||
"name": "gopath",
|
||||
@@ -3842,16 +3849,24 @@ def prepareOcisDeployment():
|
||||
],
|
||||
}]
|
||||
|
||||
def setupOcisConfigMaps():
|
||||
def setupOcisConfigMaps(suite_name = ""):
|
||||
commands = [
|
||||
"export KUBECONFIG=%s/kubeconfig-$${DRONE_BUILD_NUMBER}.yaml" % dirs["base"],
|
||||
# Create namespace for oCIS deployment
|
||||
"kubectl create namespace ocis || true",
|
||||
]
|
||||
|
||||
# Only create banned password ConfigMap for sharingNgLinkShare suite
|
||||
if suite_name == "sharingNgLinkShare":
|
||||
commands.append(
|
||||
"kubectl create configmap -n ocis sharing-banned-passwords --from-file=banned-password-list.txt=%s/tests/config/drone/banned-password-list.txt" % dirs["base"],
|
||||
)
|
||||
|
||||
return [{
|
||||
"name": "setup-configmaps",
|
||||
"image": K3D_IMAGE,
|
||||
"user": "root",
|
||||
"commands": [
|
||||
"export KUBECONFIG=kubeconfig-$${DRONE_BUILD_NUMBER}.yaml",
|
||||
"kubectl create namespace ocis || true",
|
||||
"kubectl create configmap -n ocis sharing-banned-passwords --from-file=banned-password-list.txt=%s/tests/config/drone/banned-password-list.txt" % dirs["base"],
|
||||
],
|
||||
"commands": commands,
|
||||
}]
|
||||
|
||||
def deployOcis():
|
||||
|
||||
Reference in New Issue
Block a user