Merge pull request #3943 from owncloud/simplify-litmus-drone

[tests-only] Simplify litmus starlark code
This commit is contained in:
Artur Neumann authored and GitHub committed 2022-06-10 16:52:17 +05:45
commit 803f48dfb3
1 file changed
+98 -124
+98 -124
View File
@@ -21,7 +21,7 @@ OC_CS3_API_VALIDATOR = "owncloud/cs3api-validator:latest"
OC_LITMUS = "owncloud/litmus:latest" OC_LITMUS = "owncloud/litmus:latest"
OC_OC_TEST_MIDDLEWARE = "owncloud/owncloud-test-middleware:1.6.0" OC_OC_TEST_MIDDLEWARE = "owncloud/owncloud-test-middleware:1.6.0"
OC_SERVER = "owncloud/server:10" OC_SERVER = "owncloud/server:10"
OC_UBUNTU = "owncloud/ubuntu:18.04" OC_UBUNTU = "owncloud/ubuntu:20.04"
OSIXIA_OPEN_LDAP = "osixia/openldap:latest" OSIXIA_OPEN_LDAP = "osixia/openldap:latest"
PLUGINS_CODACY = "plugins/codacy:1" PLUGINS_CODACY = "plugins/codacy:1"
PLUGINS_DOCKER = "plugins/docker:latest" PLUGINS_DOCKER = "plugins/docker:latest"
@@ -2453,138 +2453,112 @@ def fixSharedDataPermissions():
def litmus(ctx, storage): def litmus(ctx, storage):
pipelines = [] pipelines = []
default = { if (config["litmus"] == False):
"phpVersions": [DEFAULT_PHP_VERSION], return pipelines
"logLevel": "2",
"useHttps": True, environment = {
"LITMUS_PASSWORD": "admin",
"LITMUS_USERNAME": "admin",
"TESTS": "basic copymove props http",
} }
if "defaults" in config: litmusCommand = "/usr/local/bin/litmus-wrapper"
if "litmus" in config["defaults"]:
for item in config["defaults"]["litmus"]:
default[item] = config["defaults"]["litmus"][item]
litmusConfig = config["litmus"] result = {
"kind": "pipeline",
if type(litmusConfig) == "bool": "type": "docker",
if litmusConfig: "name": "litmus",
# the config has 'litmus' true, so specify an empty dict that will get the defaults "workspace": {
litmusConfig = {} "base": "/drone",
else: "path": "src",
return pipelines },
"steps": restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin/ocis") +
if len(litmusConfig) == 0: ocisServer(storage) +
# 'litmus' is an empty dict, so specify a single section that will get the defaults setupForLitmus() +
litmusConfig = {"doDefault": {}} [
{
for category, matrix in litmusConfig.items(): "name": "old-endpoint",
params = {} "image": OC_LITMUS,
for item in default: "environment": environment,
params[item] = matrix[item] if item in matrix else default[item] "commands": [
"source .env",
for phpVersion in params["phpVersions"]: 'export LITMUS_URL="https://ocis-server:9200/remote.php/webdav"',
environment = { litmusCommand,
"LITMUS_PASSWORD": "admin",
"LITMUS_USERNAME": "admin",
"TESTS": "basic copymove props http",
}
litmusCommand = "/usr/local/bin/litmus-wrapper"
result = {
"kind": "pipeline",
"type": "docker",
"name": "litmus-php%s" % phpVersion,
"workspace": {
"base": "/drone",
"path": "src",
},
"steps": restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin/ocis") +
ocisServer(storage) +
setupForLitmus(phpVersion) +
[
{
"name": "old-endpoint",
"image": OC_LITMUS,
"environment": environment,
"commands": [
"source .env",
'export LITMUS_URL="https://ocis-server:9200/remote.php/webdav"',
litmusCommand,
],
},
{
"name": "new-endpoint",
"image": OC_LITMUS,
"environment": environment,
"commands": [
"source .env",
'export LITMUS_URL="https://ocis-server:9200/remote.php/dav/files/admin"',
litmusCommand,
],
},
{
"name": "new-shared",
"image": OC_LITMUS,
"environment": environment,
"commands": [
"source .env",
'export LITMUS_URL="https://ocis-server:9200/remote.php/dav/files/admin/Shares/new_folder/"',
litmusCommand,
],
},
{
"name": "old-shared",
"image": OC_LITMUS,
"environment": environment,
"commands": [
"source .env",
'export LITMUS_URL="https://ocis-server:9200/remote.php/webdav/Shares/new_folder/"',
litmusCommand,
],
},
{
"name": "public-share",
"image": OC_LITMUS,
"environment": {
"LITMUS_PASSWORD": "admin",
"LITMUS_USERNAME": "admin",
"TESTS": "basic copymove http",
},
"commands": [
"source .env",
"export LITMUS_URL='https://ocis-server:9200/remote.php/dav/public-files/'$PUBLIC_TOKEN",
litmusCommand,
],
},
{
"name": "spaces-endpoint",
"image": OC_LITMUS,
"environment": environment,
"commands": [
"source .env",
"export LITMUS_URL='https://ocis-server:9200/remote.php/dav/spaces/'$SPACE_ID",
litmusCommand,
],
},
], ],
"services": redisForOCStorage(storage), },
"depends_on": getPipelineNames([buildOcisBinaryForTesting(ctx)]), {
"trigger": { "name": "new-endpoint",
"ref": [ "image": OC_LITMUS,
"refs/heads/master", "environment": environment,
"refs/tags/v*", "commands": [
"refs/pull/**", "source .env",
], 'export LITMUS_URL="https://ocis-server:9200/remote.php/dav/files/admin"',
}, litmusCommand,
} ],
pipelines.append(result) },
{
"name": "new-shared",
"image": OC_LITMUS,
"environment": environment,
"commands": [
"source .env",
'export LITMUS_URL="https://ocis-server:9200/remote.php/dav/files/admin/Shares/new_folder/"',
litmusCommand,
],
},
{
"name": "old-shared",
"image": OC_LITMUS,
"environment": environment,
"commands": [
"source .env",
'export LITMUS_URL="https://ocis-server:9200/remote.php/webdav/Shares/new_folder/"',
litmusCommand,
],
},
{
"name": "public-share",
"image": OC_LITMUS,
"environment": {
"LITMUS_PASSWORD": "admin",
"LITMUS_USERNAME": "admin",
"TESTS": "basic copymove http",
},
"commands": [
"source .env",
"export LITMUS_URL='https://ocis-server:9200/remote.php/dav/public-files/'$PUBLIC_TOKEN",
litmusCommand,
],
},
{
"name": "spaces-endpoint",
"image": OC_LITMUS,
"environment": environment,
"commands": [
"source .env",
"export LITMUS_URL='https://ocis-server:9200/remote.php/dav/spaces/'$SPACE_ID",
litmusCommand,
],
},
],
"services": redisForOCStorage(storage),
"depends_on": getPipelineNames([buildOcisBinaryForTesting(ctx)]),
"trigger": {
"ref": [
"refs/heads/master",
"refs/tags/v*",
"refs/pull/**",
],
},
}
pipelines.append(result)
return pipelines return pipelines
def setupForLitmus(phpVersion): def setupForLitmus():
return [{ return [{
"name": "setup-for-litmus", "name": "setup-for-litmus",
"image": OC_CI_PHP % phpVersion, "image": OC_UBUNTU,
"environment": { "environment": {
"TEST_SERVER_URL": OCIS_URL, "TEST_SERVER_URL": OCIS_URL,
}, },