Skip to content

Commit

Permalink
Merge pull request #2897 from owncloud/parallel-deploy-tests
Browse files Browse the repository at this point in the history
[tests-only][full-ci] Added parallel deployment testing setup
  • Loading branch information
wkloucek authored Dec 21, 2021
2 parents 0288ac8 + 84db46e commit f448f40
Show file tree
Hide file tree
Showing 15 changed files with 1,050 additions and 3 deletions.
477 changes: 476 additions & 1 deletion .drone.star

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ help:
@echo
@echo -e "${GREEN}Testing with test suite natively installed:${RESET}\n"
@echo -e "${PURPLE}\tdocs: https://owncloud.dev/ocis/development/testing/#testing-with-test-suite-natively-installed${RESET}\n"
@echo -e "\tmake test-acceptance-api\t${BLUE}run API acceptance tests${RESET}"
@echo -e "\tmake clean-tests\t\t${BLUE}delete API tests framework dependencies${RESET}"
@echo -e "\tmake test-acceptance-api\t\t${BLUE}run API acceptance tests${RESET}"
@echo -e "\tmake test-paralleldeployment-api\t${BLUE}run API acceptance tests for parallel deployment${RESET}"
@echo -e "\tmake clean-tests\t\t\t${BLUE}delete API tests framework dependencies${RESET}"
@echo
@echo -e "${BLACK}---------------------------------------------------------${RESET}"
@echo
Expand Down Expand Up @@ -83,11 +84,17 @@ clean-tests:
@rm -Rf vendor-bin/**/vendor vendor-bin/**/composer.lock tests/acceptance/output

BEHAT_BIN=vendor-bin/behat/vendor/bin/behat
# behat config file for parallel deployment tests
PARALLEL_BEHAT_YML=tests/parallelDeployAcceptance/config/behat.yml

.PHONY: test-acceptance-api
test-acceptance-api: vendor-bin/behat/vendor
BEHAT_BIN=$(BEHAT_BIN) $(PATH_TO_CORE)/tests/acceptance/run.sh --remote --type api

.PHONY: test-paralleldeployment-api
test-paralleldeployment-api: vendor-bin/behat/vendor
BEHAT_BIN=$(BEHAT_BIN) BEHAT_YML=$(PARALLEL_BEHAT_YML) $(PATH_TO_CORE)/tests/acceptance/run.sh --type api

vendor/bamarni/composer-bin-plugin: composer.lock
composer install

Expand Down
2 changes: 2 additions & 0 deletions tests/parallelDeployAcceptance/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
!config
output
40 changes: 40 additions & 0 deletions tests/parallelDeployAcceptance/config/behat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
default:
autoload:
"": "%paths.base%/../features/bootstrap"

suites:
apiShareManagement:
paths:
- "%paths.base%/../features/apiShareManagement"
context: &common_ldap_suite_context
parameters:
ldapAdminPassword: admin
ldapUsersOU: TestUsers
ldapGroupsOU: TestGroups
ldapInitialUserFilePath: /ldap_users_groups.ldif
contexts:
- ParallelContext:
- FeatureContext: &common_feature_context_params
baseUrl: https://ocis:9200
adminUsername: admin
adminPassword: admin
regularUserPassword: 1234
ocPath: apps/testing/api/v1/occ
- OccContext:

apiWebdavOperations:
paths:
- "%paths.base%/../features/apiWebdavOperations"
context: *common_ldap_suite_context
contexts:
- ParallelContext:
- FeatureContext: *common_feature_context_params

extensions:
jarnaiz\JUnitFormatter\JUnitFormatterExtension:
filename: report.xml
outputDir: "%paths.base%/../output/"

rdx\behatvars\BehatVariablesExtension: ~

Cjm\Behat\StepThroughExtension: ~
7 changes: 7 additions & 0 deletions tests/parallelDeployAcceptance/config/ldap_users_groups.ldif
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dn: ou=TestUsers,dc=owncloud,dc=com
objectClass: organizationalUnit
ou: TestUsers

dn: ou=TestGroups,dc=owncloud,dc=com
objectClass: organizationalUnit
ou: TestGroups
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This LDIF files describes the ownCloud schema and can be used to
# add two optional attributes: ownCloudQuota and ownCloudUUID
# The ownCloudUUID is used to store a unique, non-reassignable, persistent identifier for users and groups
dn: cn=owncloud,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: owncloud
olcAttributeTypes: ( 1.3.6.1.4.1.39430.1.1.1 NAME 'ownCloudQuota' DESC 'User Quota (e.g. 2 GB)' EQUALITY caseExactMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.39430.1.1.2 NAME 'ownCloudUUID' DESC 'A non-reassignable and persistent account ID)' EQUALITY uuidMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.1.16.1 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.39430.1.1.3 NAME 'ownCloudSelector' DESC 'A selector attribute for a route in the ownCloud Infinte Scale proxy)' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
olcObjectClasses: ( 1.3.6.1.4.1.39430.1.2.1 NAME 'ownCloud' DESC 'ownCloud LDAP Schema' AUXILIARY MAY ( ownCloudQuota $ ownCloudUUID $ ownCloudSelector ) )
33 changes: 33 additions & 0 deletions tests/parallelDeployAcceptance/drone/oc10/10-custom-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
echo "Writing custom config files..."

# openidconnect
gomplate \
-f /etc/templates/oidc.config.php \
-o ${OWNCLOUD_VOLUME_CONFIG}/oidc.config.php

# we need at least version 2.1.0 of the oenidconnect app
occ market:upgrade --major openidconnect
occ app:enable openidconnect

# user LDAP
gomplate \
-f /etc/templates/ldap-config.tmpl.json \
-o ${OWNCLOUD_VOLUME_CONFIG}/ldap-config.json

CONFIG=$(cat ${OWNCLOUD_VOLUME_CONFIG}/ldap-config.json)
occ config:import <<< $CONFIG

occ ldap:test-config "s01"
occ app:enable user_ldap
/bin/bash -c 'occ user:sync "OCA\User_LDAP\User_Proxy" -r -m remove'

occ market:upgrade --major web
occ app:enable web

# enable testing app
echo "Cloning and enabling testing app..."
git clone --depth 1 https://github.com/owncloud/testing.git /var/www/owncloud/apps/testing
occ app:enable testing

true
53 changes: 53 additions & 0 deletions tests/parallelDeployAcceptance/drone/oc10/ldap-config.tmpl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"apps": {
"user_ldap": {
"s01has_memberof_filter_support": "0",
"s01home_folder_naming_rule": "",
"s01last_jpegPhoto_lookup": "0",
"s01ldap_agent_password": "{{ .Env.STORAGE_LDAP_BIND_PASSWORD | base64.Encode }}",
"s01ldap_attributes_for_group_search": "",
"s01ldap_attributes_for_user_search": "{{ .Env.LDAP_USERATTRIBUTEFILTERS }}",
"s01ldap_backup_host": "",
"s01ldap_backup_port": "",
"s01ldap_base_groups": "{{ .Env.LDAP_BASE_DN }}",
"s01ldap_base_users": "{{ .Env.LDAP_BASE_DN }}",
"s01ldap_base": "{{ .Env.LDAP_BASE_DN }}",
"s01ldap_cache_ttl": "60",
"s01ldap_configuration_active": "1",
"s01ldap_display_name": "{{ .Env.LDAP_USER_SCHEMA_DISPLAYNAME }}",
"s01ldap_dn": "{{ .Env.STORAGE_LDAP_BIND_DN }}",
"s01ldap_dynamic_group_member_url": "",
"s01ldap_email_attr": "{{ .Env.LDAP_USER_SCHEMA_MAIL }}",
"s01ldap_experienced_admin": "1",
"s01ldap_expert_username_attr": "{{ .Env.LDAP_USER_SCHEMA_NAME_ATTR }}",
"s01ldap_expert_uuid_group_attr": "",
"s01ldap_expert_uuid_user_attr": "{{ .Env.LDAP_USER_SCHEMA_UID }}",
"s01ldap_group_display_name": "{{ .Env.LDAP_GROUP_SCHEMA_DISPLAYNAME }}",
"s01ldap_group_filter_mode": "0",
"s01ldap_group_filter": "{{ .Env.LDAP_GROUPFILTER }}",
"s01ldap_group_member_assoc_attribute": "{{ .Env.LDAP_GROUP_MEMBER_ASSOC_ATTR }}",
"s01ldap_groupfilter_groups": "",
"s01ldap_groupfilter_objectclass": "",
"s01ldap_host": "{{ .Env.LDAP_HOST }}",
"s01ldap_login_filter_mode": "0",
"s01ldap_login_filter": "{{ .Env.LDAP_LOGINFILTER }}",
"s01ldap_loginfilter_attributes": "",
"s01ldap_loginfilter_email": "1",
"s01ldap_loginfilter_username": "1",
"s01ldap_nested_groups": "0",
"s01ldap_override_main_server": "",
"s01ldap_paging_size": "100",
"s01ldap_port": "{{ .Env.LDAP_PORT }}",
"s01ldap_quota_attr": "",
"s01ldap_quota_def": "",
"s01ldap_tls": "0",
"s01ldap_turn_off_cert_check": "0",
"s01ldap_user_display_name_2": "",
"s01ldap_user_filter_mode": "0",
"s01ldap_userfilter_groups": "",
"s01ldap_userfilter_objectclass": "",
"s01ldap_userlist_filter": "{{ .Env.LDAP_USERFILTER }}",
"s01use_memberof_to_detect_membership": "1"
}
}
}
22 changes: 22 additions & 0 deletions tests/parallelDeployAcceptance/drone/oc10/oidc.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

# reference: https://doc.owncloud.com/server/admin_manual/configuration/user/oidc/

function getOIDCConfigFromEnv() {
$config = [
'openid-connect' => [
'provider-url' => getenv('IDP_OIDC_ISSUER'),
'client-id' => 'oc10',
'client-secret' => getenv('IDP_OIDC_CLIENT_SECRET'),
'loginButtonName' => 'OpenId Connect',
'search-attribute' => 'preferred_username',
'mode' => 'userid',
'autoRedirectOnLoginPage' => true,
'insecure' => true,
'post_logout_redirect_uri' => 'https://' . getenv('CLOUD_DOMAIN'),
],
];
return $config;
}

$CONFIG = getOIDCConfigFromEnv();
109 changes: 109 additions & 0 deletions tests/parallelDeployAcceptance/drone/ocis/proxy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"log": {
"level": "PROXY_LOG_LEVEL"
},
"policy_selector": {
"claims": {
"default_policy": "oc10",
"unauthenticated_policy": "oc10"
}
},
"policies": [
{
"name": "ocis",
"routes": [
{
"endpoint": "/",
"backend": "http://localhost:9100"
},
{
"endpoint": "/.well-known/",
"backend": "http://localhost:9130"
},
{
"type": "regex",
"endpoint": "/ocs/v[12].php/cloud/user/signing-key",
"backend": "http://localhost:9110"
},
{
"endpoint": "/ocs/",
"backend": "http://localhost:9140"
},
{
"type": "query",
"endpoint": "/remote.php/?preview=1",
"backend": "http://localhost:9115"
},
{
"endpoint": "/remote.php/",
"backend": "http://localhost:9140"
},
{
"endpoint": "/dav/",
"backend": "http://localhost:9140"
},
{
"endpoint": "/webdav/",
"backend": "http://localhost:9140"
},
{
"endpoint": "/status.php",
"backend": "http://localhost:9140"
},
{
"endpoint": "/index.php/",
"backend": "http://localhost:9140"
},
{
"endpoint": "/index.php/login",
"backend": "http://localhost:9100"
},
{
"endpoint": "/login",
"backend": "http://localhost:9100"
},
{
"endpoint": "/data",
"backend": "http://localhost:9140"
},
{
"endpoint": "/graph/",
"backend": "http://localhost:9120"
},
{
"endpoint": "/app/",
"backend": "http://localhost:9140"
},
{
"endpoint": "/archiver",
"backend": "http://localhost:9140"
},
{
"endpoint": "/graph-explorer/",
"backend": "http://localhost:9135"
},
{
"endpoint": "/api/v0/settings",
"backend": "http://localhost:9190"
},
{
"endpoint": "/settings.js",
"backend": "http://localhost:9190"
}
]
},
{
"name": "oc10",
"routes": [
{
"endpoint": "/",
"backend": "http://oc10:8080"
},
{
"endpoint": "/data",
"backend": "http://localhost:9140"
}
]
}
]
}
5 changes: 5 additions & 0 deletions tests/parallelDeployAcceptance/expected-failures-API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Scenarios that are expected to fail in parallel deployment

#### [[WIP] Add a SharesStorageProvider and an oc10 sql share manager](https://github.com/owncloud/ocis/pull/2232)

- [apiShareManagement/acceptShares.feature:22](https://github.com/owncloud/ocis/blob/master/tests/parallelDeployAcceptance/features/apiShareManagement/acceptShares.feature#L22)
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Sharing tests currently doesn't work
# Accessing oc10 shares from ocis still WIP in PR #2232
# https://github.com/owncloud/ocis/pull/2232
@api
Feature: sharing files and folders
As a user
I want to share files/folders with other users
So that I can give access to my files/folders to others


Background:
Given using "oc10" as owncloud selector
And the administrator has set the default folder for received shares to "Shares"
And auto-accept shares has been disabled
And using OCS API version "1"
And using new DAV path
And user "Alice" has been created with default attributes and without skeleton files
And user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has uploaded file with content "ownCloud test text file" to "textfile.txt"


Scenario: accept a pending share
Given user "Alice" has shared folder "/textfile.txt" with user "Brian"
And using "ocis" as owncloud selector
When user "Brian" accepts share "/textfile.txt" offered by user "Alice" using the sharing API
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And the sharing API should report to user "Brian" that these shares are in the accepted state
| path |
| /Shares/textfile.txt |
Loading

0 comments on commit f448f40

Please sign in to comment.