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

[test-only][full-ci] Remove middleware steps #11927

Merged
merged 1 commit into from
Oct 15, 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
28 changes: 1 addition & 27 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ OC_CI_NODEJS = "owncloudci/nodejs:18"
OC_CI_PHP = "owncloudci/php:%s"
OC_CI_WAIT_FOR = "owncloudci/wait-for:latest"
OC_OCIS = "owncloud/ocis-rolling:%s"
OC_TEST_MIDDLEWARE = "owncloud/owncloud-test-middleware:1.8.7"
OC_UBUNTU = "owncloud/ubuntu:20.04"

# Eventually, we have to use image built on ubuntu
Expand Down Expand Up @@ -234,7 +233,7 @@ def gui_test_pipeline(ctx):
steps = skipIfUnchanged(ctx, "gui-tests") + \
build_client(OC_CI_SQUISH, False)

services = testMiddlewareService(server)
services = []

if server == "oc10":
steps += installCore(params["version"]) + \
Expand Down Expand Up @@ -329,7 +328,6 @@ def gui_tests(squish_parameters = "", server_type = "oc10"):
"LICENSEKEY": from_secret("SQUISH_LICENSEKEY"),
"GUI_TEST_REPORT_DIR": dir["guiTestReport"],
"CLIENT_REPO": dir["base"],
"MIDDLEWARE_URL": "http://testmiddleware:3000/",
"BACKEND_HOST": "http://owncloud/" if server_type == "oc10" else "https://ocis:9200",
"SECURE_BACKEND_HOST": "https://owncloud/" if server_type == "oc10" else "https://ocis:9200",
"OCIS": "true" if server_type == "ocis" else "false",
Expand Down Expand Up @@ -575,30 +573,6 @@ def owncloudService():
],
}]

def testMiddlewareService(server_type = "oc10"):
environment = {
"NODE_TLS_REJECT_UNAUTHORIZED": "0",
"MIDDLEWARE_HOST": "testmiddleware",
"REMOTE_UPLOAD_DIR": "/uploads",
}

if server_type == "ocis":
environment["BACKEND_HOST"] = "https://ocis:9200"
environment["TEST_WITH_GRAPH_API"] = "true"
environment["RUN_ON_OCIS"] = "true"
else:
environment["BACKEND_HOST"] = "http://owncloud"

return [{
"name": "testmiddleware",
"image": OC_TEST_MIDDLEWARE,
"environment": environment,
"volumes": [{
"name": "uploads",
"path": "/uploads",
}],
}]

def owncloudLog():
return [{
"name": "owncloud-log",
Expand Down
1 change: 0 additions & 1 deletion test/gui/config.sample.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[DEFAULT]
BACKEND_HOST=
SECURE_BACKEND_HOST=
MIDDLEWARE_URL=
CLIENT_ROOT_SYNC_PATH=
MAX_SYNC_TIMEOUT=
MIN_SYNC_TIMEOUT=
Expand Down
29 changes: 0 additions & 29 deletions test/gui/shared/scripts/bdd_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# manual for a complete reference of the available API.
import shutil
import os
from urllib import request, error
from datetime import datetime

from helpers.StacktraceHelper import get_core_dumps, generate_stacktrace
Expand All @@ -33,7 +32,6 @@
is_windows,
is_linux,
)
from helpers.api.utils import url_join
from helpers.FilesHelper import prefix_path_namespace, cleanup_created_paths
from helpers.ReportHelper import save_video_recording, take_screenshot

Expand Down Expand Up @@ -119,19 +117,6 @@ def hook(context):
if not os.path.exists(tmp_dir):
os.makedirs(tmp_dir)

req = request.Request(
url_join(get_config("middlewareUrl"), "init"),
headers={"Content-Type": "application/json"},
method="POST",
)
try:
with request.urlopen(req) as _:
pass
except error.HTTPError as e:
raise ConnectionRefusedError(
"Step execution through test middleware failed. Error: " + e.read().decode()
) from e

# sync connection folder display name
set_config("syncConnectionName", "Personal" if get_config("ocis") else "ownCloud")

Expand Down Expand Up @@ -183,20 +168,6 @@ def hook(context):
elif scenario_failed():
test.log("No coredump found!")

# cleanup test server
req = request.Request(
url_join(get_config("middlewareUrl"), "cleanup"),
headers={"Content-Type": "application/json"},
method="POST",
)
try:
with request.urlopen(req) as _:
pass
except error.HTTPError as e:
raise ConnectionRefusedError(
"Step execution through test middleware failed. Error: " + e.read().decode()
) from e

global PREVIOUS_FAIL_RESULT_COUNT, PREVIOUS_ERROR_RESULT_COUNT
PREVIOUS_FAIL_RESULT_COUNT = test.resultCount("fails")
PREVIOUS_ERROR_RESULT_COUNT = test.resultCount("errors")
Expand Down
4 changes: 1 addition & 3 deletions test/gui/shared/scripts/helpers/ConfigHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def get_default_home_dir():
'maxSyncTimeout': 'MAX_SYNC_TIMEOUT',
'minSyncTimeout': 'MIN_SYNC_TIMEOUT',
'lowestSyncTimeout': 'LOWEST_SYNC_TIMEOUT',
'middlewareUrl': 'MIDDLEWARE_URL',
'clientLogFile': 'CLIENT_LOG_FILE',
'clientRootSyncPath': 'CLIENT_ROOT_SYNC_PATH',
'tempFolderPath': 'TEMP_FOLDER_PATH',
Expand All @@ -93,7 +92,6 @@ def get_default_home_dir():
'maxSyncTimeout': 60,
'minSyncTimeout': 5,
'lowestSyncTimeout': 1,
'middlewareUrl': 'http://localhost:3000/',
'clientLogFile': '-',
'clientRootSyncPath': get_client_root_path(),
'tempFolderPath': os.path.join(get_client_root_path(), 'temp'),
Expand Down Expand Up @@ -147,7 +145,7 @@ def init_config():
for key, value in CONFIG.items():
if key in ('maxSyncTimeout', 'minSyncTimeout'):
CONFIG[key] = builtins.int(value)
elif key in ('localBackendUrl', 'middlewareUrl', 'secureLocalBackendUrl'):
elif key in ('localBackendUrl', 'secureLocalBackendUrl'):
# make sure there is always one trailing slash
CONFIG[key] = value.rstrip('/') + '/'
elif key in (
Expand Down
47 changes: 0 additions & 47 deletions test/gui/shared/steps/server_context.py
Original file line number Diff line number Diff line change
@@ -1,56 +1,9 @@
import urllib.request
import json

from helpers.ConfigHelper import get_config
from helpers.api.utils import url_join
from helpers.api import provisioning, sharing_helper, webdav_helper as webdav
import helpers.api.oc10 as oc

from pageObjects.Toolbar import Toolbar


def execute_step_through_middleware(context, step_name):
body = {'step': step_name}
if hasattr(context, 'table'):
body['table'] = context.table

params = json.dumps(body).encode('utf8')

req = urllib.request.Request(
url_join(get_config('middlewareUrl'), 'execute'),
data=params,
headers={'Content-Type': 'application/json'},
method='POST',
)
try:
with urllib.request.urlopen(req) as _:
pass
except urllib.error.HTTPError as e:
raise RuntimeError(
'Step execution through test middleware failed. Error: ' + e.read().decode()
) from e


@Given(r'^(.*) on the server (.*)$', regexp=True)
def step(context, step_part_1, step_part_2):
execute_step_through_middleware(context, f'Given {step_part_1} {step_part_2}')


@Given(r'^(.*) on the server$', regexp=True)
def step(context, step_part_1):
execute_step_through_middleware(context, f'Given {step_part_1}')


@Then(r'^(.*) on the server (.*)$', regexp=True)
def step(context, step_part_1, step_part_2):
execute_step_through_middleware(context, f'Then {step_part_1} {step_part_2}')


@Then(r'^(.*) on the server$', regexp=True)
def step(context, step_part_1):
execute_step_through_middleware(context, f'Then {step_part_1}')


@Given('app "|any|" has been "|any|" in the server')
def step(context, app_name, action):
oc.setup_app(app_name, action)
Expand Down
2 changes: 1 addition & 1 deletion test/gui/tst_syncing/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ Feature: Syncing files
Given user "Alice" has created folder "simple-folder" in the server
And user "Alice" has uploaded file "testavatar.png" to "simple-folder/testavatar.png" in the server
And user "Alice" has uploaded file "testavatar.jpg" to "simple-folder/testavatar.jpg" in the server
And user "Alice" has uploaded file "testavatar.jpeg" to "simple-folder/testavatar.jpeg" on the server
And user "Alice" has uploaded file "testavatar.jpeg" to "simple-folder/testavatar.jpeg" in the server
And user "Alice" has uploaded file "testimage.mp3" to "simple-folder/testimage.mp3" in the server
And user "Alice" has uploaded file "test_video.mp4" to "simple-folder/test_video.mp4" in the server
And user "Alice" has uploaded file "simple.pdf" to "simple-folder/simple.pdf" in the server
Expand Down
Loading