Skip to content

Commit

Permalink
Setup ci for graph tests
Browse files Browse the repository at this point in the history
Signed-off-by: Parajuli Kiran <[email protected]>
  • Loading branch information
kiranparajuli589 committed Apr 6, 2022
1 parent 338662e commit 26521c3
Showing 1 changed file with 139 additions and 25 deletions.
164 changes: 139 additions & 25 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -61,51 +61,57 @@ config = {
"webdav",
],
"cs3ApiTests": {
"skip": False,
"skip": True,
"earlyFail": True,
},
"localApiTests": {
"skip": False,
"skip": True,
"earlyFail": True,
},
"apiTests": {
"numberOfParts": 10,
"skip": False,
"skip": True,
"skipExceptParts": [],
"earlyFail": True,
},
"uiTests": {
"filterTags": "@ocisSmokeTest",
"skip": False,
"skip": True,
"skipExceptParts": [],
"earlyFail": True,
},
"accountsUITests": {
"skip": False,
"skip": True,
"earlyFail": True,
},
"settingsUITests": {
"skip": False,
"skip": True,
"earlyFail": True,
},
"parallelApiTests": {
"apiSharing": {
"suites": [
"apiShareManagement",
],
"skip": False,
"skip": True,
"earlyFail": True,
"cron": "nightly",
},
"apiWebdav": {
"suites": [
"apiWebdavOperations",
],
"skip": False,
"skip": True,
"earlyFail": True,
"cron": "nightly",
},
},
"graphApiTests": {
"skip": False,
"earlyFali": False,
"numberOfParts": 10,
"skipExceptParts": []
},
"rocketchat": {
"channel": "ocis-internal",
"from_secret": "private_rocketchat",
Expand Down Expand Up @@ -290,6 +296,9 @@ def testPipelines(ctx):
if "skip" not in config["parallelApiTests"] or not config["parallelApiTests"]["skip"]:
pipelines += parallelDeployAcceptancePipeline(ctx)

if "skip" not in config["graphApiTests"] or not config["graphApiTests"]["skip"]:
pipelines += graphApiAcceptancePipeline(ctx)

return pipelines

def testOcisModule(ctx, module):
Expand Down Expand Up @@ -1474,25 +1483,64 @@ def notify(ctx):
},
}

def ocisServer(storage, accounts_hash_difficulty = 4, volumes = [], depends_on = [], testing_parallel_deploy = False):
def ocisServer(storage, accounts_hash_difficulty = 4, volumes = [], depends_on = [], testing_parallel_deploy = False, testing_graph_api = False):
if not testing_parallel_deploy:
user = "0:0"
environment = {
"OCIS_URL": "https://ocis-server:9200",
"STORAGE_GATEWAY_GRPC_ADDR": "0.0.0.0:9142",
"STORAGE_HOME_DRIVER": "%s" % (storage),
"STORAGE_USERS_DRIVER": "%s" % (storage),
"STORAGE_USERS_DRIVER_LOCAL_ROOT": "/srv/app/tmp/ocis/local/root",
"STORAGE_USERS_DRIVER_OCIS_ROOT": "/srv/app/tmp/ocis/storage/users",
"STORAGE_METADATA_DRIVER_OCIS_ROOT": "/srv/app/tmp/ocis/storage/metadata",
"STORAGE_SHARING_USER_JSON_FILE": "/srv/app/tmp/ocis/shares.json",
"PROXY_ENABLE_BASIC_AUTH": True,
"WEB_UI_CONFIG": "/drone/src/tests/config/drone/ocis-config.json",
"IDP_IDENTIFIER_REGISTRATION_CONF": "/drone/src/tests/config/drone/identifier-registration.yml",
"OCIS_LOG_LEVEL": "error",
"SETTINGS_DATA_PATH": "/srv/app/tmp/ocis/settings",
"OCIS_INSECURE": "true",
}
if testing_graph_api:
environment = {
"GRAPH_IDENTITY_BACKEND": "ldap",
"GRAPH_LDAP_URI": "ldaps://ocis-server:9235",
"GRAPH_LDAP_BIND_DN": "uid=libregraph,ou=sysusers,o=libregraph-idm",
"GRAPH_LDAP_BIND_PASSWORD": "idm",
"GRAPH_LDAP_USER_EMAIL_ATTRIBUTE": "mail",
"GRAPH_LDAP_USER_NAME_ATTRIBUTE": "uid",
"GRAPH_LDAP_USER_BASE_DN": "ou=users,o=libregraph-idm",
"GRAPH_LDAP_GROUP_BASE_DN": "ou=groups,o=libregraph-idm",
"GRAPH_LDAP_SERVER_WRITE_ENABLED": "true",
"IDP_INSECURE": "true",
"IDP_LDAP_FILTER": "(&(objectclass=inetOrgPerson)(objectClass=owncloud))",
"IDP_LDAP_URI": "ldaps://ocis-server:9235",
"IDP_LDAP_BIND_DN": "uid=idp,ou=sysusers,o=libregraph-idm",
"IDP_LDAP_BIND_PASSWORD": "idp",
"IDP_LDAP_BASE_DN": "ou=users,o=libregraph-idm",
"IDP_LDAP_LOGIN_ATTRIBUTE": "uid",
"IDP_LDAP_UUID_ATTRIBUTE": "ownclouduuid",
"IDP_LDAP_UUID_ATTRIBUTE_TYPE": "binary",
"PROXY_ACCOUNT_BACKEND_TYPE": "cs3",
"OCS_ACCOUNT_BACKEND_TYPE": "cs3",
"STORAGE_LDAP_HOSTNAME": "localhost",
"STORAGE_LDAP_PORT": 9235,
"STORAGE_LDAP_INSECURE": "true",
"STORAGE_LDAP_BASE_DN": "o=libregraph-idm",
"STORAGE_LDAP_BIND_DN": "uid=reva,ou=sysusers,o=libregraph-idm",
"STORAGE_LDAP_BIND_PASSWORD": "reva",
"STORAGE_LDAP_LOGINFILTER": "(&(objectclass=inetOrgPerson)(objectclass=owncloud)(|(uid={{login}})(mail={{login}})))",
"STORAGE_LDAP_USERFILTER": "(&(objectclass=inetOrgPerson)(objectclass=owncloud)(|(ownclouduuid={{.OpaqueId}})(uid={{.OpaqueId}})))",
"STORAGE_LDAP_USERATTRIBUTEFILTER": "(&(objectclass=owncloud)({{attr}}={{value}}))",
"STORAGE_LDAP_USERFINDFILTER": "(&(objectclass=owncloud)(|(uid={{query}}*)(cn={{query}}*)(displayname={{query}}*)(mail={{query}}*)(description={{query}}*)))",
"STORAGE_LDAP_USERGROUPFILER": "(&(objectclass=groupOfNames)(member={{query}}*))",
"STORAGE_LDAP_GROUPFILTER": "(&(objectclass=groupOfNames)(objectclass=owncloud)(ownclouduuid={{.OpaqueId}}*))",
"OCIS_RUN_EXTENSIONS": "settings,storage-metadata,graph,graph-explorer,ocs,store,thumbnails,web,webdav,storage-frontend,storage-gateway,storage-userprovider,storage-groupprovider,storage-authbasic,storage-authbearer,storage-authmachine,storage-users,storage-shares,storage-public-link,storage-appprovider,storage-sharing,proxy,idp,nats,idm",
"OCIS_INSECURE": "true",
"PROXY_ENABLE_BASIC_AUTH": True,
}
else:
environment = {
"OCIS_URL": "https://ocis-server:9200",
"STORAGE_GATEWAY_GRPC_ADDR": "0.0.0.0:9142",
"STORAGE_HOME_DRIVER": "%s" % (storage),
"STORAGE_USERS_DRIVER": "%s" % (storage),
"STORAGE_USERS_DRIVER_LOCAL_ROOT": "/srv/app/tmp/ocis/local/root",
"STORAGE_USERS_DRIVER_OCIS_ROOT": "/srv/app/tmp/ocis/storage/users",
"STORAGE_METADATA_DRIVER_OCIS_ROOT": "/srv/app/tmp/ocis/storage/metadata",
"STORAGE_SHARING_USER_JSON_FILE": "/srv/app/tmp/ocis/shares.json",
"PROXY_ENABLE_BASIC_AUTH": True,
"WEB_UI_CONFIG": "/drone/src/tests/config/drone/ocis-config.json",
"IDP_IDENTIFIER_REGISTRATION_CONF": "/drone/src/tests/config/drone/identifier-registration.yml",
"OCIS_LOG_LEVEL": "error",
"SETTINGS_DATA_PATH": "/srv/app/tmp/ocis/settings",
"OCIS_INSECURE": "true",
}
else:
user = "33:33"
environment = {
Expand Down Expand Up @@ -2269,6 +2317,72 @@ def parallelDeploymentOC10Server():
},
]

def graphApiAcceptancePipeline(ctx):
pipelines = []

default = {
"filterTags": "~@skip",
}

debugParts = config["graphApiTests"]["skipExceptParts"]
debugPartsEnabled = (len(debugParts) != 0)
for runPart in range(1, config["graphApiTests"]["numberOfParts"] + 1):
if (not debugPartsEnabled or (debugPartsEnabled and runPart in debugParts)):
pipelines.append(graphApiTests(ctx, runPart, config["graphApiTests"]["numberOfParts"], "ocis"))

return pipelines

def graphApiTests(ctx, part_number = 1, number_of_parts = 1, storage = "ocis", accounts_hash_difficulty = 4):
early_fail = config["graphApiTests"]["earlyFail"] if "earlyFail" in config["graphApiTests"] else False

return {
"kind": "pipeline",
"type": "docker",
"name": "Graph-Core-API-Tests-%s-storage-%s" % (storage, part_number),
"platform": {
"os": "linux",
"arch": "amd64",
},
"steps": skipIfUnchanged(ctx, "acceptance-tests") + restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin/ocis") +
ocisServer(storage, accounts_hash_difficulty, [stepVolumeOC10Tests], [], False, True) +
cloneCoreRepos() + [
{
"name": "Graph-oC10ApiTests-%s-storage-%s" % (storage, part_number),
"image": OC_CI_PHP % DEFAULT_PHP_VERSION,
"environment": {
"TEST_WITH_GRAPH_API": "true",
"PATH_TO_OCIS": "/drone/src",
"TEST_SERVER_URL": "https://ocis-server:9200",
"OCIS_REVA_DATA_ROOT": "%s" % ("/srv/app/tmp/ocis/owncloud/data/" if storage == "owncloud" else ""),
"SKELETON_DIR": "/srv/app/tmp/testing/data/apiSkeleton",
"OCIS_SKELETON_STRATEGY": "%s" % ("copy" if storage == "owncloud" else "upload"),
"TEST_OCIS": "true",
"SEND_SCENARIO_LINE_REFERENCES": "true",
"STORAGE_DRIVER": storage,
"BEHAT_FILTER_TAGS": "~@skipOnOcis&&~@notToImplementOnOCIS&&~@toImplementOnOCIS&&~comments-app-required&&~@federation-app-required&&~@notifications-app-required&&~systemtags-app-required&&~@local_storage&&~@skipOnOcis-%s-Storage&&~@issue-ocis-3023" % ("OC" if storage == "owncloud" else "OCIS"),
"DIVIDE_INTO_NUM_PARTS": number_of_parts,
"RUN_PART": part_number,
# "EXPECTED_FAILURES_FILE": "/drone/src/tests/acceptance/expected-failures-API-on-%s-storage.md" % (storage.upper()),
"UPLOAD_DELETE_WAIT_TIME": "1" if storage == "owncloud" else 0,
},
"commands": [
"make -C /srv/app/testrunner test-acceptance-api",
],
"volumes": [stepVolumeOC10Tests],
},
] + failEarly(ctx, early_fail),
"services": redisForOCStorage(storage),
"depends_on": getPipelineNames([buildOcisBinaryForTesting(ctx)]),
"trigger": {
"ref": [
"refs/heads/master",
"refs/tags/v*",
"refs/pull/**",
],
},
"volumes": [pipelineVolumeOC10Tests],
}

def ldapService():
return [{
"name": "openldap",
Expand Down

0 comments on commit 26521c3

Please sign in to comment.