Skip to content
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

[tests-only][full-ci]Run ocm tests on ci #11819

Merged
merged 4 commits into from
Oct 28, 2024
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
76 changes: 47 additions & 29 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ dir = {
"ocisConfig": "/var/www/owncloud/web/tests/drone/config-ocis.json",
"ocisIdentifierRegistrationConfig": "/var/www/owncloud/web/tests/drone/identifier-registration.yml",
"ocisRevaDataRoot": "/srv/app/tmp/ocis/owncloud/data/",
"federatedOcisConfig": "/var/www/owncloud/web/tests/drone/config-ocis-federated.json",
"ocmProviders": "/var/www/owncloud/web/tests/drone/providers.json",
}

config = {
Expand Down Expand Up @@ -127,6 +129,23 @@ config = {
"IDP_ACCESS_TOKEN_EXPIRATION": 30,
},
},
"ocm": {
"earlyFail": True,
"skip": False,
ScharfViktor marked this conversation as resolved.
Show resolved Hide resolved
"federationServer": True,
"suites": [
"ocm",
],
"extraServerEnvironment": {
"OCIS_ADD_RUN_SERVICES": "ocm",
"OCIS_ENABLE_OCM": True,
"GRAPH_INCLUDE_OCM_SHAREES": True,
"OCM_OCM_INVITE_MANAGER_INSECURE": True,
"OCM_OCM_SHARE_PROVIDER_INSECURE": True,
"OCM_OCM_STORAGE_PROVIDER_INSECURE": True,
"OCM_OCM_PROVIDER_AUTHORIZER_PROVIDERS_FILE": "%s" % dir["ocmProviders"],
},
},
},
"build": True,
}
Expand Down Expand Up @@ -543,6 +562,7 @@ def e2eTests(ctx):
"suites": [],
"features": [],
"tikaNeeded": False,
"federationServer": False,
"failOnUncaughtConsoleError": "false",
"extraServerEnvironment": {},
}
Expand All @@ -567,6 +587,9 @@ def e2eTests(ctx):
if "app-provider" in suite and not "full-ci" in ctx.build.title.lower() and ctx.build.event != "cron":
continue

if "ocm" in suite and not "full-ci" in ctx.build.title.lower() and ctx.build.event != "cron":
continue

Comment on lines +590 to +592
Copy link
Member

@saw-jan saw-jan Oct 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ocm pipeline is still running and it fails

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ocm has been triggering because PR has full-ci in title

if params["skip"]:
continue

Expand Down Expand Up @@ -598,14 +621,17 @@ def e2eTests(ctx):
steps += collaboraService() + \
onlyofficeService() + \
waitForServices("online-offices", ["collabora:9980", "onlyoffice:443"]) + \
ocisService(extra_env_config = params["extraServerEnvironment"]) + \
ocisService(params["extraServerEnvironment"]) + \
wopiCollaborationService("collabora") + \
wopiCollaborationService("onlyoffice") + \
waitForServices("wopi", ["wopi-collabora:9300", "wopi-onlyoffice:9300"])
elif "ocm" in suite:
steps += ocisService(params["extraServerEnvironment"]) + \
(ocisService(params["extraServerEnvironment"], "federation") if params["federationServer"] else [])
else:
# oCIS specific steps
steps += (tikaService() if params["tikaNeeded"] else []) + \
ocisService(extra_env_config = params["extraServerEnvironment"])
ocisService(params["extraServerEnvironment"])

command = "bash run-e2e.sh "
if "suites" in matrix:
Expand Down Expand Up @@ -911,12 +937,12 @@ def documentation(ctx):
},
]

def ocisService(extra_env_config = {}, enforce_password_public_link = False):
def ocisService(extra_env_config = {}, deploy_type = "ocis"):
environment = {
"IDM_ADMIN_PASSWORD": "admin", # override the random admin password from `ocis init`
"OCIS_INSECURE": "true",
"OCIS_LOG_LEVEL": "error",
"OCIS_URL": "https://ocis:9200",
"OCIS_JWT_SECRET": "some-ocis-jwt-secret",
"LDAP_GROUP_SUBSTRING_FILTER_TYPE": "any",
"LDAP_USER_SUBSTRING_FILTER_TYPE": "any",
"PROXY_ENABLE_BASIC_AUTH": True,
Expand All @@ -925,27 +951,30 @@ def ocisService(extra_env_config = {}, enforce_password_public_link = False):
"FRONTEND_OCS_ENABLE_DENIALS": True,
"OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST": "%s/tests/drone/banned-passwords.txt" % dir["web"],
"PROXY_CSP_CONFIG_FILE_LOCATION": "%s/tests/drone/csp.yaml" % dir["web"],
"WEB_UI_CONFIG_FILE": "%s" % dir["ocisConfig"],
# Needed for enabling all roles
"GRAPH_AVAILABLE_ROLES": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5,a8d5fe5e-96e3-418d-825b-534dbdf22b99,fb6c3e19-e378-47e5-b277-9732f9de6e21,58c63c02-1d89-4572-916a-870abc5a1b7d,2d00ce52-1fc2-4dbc-8b95-a73b73395f5a,1c996275-f1c9-4e71-abdf-a42f6495e960,312c0871-5ef7-4b3a-85b6-0e4074c64049,aa97fe03-7980-45ac-9e50-b325749fd7e6",
}

if deploy_type == "federation":
environment["OCIS_URL"] = "https://federation-ocis:10200"
environment["PROXY_HTTP_ADDR"] = "federation-ocis:10200"
environment["WEB_UI_CONFIG_FILE"] = dir["federatedOcisConfig"]
container_name = "federation-ocis"
ocis_domain = "federation-ocis:10200"
else:
container_name = "ocis"
ocis_domain = "ocis:9200"
environment["OCIS_URL"] = "https://ocis:9200"
environment["WEB_UI_CONFIG_FILE"] = dir["ocisConfig"]

for config in extra_env_config:
environment[config] = extra_env_config[config]

if enforce_password_public_link:
environment["OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD"] = False
environment["FRONTEND_PASSWORD_POLICY_MIN_CHARACTERS"] = 0
environment["FRONTEND_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS"] = 0
environment["FRONTEND_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS"] = 0
environment["FRONTEND_PASSWORD_POLICY_MIN_DIGITS"] = 0
environment["FRONTEND_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS"] = 0

wait_for_service = waitForServices("ocis", ["ocis:9200"])
if "OCIS_EXCLUDE_RUN_SERVICES" not in environment or "idp" not in environment["OCIS_EXCLUDE_RUN_SERVICES"]:
wait_for_service = [
{
"name": "wait-for-ocis",
"name": "wait-for-%s" % container_name,
"image": OC_CI_ALPINE,
"commands": [
"timeout 300 bash -c 'while [ $(curl -sk -uadmin:admin " +
Expand All @@ -957,7 +986,7 @@ def ocisService(extra_env_config = {}, enforce_password_public_link = False):

return [
{
"name": "ocis",
"name": container_name,
"image": OC_CI_GOLANG,
"detach": True,
"environment": environment,
Expand All @@ -971,9 +1000,6 @@ def ocisService(extra_env_config = {}, enforce_password_public_link = False):
"volumes": [{
"name": "gopath",
"path": dir["app"],
}, {
"name": "ocis-config",
"path": "/root/.ocis/config",
}],
},
] + wait_for_service
Expand Down Expand Up @@ -1629,6 +1655,8 @@ def wopiCollaborationService(name):
"COLLABORATION_HTTP_ADDR": "0.0.0.0:9300",
"COLLABORATION_APP_INSECURE": True,
"COLLABORATION_CS3API_DATAGATEWAY_INSECURE": True,
"OCIS_JWT_SECRET": "some-ocis-jwt-secret",
"COLLABORATION_WOPI_SECRET": "some-wopi-secret",
}

if name == "collabora":
Expand All @@ -1651,16 +1679,6 @@ def wopiCollaborationService(name):
"commands": [
"./ocis collaboration server",
],
"volumes": [
{
"name": "gopath",
"path": dir["app"],
},
{
"name": "ocis-config",
"path": "/root/.ocis/config",
},
],
},
]

Expand Down Expand Up @@ -1836,7 +1854,7 @@ def e2eTestsOnKeycloak(ctx):
"KEYCLOAK_DOMAIN": "keycloak:8443",
}

steps += ocisService(extra_env_config = environment) + \
steps += ocisService(environment) + \
[
{
"name": "e2e-tests",
Expand Down
11 changes: 11 additions & 0 deletions tests/drone/config-ocis-federated.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"server": "https://federation-ocis:10200",
"theme": "https://federation-ocis:10200/themes/owncloud/theme.json",
"openIdConnect": {
"metadata_url": "https://federation-ocis:10200/.well-known/openid-configuration",
"authority": "https://federation-ocis:10200",
"client_id": "web",
"response_type": "code"
},
"apps": ["files", "text-editor", "preview", "pdf-viewer", "search", "admin-settings", "ocm"]
}
2 changes: 1 addition & 1 deletion tests/drone/config-ocis.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"client_id": "web",
"response_type": "code"
},
"apps": ["files", "text-editor", "preview", "pdf-viewer", "search", "admin-settings"]
"apps": ["files", "text-editor", "preview", "pdf-viewer", "search", "admin-settings", "ocm"]
}
46 changes: 46 additions & 0 deletions tests/drone/providers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[
{
"name": "ocis",
"full_name": "first-ocis-instance",
"organization": "Owncloud",
"domain": "ocis:9200",
"homepage": "https://owncloud.com",
"services": [
{
"endpoint": {
"type": {
"name": "OCM",
"description": "CERNBox Open Cloud Mesh API"
},
"name": "CERNBox - OCM API",
"path": "https://ocis:9200/ocm/",
"is_monitored": true
},
"api_version": "0.0.1",
"host": "ocis:9200"
}
]
},
{
"name": "federation-ocis",
"full_name": "Federation ocis",
"organization": "Owncloud",
"domain": "federation-ocis:10200",
"homepage": "https://owncloud.com",
"services": [
{
"endpoint": {
"type": {
"name": "OCM",
"description": "CERNBox Open Cloud Mesh API"
},
"name": "CERNBox - OCM API",
"path": "https://federation-ocis:10200/ocm/",
"is_monitored": true
},
"api_version": "0.0.1",
"host": "federation-ocis:10200"
}
]
}
]
7 changes: 4 additions & 3 deletions tests/e2e/support/objects/federation/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ const generateInvitationButton =
'//button[contains(@aria-label,"Generate invitation link that can be shared with one or more invitees")]'
const generateInvitationActionConfirmButton = '.oc-modal-body-actions-confirm'
const invitationToken = 'span:has-text("%s")'
const InvitationInput = '//input[starts-with(@id, "oc-textinput-")]'
const invitationInput = '//input[starts-with(@id, "oc-textinput-")]'
const invitationConnectionRow =
'//div[@id="sciencemesh-connections"]//td[text()="%s"]/parent::tr/td[text()="%s"]'
const institutionOptionDropdown = '.vs__open-indicator'
const inviterInstitutionOption = 'ul.vs__dropdown-menu > li'
const acceptInvitationButton = 'button:has(span:has-text("Accept invitation"))'

export const generateInvitation = async (args: { page: Page; user: string }): Promise<void> => {
Expand Down Expand Up @@ -38,9 +39,9 @@ export const generateInvitation = async (args: { page: Page; user: string }): Pr
export const acceptInvitation = async (args: { page: Page; sharer: string }): Promise<void> => {
const { page, sharer } = args
const invitation = federatedInvitationCode.get(sharer.toLowerCase())
await page.locator(InvitationInput).fill(invitation.code)
await page.locator(invitationInput).fill(invitation.code)
await page.locator(institutionOptionDropdown).click()
await page.getByRole('option', { name: 'first-ocis-instance ocis-server:' }).click()
await page.locator(inviterInstitutionOption).click()
await Promise.all([
page.waitForResponse(
(resp) =>
Expand Down