diff --git a/.drone.star b/.drone.star index 90a826922..e9c9f661a 100644 --- a/.drone.star +++ b/.drone.star @@ -1,6 +1,8 @@ def main(ctx): before = [ testing(ctx), + apiTests(ctx), + uiTests(ctx), ] stages = [ @@ -22,6 +24,132 @@ def main(ctx): return before + stages + after +def apiTests(ctx): + return { + 'kind': 'pipeline', + 'type': 'docker', + 'name': 'API-Tests', + 'platform': { + 'os': 'linux', + 'arch': 'amd64', + }, + 'steps': [ + { + 'name': 'build', + 'image': 'webhippie/golang:1.13', + 'pull': 'always', + 'commands': [ + 'make build', + ], + 'volumes': [ + { + 'name': 'gopath', + 'path': '/srv/app', + }, + ], + }, + { + 'name': 'reva-server', + 'image': 'webhippie/golang:1.13', + 'pull': 'always', + 'detach': True, + 'environment' : { + 'REVA_LDAP_HOSTNAME': 'ldap', + 'REVA_LDAP_PORT': 636, + 'REVA_LDAP_BIND_DN': 'cn=admin,dc=owncloud,dc=com', + 'REVA_LDAP_BIND_PASSWORD': 'admin', + 'REVA_LDAP_BASE_DN': 'dc=owncloud,dc=com', + 'REVA_LDAP_SCHEMA_DISPLAYNAME': 'displayName', + 'REVA_STORAGE_HOME_DATA_TEMP_FOLDER': '/srv/app/tmp/', + 'REVA_STORAGE_OWNCLOUD_DATADIR': '/srv/app/tmp/reva/data', + 'REVA_STORAGE_OC_DATA_TEMP_FOLDER': '/srv/app/tmp/', + 'REVA_STORAGE_OWNCLOUD_REDIS_ADDR': 'redis:6379', + 'REVA_SHARING_USER_JSON_FILE': '/srv/app/tmp/reva/shares.json' + }, + 'commands': [ + 'mkdir -p /srv/app/tmp/reva', + 'bin/ocis-reva gateway &', + 'bin/ocis-reva users &', + 'bin/ocis-reva auth-basic &', + 'bin/ocis-reva auth-bearer &', + 'bin/ocis-reva sharing &', + 'bin/ocis-reva storage-home &', + 'bin/ocis-reva storage-home-data &', + 'bin/ocis-reva storage-oc &', + 'bin/ocis-reva storage-oc-data &', + 'bin/ocis-reva frontend' + ], + 'volumes': [ + { + 'name': 'gopath', + 'path': '/srv/app', + }, + ] + }, + { + 'name': 'acceptance-tests', + 'image': 'owncloudci/php:7.2', + 'pull': 'always', + 'environment' : { + 'TEST_SERVER_URL': 'http://reva-server:9140', + 'BEHAT_FILTER_TAGS': '~@skipOnOcis&&~@skipOnLDAP&&@TestAlsoOnExternalUserBackend&&~@local_storage', + 'REVA_LDAP_HOSTNAME':'ldap', + 'TEST_EXTERNAL_USER_BACKENDS':'true', + 'TEST_OCIS':'true', + 'OCIS_REVA_DATA_ROOT': '/srv/app/tmp/reva/', + 'SKELETON_DIR': '/srv/app/tmp/testing/data/apiSkeleton' + }, + 'commands': [ + 'git clone -b master --depth=1 https://github.com/owncloud/testing.git /srv/app/tmp/testing', + 'git clone -b master --depth=1 https://github.com/owncloud/core.git /srv/app/testrunner', + 'cd /srv/app/testrunner', + 'make test-acceptance-api' + ], + 'volumes': [ + { + 'name': 'gopath', + 'path': '/srv/app', + }, + ] + }, + ], + 'services': [ + { + 'name': 'ldap', + 'image': 'osixia/openldap', + 'pull': 'always', + 'environment': { + 'LDAP_DOMAIN': 'owncloud.com', + 'LDAP_ORGANISATION': 'owncloud', + 'LDAP_ADMIN_PASSWORD': 'admin', + 'LDAP_TLS_VERIFY_CLIENT': 'never', + 'HOSTNAME': 'ldap' + }, + }, + { + 'name': 'redis', + 'image': 'webhippie/redis', + 'pull': 'always', + 'environment': { + 'REDIS_DATABASES': 1 + }, + }, + ], + 'volumes': [ + { + 'name': 'gopath', + 'temp': {}, + }, + ], + 'trigger': { + 'ref': [ + 'refs/heads/master', + 'refs/tags/**', + 'refs/pull/**', + ], + }, + } + def testing(ctx): return { 'kind': 'pipeline', @@ -142,7 +270,8 @@ def testing(ctx): 'REVA_STORAGE_OWNCLOUD_DATADIR': '/srv/app/tmp/reva/data', 'REVA_STORAGE_OC_DATA_TEMP_FOLDER': '/srv/app/tmp/', 'REVA_STORAGE_OWNCLOUD_REDIS_ADDR': 'redis:6379', - 'REVA_SHARING_USER_JSON_FILE': '/srv/app/tmp/reva/shares.json' + 'REVA_SHARING_USER_JSON_FILE': '/srv/app/tmp/reva/shares.json', + 'REVA_OIDC_ISSUER': 'https://konnectd:9130', }, 'commands': [ 'mkdir -p /srv/app/tmp/reva', @@ -164,32 +293,6 @@ def testing(ctx): }, ] }, - { - 'name': 'acceptance-tests', - 'image': 'owncloudci/php:7.2', - 'pull': 'always', - 'environment' : { - 'TEST_SERVER_URL': 'http://reva-server:9140', - 'BEHAT_FILTER_TAGS': '~@skipOnOcis&&~@skipOnLDAP&&@TestAlsoOnExternalUserBackend&&~@local_storage', - 'REVA_LDAP_HOSTNAME':'ldap', - 'TEST_EXTERNAL_USER_BACKENDS':'true', - 'TEST_OCIS':'true', - 'OCIS_REVA_DATA_ROOT': '/srv/app/tmp/reva/', - 'SKELETON_DIR': '/srv/app/tmp/testing/data/apiSkeleton' - }, - 'commands': [ - 'git clone -b master --depth=1 https://github.com/owncloud/testing.git /srv/app/tmp/testing', - 'git clone -b master --depth=1 https://github.com/owncloud/core.git /srv/app/testrunner', - 'cd /srv/app/testrunner', - 'make test-acceptance-api' - ], - 'volumes': [ - { - 'name': 'gopath', - 'path': '/srv/app', - }, - ] - }, { 'name': 'import-litmus-users', 'image': 'emeraldsquad/ldapsearch', @@ -243,6 +346,234 @@ def testing(ctx): 'name': 'gopath', 'temp': {}, }, + { + 'name': 'config', + 'temp': {}, + }, + { + 'name': 'uploads', + 'temp': {}, + }, + ], + 'trigger': { + 'ref': [ + 'refs/heads/master', + 'refs/tags/**', + 'refs/pull/**', + ], + }, + } + +def uiTests(ctx): + return { + 'kind': 'pipeline', + 'type': 'docker', + 'name': 'Phoenix-UI-Tests', + 'platform': { + 'os': 'linux', + 'arch': 'amd64', + }, + 'steps': [ + { + 'name': 'build', + 'image': 'webhippie/golang:1.13', + 'pull': 'always', + 'commands': [ + 'make build', + ], + 'volumes': [ + { + 'name': 'gopath', + 'path': '/srv/app', + }, + ], + }, + { + 'name': 'copy-config', + 'image': 'webhippie/golang:1.13', + 'commands': [ + 'mkdir -p /srv/config/drone', + 'ls -la tests/config', + 'cp -r tests/config/config.json /srv/config/drone', + 'cp -r tests/config/identifier-registration.yml /srv/config/drone', + 'ls -la /srv/config/drone', + ], + 'volumes': [ + { + 'name': 'config', + 'path': '/srv/config', + }, + ] + }, + { + 'name': 'konnectd', + 'image': 'owncloud/ocis-konnectd', + 'pull': 'always', + 'detach': True, + 'environment': { + 'LDAP_BASEDN': 'ou=TestUsers,dc=owncloud,dc=com', + 'LDAP_BINDDN': 'cn=admin,dc=owncloud,dc=com', + 'LDAP_URI': 'ldap://ldap:389', + 'KONNECTD_IDENTIFIER_REGISTRATION_CONF': '/srv/config/drone/identifier-registration.yml', + 'KONNECTD_ISS': 'https://konnectd:9130', + 'KONNECTD_TLS': 'true', + 'LDAP_BINDPW': 'admin', + 'LDAP_SCOPE': 'sub', + 'LDAP_LOGIN_ATTRIBUTE': 'uid', + 'LDAP_EMAIL_ATTRIBUTE': 'mail', + 'LDAP_NAME_ATTRIBUTE': 'givenName', + 'LDAP_UUID_ATTRIBUTE': 'uid', + 'LDAP_UUID_ATTRIBUTE_TYPE': 'text', + 'LDAP_FILTER': "(objectClass=posixaccount)" + }, + 'volumes': [ + { + 'name': 'config', + 'path': '/srv/config', + }, + ] + }, + { + 'name': 'phoenix', + 'image': 'owncloud/ocis-phoenix', + 'pull': 'always', + 'detach': True, + 'environment': { + 'PHOENIX_WEB_CONFIG': '/srv/config/drone/config.json', + 'PHOENIX_OIDC_CLIENT_ID': 'phoenix' + }, + 'volumes': [ + { + 'name': 'config', + 'path': '/srv/config', + }, + ] + }, + { + 'name': 'reva-server', + 'image': 'webhippie/golang:1.13', + 'pull': 'always', + 'detach': True, + 'environment' : { + 'REVA_LDAP_HOSTNAME': 'ldap', + 'REVA_LDAP_PORT': 636, + 'REVA_LDAP_BIND_DN': 'cn=admin,dc=owncloud,dc=com', + 'REVA_LDAP_BIND_PASSWORD': 'admin', + 'REVA_LDAP_BASE_DN': 'dc=owncloud,dc=com', + 'REVA_LDAP_SCHEMA_DISPLAYNAME': 'displayName', + 'REVA_STORAGE_HOME_DATA_TEMP_FOLDER': '/srv/app/tmp/', + 'REVA_STORAGE_OWNCLOUD_DATADIR': '/srv/app/tmp/reva/data', + 'REVA_STORAGE_OC_DATA_TEMP_FOLDER': '/srv/app/tmp/', + 'REVA_STORAGE_OWNCLOUD_REDIS_ADDR': 'redis:6379', + 'REVA_SHARING_USER_JSON_FILE': '/srv/app/tmp/reva/shares.json', + 'REVA_OIDC_ISSUER': 'https://konnectd:9130', + }, + 'commands': [ + 'mkdir -p /srv/app/tmp/reva', + 'bin/ocis-reva gateway &', + 'bin/ocis-reva users &', + 'bin/ocis-reva auth-basic &', + 'bin/ocis-reva auth-bearer &', + 'bin/ocis-reva sharing &', + 'bin/ocis-reva storage-home &', + 'bin/ocis-reva storage-home-data &', + 'bin/ocis-reva storage-oc &', + 'bin/ocis-reva storage-oc-data &', + 'bin/ocis-reva frontend' + ], + 'volumes': [ + { + 'name': 'gopath', + 'path': '/srv/app', + }, + ] + }, + { + 'name': 'ui-tests', + 'image': 'owncloudci/nodejs:11', + 'pull': 'always', + 'environment' : { + 'TEST_TAGS': 'not @skipOnOCIS and not @skip', + 'REVA_LDAP_HOSTNAME':'ldap', + 'SERVER_HOST': 'http://phoenix:9100', + 'BACKEND_HOST': 'http://reva-server:9140', + 'SELENIUM_PORT': '4444', + 'RUN_ON_OCIS': 'true', + 'OCIS_SKELETON_DIR': '/srv/app/testingapp/data/webUISkeleton', + 'OCIS_REVA_DATA_ROOT': '/srv/app/tmp/reva/', + 'LDAP_SERVER_URL': 'ldap://ldap', + 'PHOENIX_CONFIG': '/srv/config/drone/config.json', + 'TEST_CONTEXT': '', + 'LOCAL_UPLOAD_DIR': '/uploads', + }, + 'commands': [ + 'ls -la /srv/config/drone', + 'git clone https://github.com/owncloud/testing.git /srv/app/testingapp', + 'git clone -b master --depth=1 https://github.com/owncloud/phoenix.git /srv/app/uitestrunner', + 'cd /srv/app/uitestrunner', + 'yarn install --all', + 'yarn run acceptance-tests-drone' + ], + 'volumes': [ + { + 'name': 'gopath', + 'path': '/srv/app', + }, + { + 'name': 'config', + 'path': '/srv/config', + }, + { + 'name': 'uploads', + 'path': '/srv/app/phoenix/tests/acceptance/uitestrunner', + }, + ] + }, + ], + 'services': [ + { + 'name': 'ldap', + 'image': 'osixia/openldap', + 'pull': 'always', + 'environment': { + 'LDAP_DOMAIN': 'owncloud.com', + 'LDAP_ORGANISATION': 'owncloud', + 'LDAP_ADMIN_PASSWORD': 'admin', + 'LDAP_TLS_VERIFY_CLIENT': 'never', + 'HOSTNAME': 'ldap' + }, + }, + { + 'name': 'selenium', + 'image': 'selenium/standalone-chrome-debug:3.141.59-20200326', + 'pull': 'always', + 'volumes': [{ + 'name': 'uploads', + 'path': '/uploads' + }], + }, + { + 'name': 'redis', + 'image': 'webhippie/redis', + 'pull': 'always', + 'environment': { + 'REDIS_DATABASES': 1 + }, + }, + ], + 'volumes': [ + { + 'name': 'gopath', + 'temp': {}, + }, + { + 'name': 'config', + 'temp': {}, + }, + { + 'name': 'uploads', + 'temp': {}, + }, ], 'trigger': { 'ref': [ diff --git a/tests/config/config.json b/tests/config/config.json new file mode 100644 index 000000000..99a71225c --- /dev/null +++ b/tests/config/config.json @@ -0,0 +1,19 @@ +{ + "server": "http://reva-server:9140", + "theme": "owncloud", + "version": "0.1.0", + "openIdConnect": { + "metadata_url": "https://konnectd:9130/.well-known/openid-configuration", + "authority": "https://konnectd:9130", + "client_id": "phoenix", + "response_type": "code", + "scope": "openid profile email" + }, + "apps": [ + "files", + "draw-io", + "pdf-viewer", + "markdown-editor", + "media-viewer" + ] +} diff --git a/tests/config/identifier-registration.yml b/tests/config/identifier-registration.yml new file mode 100644 index 000000000..0515385af --- /dev/null +++ b/tests/config/identifier-registration.yml @@ -0,0 +1,16 @@ +--- + +# OpenID Connect client registry. +clients: + - id: phoenix + name: OCIS + application_type: web + insecure: yes + trusted: yes + redirect_uris: + - http://phoenix:9100/oidc-callback.html + - http://phoenix:9100/ + origins: + - http://phoenix:9100 + +authorities: