Skip to content

Commit 3c3f5c9

Browse files
committed
test: run coreAPI3 pipeline over k8s
Signed-off-by: Ashim Shrestha <[email protected]>
1 parent 702e832 commit 3c3f5c9

File tree

2 files changed

+48
-42
lines changed

2 files changed

+48
-42
lines changed

.drone.star

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ config = {
329329
],
330330
"skip": False,
331331
"withRemotePhp": [False],
332+
"k8s": True,
332333
},
333334
"4": {
334335
"suites": [
@@ -1103,7 +1104,7 @@ def localApiTestPipeline(ctx):
11031104
params[item] = matrix[item] if item in matrix else defaults[item]
11041105
for storage in params["storages"]:
11051106
for run_with_remote_php in params["withRemotePhp"]:
1106-
run_on_k8s = params["k8s"] and ctx.build.event == "cron"
1107+
run_on_k8s = params["k8s"]
11071108
ocis_url = OCIS_URL
11081109
if run_on_k8s:
11091110
ocis_url = "https://%s" % OCIS_SERVER_NAME
@@ -1120,7 +1121,7 @@ def localApiTestPipeline(ctx):
11201121
([] if run_on_k8s else restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin")) +
11211122
(tikaService() if params["tikaNeeded"] and not run_on_k8s else tikaServiceK8s() if params["tikaNeeded"] and run_on_k8s else []) +
11221123
(waitForServices("online-offices", ["collabora:9980", "onlyoffice:443", "fakeoffice:8080"]) if params["collaborationServiceNeeded"] else []) +
1123-
(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]))) +
1124+
(waitK3sCluster() + (enableAntivirusServiceK8s() if params["antivirusNeeded"] and run_on_k8s else []) + (emailServiceK8s() if params["emailNeeded"] and run_on_k8s else []) + 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]))) +
11241125
(waitForClamavService() if params["antivirusNeeded"] and not run_on_k8s else exposeAntivirusServiceK8s() if params["antivirusNeeded"] and run_on_k8s else []) +
11251126
(waitForEmailService() if params["emailNeeded"] and not run_on_k8s else exposeEmailServiceK8s() if params["emailNeeded"] and run_on_k8s else []) +
11261127
(ocisServer(storage, deploy_type = "federation", extra_server_environment = params["extraServerEnvironment"]) if params["federationServer"] else []) +
@@ -1405,7 +1406,7 @@ def coreApiTestPipeline(ctx):
14051406
for run_with_remote_php in params["withRemotePhp"]:
14061407
filter_tags = "~@skipOnGraph&&~@skipOnOcis-%s-Storage" % ("OC" if storage == "owncloud" else "OCIS")
14071408
expected_failures_file = "%s/expected-failures-API-on-%s-storage.md" % (test_dir, storage.upper())
1408-
run_on_k8s = params["k8s"] and ctx.build.event == "cron"
1409+
run_on_k8s = params["k8s"]
14091410
ocis_url = OCIS_URL
14101411
if run_on_k8s:
14111412
ocis_url = "https://%s" % OCIS_SERVER_NAME
@@ -1422,7 +1423,7 @@ def coreApiTestPipeline(ctx):
14221423
(tikaService() if params["tikaNeeded"] else []) +
14231424
(waitForClamavService() if params["antivirusNeeded"] else []) +
14241425
(waitForEmailService() if params["emailNeeded"] else []) +
1425-
(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]))) +
1426+
(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]))) +
14261427
[
14271428
{
14281429
"name": "run-api-tests",
@@ -3824,7 +3825,7 @@ def waitK3sCluster():
38243825
],
38253826
}]
38263827

3827-
def prepareOcisDeployment(suite_name = ""):
3828+
def prepareOcisDeployment():
38283829
commands = [
38293830
"make -C %s build" % dirs["ocisWrapper"],
38303831
"mv %s/tests/config/drone/k8s/values.yaml %s/ocis-charts/charts/ocis/ci/deployment-values.yaml" % (dirs["base"], dirs["base"]),
@@ -3834,18 +3835,16 @@ def prepareOcisDeployment(suite_name = ""):
38343835
"sed -i '/- name: IDM_ADMIN_PASSWORD/{n;N;N;N;d;}' ./charts/ocis/templates/idm/deployment.yaml",
38353836
"sed -i '/- name: IDM_ADMIN_PASSWORD/a\\\\\\n value: \"admin\"' ./charts/ocis/templates/idm/deployment.yaml",
38363837
"sed -i '/- name: PROXY_HTTP_ADDR/i\\\\ - name: PROXY_ENABLE_BASIC_AUTH\\\n value: \"true\"' ./charts/ocis/templates/proxy/deployment.yaml",
3838+
"sed -i 's|/etc/ocis/sharing-banned-passwords.txt|config/drone/banned-password-list.txt|' ./charts/ocis/templates/sharing/deployment.yaml",
3839+
"sed -i 's|- name: configs|- name: banned-passwords|' ./charts/ocis/templates/sharing/deployment.yaml",
3840+
"sed -i 's|mountPath: /etc/ocis$|mountPath: /etc/ocis/config/drone|' ./charts/ocis/templates/sharing/deployment.yaml",
3841+
"sed -i 's|name: sharing-banned-passwords-{{ .appName }}|name: sharing-banned-passwords|' ./charts/ocis/templates/sharing/deployment.yaml",
3842+
"sed -i 's|/etc/ocis/sharing-banned-passwords.txt|config/drone/banned-password-list.txt|' ./charts/ocis/templates/frontend/deployment.yaml",
3843+
"sed -i 's|- name: configs|- name: banned-passwords|' ./charts/ocis/templates/frontend/deployment.yaml",
3844+
"sed -i 's|mountPath: /etc/ocis$|mountPath: /etc/ocis/config/drone|' ./charts/ocis/templates/frontend/deployment.yaml",
3845+
"sed -i 's|name: sharing-banned-passwords-{{ .appName }}|name: sharing-banned-passwords|' ./charts/ocis/templates/frontend/deployment.yaml",
38373846
]
38383847

3839-
# Only add banned password patches for sharingNgLinkShare suite
3840-
if suite_name == "sharingNgLinkShare":
3841-
commands.extend([
3842-
# Patch sharing deployment for banned password list
3843-
"sed -i 's|/etc/ocis/sharing-banned-passwords.txt|/etc/ocis/config/drone/banned-password-list.txt|' ./charts/ocis/templates/sharing/deployment.yaml",
3844-
"sed -i 's|- name: configs|- name: banned-passwords|' ./charts/ocis/templates/sharing/deployment.yaml",
3845-
"sed -i 's|mountPath: /etc/ocis$|mountPath: /etc/ocis/config/drone|' ./charts/ocis/templates/sharing/deployment.yaml",
3846-
"sed -i 's|name: sharing-banned-passwords-{{ .appName }}|name: sharing-banned-passwords|' ./charts/ocis/templates/sharing/deployment.yaml",
3847-
])
3848-
38493848
return [{
38503849
"name": "prepare-ocis-deployment",
38513850
"image": "owncloudci/golang:latest",
@@ -3858,19 +3857,14 @@ def prepareOcisDeployment(suite_name = ""):
38583857
],
38593858
}]
38603859

3861-
def setupOcisConfigMaps(suite_name = ""):
3860+
def setupOcisConfigMaps():
38623861
commands = [
38633862
"export KUBECONFIG=%s/kubeconfig-$${DRONE_BUILD_NUMBER}.yaml" % dirs["base"],
38643863
# Create namespace for oCIS deployment
38653864
"kubectl create namespace ocis || true",
3865+
"kubectl create configmap -n ocis sharing-banned-passwords --from-file=banned-password-list.txt=%s/tests/config/drone/banned-password-list.txt" % dirs["base"],
38663866
]
38673867

3868-
# Only create banned password ConfigMap for sharingNgLinkShare suite
3869-
if suite_name == "sharingNgLinkShare":
3870-
commands.append(
3871-
"kubectl create configmap -n ocis sharing-banned-passwords --from-file=banned-password-list.txt=%s/tests/config/drone/banned-password-list.txt" % dirs["base"],
3872-
)
3873-
38743868
return [{
38753869
"name": "setup-configmaps",
38763870
"image": K3D_IMAGE,

tests/acceptance/features/coreApiSharePublicLink2/enforcePasswordPublicLink.feature

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ Feature: enforce password on public link
3636
Scenario Outline: create a public link with viewer permission without a password when enforce-password is enabled
3737
Given the following configs have been set:
3838
| service | config | value |
39-
| sharing | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
40-
| sharing | OCIS_SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD | true |
39+
| sharing | SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
40+
| sharing | SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD | true |
41+
| frontend | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
42+
| frontend | OCIS_SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD | true |
4143
And user "Alice" has been created with default attributes
4244
And user "Alice" has uploaded file with content "test file" to "/testfile.txt"
4345
And using OCS API version "<ocs-api-version>"
@@ -57,6 +59,8 @@ Feature: enforce password on public link
5759
| service | config | value |
5860
| sharing | SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
5961
| sharing | SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD | true |
62+
| frontend | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
63+
| frontend | OCIS_SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD | true |
6064
And user "Alice" has been created with default attributes
6165
And user "Alice" has uploaded file with content "test file" to "/testfile.txt"
6266
And using OCS API version "<ocs-api-version>"
@@ -179,14 +183,19 @@ Feature: enforce password on public link
179183

180184
Scenario Outline: try to update a public link with a password that does not comply with the password policy
181185
Given the following configs have been set:
182-
| service | config | value |
183-
| sharing | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
184-
| sharing | OCIS_SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD | true |
185-
| sharing | OCIS_PASSWORD_POLICY_MIN_CHARACTERS | 13 |
186-
| sharing | OCIS_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS | 3 |
187-
| sharing | OCIS_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS | 2 |
188-
| sharing | OCIS_PASSWORD_POLICY_MIN_DIGITS | 1 |
189-
| sharing | OCIS_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS | 2 |
186+
| service | config | value |
187+
| sharing | SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
188+
| sharing | SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD | true |
189+
| sharing | SHARING_PASSWORD_POLICY_MIN_CHARACTERS | 13 |
190+
| sharing | SHARING_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS | 3 |
191+
| sharing | SHARING_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS | 2 |
192+
| sharing | SHARING_PASSWORD_POLICY_MIN_DIGITS | 1 |
193+
| sharing | SHARING_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS | 2 |
194+
| frontend | FRONTEND_PASSWORD_POLICY_MIN_CHARACTERS | 13 |
195+
| frontend | FRONTEND_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS | 3 |
196+
| frontend | FRONTEND_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS | 2 |
197+
| frontend | FRONTEND_PASSWORD_POLICY_MIN_DIGITS | 1 |
198+
| frontend | FRONTEND_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS | 2 |
190199
And user "Alice" has been created with default attributes
191200
And user "Alice" has uploaded file with content "test file" to "/testfile.txt"
192201
And using OCS API version "<ocs-api-version>"
@@ -215,7 +224,10 @@ Feature: enforce password on public link
215224

216225

217226
Scenario Outline: create a public link with a password in accordance with the password policy (valid cases)
218-
Given the config "<config>" has been set to "<config-value>" for "<service>" service
227+
Given the following configs have been set:
228+
| service | config | value |
229+
| sharing | <sharing-config> | <config-value> |
230+
| frontend | <frontend-config> | <config-value> |
219231
And using OCS API version "2"
220232
And user "Alice" has been created with default attributes
221233
And user "Alice" has uploaded file with content "test file" to "/testfile.txt"
@@ -230,15 +242,15 @@ Feature: enforce password on public link
230242
And the public should not be able to download file "/testfile.txt" from inside the last public link shared folder using the public WebDAV API with password "wrong pass"
231243
But the public should be able to download file "/testfile.txt" from inside the last public link shared folder using the public WebDAV API with password "<password>"
232244
Examples:
233-
| service | config | config-value | password |
234-
| sharing | OCIS_PASSWORD_POLICY_MIN_CHARACTERS | 4 | Ps-1 |
235-
| sharing | SHARING_PASSWORD_POLICY_MIN_CHARACTERS | 14 | Ps1:with space |
236-
| sharing | SHARING_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS | 4 | PS1:test |
237-
| sharing | SHARING_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS | 3 | PS1:TeƒsT |
238-
| sharing | SHARING_PASSWORD_POLICY_MIN_DIGITS | 2 | PS1:test2 |
239-
| sharing | SHARING_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS | 2 | PS1:test pass |
240-
| sharing | SHARING_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS | 33 | pS1! #$%&'()*+,-./:;<=>?@[\]^_`{ }~ |
241-
| sharing | SHARING_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS | 5 | 1sameCharacterShouldWork!!!!! |
245+
| sharing-config | frontend-config | config-value | password |
246+
| SHARING_PASSWORD_POLICY_MIN_CHARACTERS | FRONTEND_PASSWORD_POLICY_MIN_CHARACTERS | 4 | Ps-1 |
247+
| SHARING_PASSWORD_POLICY_MIN_CHARACTERS | FRONTEND_PASSWORD_POLICY_MIN_CHARACTERS | 14 | Ps1:with space |
248+
| SHARING_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS | FRONTEND_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS | 4 | PS1:test |
249+
| SHARING_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS | FRONTEND_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS | 3 | PS1:TeƒsT |
250+
| SHARING_PASSWORD_POLICY_MIN_DIGITS | FRONTEND_PASSWORD_POLICY_MIN_DIGITS | 2 | PS1:test2 |
251+
| SHARING_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS | FRONTEND_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS | 2 | PS1:test pass |
252+
| SHARING_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS | FRONTEND_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS | 33 | pS1! #$%&'()*+,-./:;<=>?@[\]^_`{ }~ |
253+
| SHARING_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS | FRONTEND_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS | 5 | 1sameCharacterShouldWork!!!!! |
242254

243255

244256
Scenario Outline: try to create a public link with a password that does not comply with the password policy (invalid cases)

0 commit comments

Comments
 (0)