From 6cea365f9a7708b72efaeb38548cd707b6740ddf Mon Sep 17 00:00:00 2001 From: ishabaral Date: Mon, 14 Oct 2024 12:21:07 +0545 Subject: [PATCH] remove middleware steps --- .drone.star | 28 +---------- test/gui/config.sample.ini | 1 - test/gui/shared/scripts/bdd_hooks.py | 29 ------------ .../shared/scripts/helpers/ConfigHelper.py | 4 +- test/gui/shared/steps/server_context.py | 47 ------------------- test/gui/tst_syncing/test.feature | 2 +- 6 files changed, 3 insertions(+), 108 deletions(-) diff --git a/.drone.star b/.drone.star index be738ad8e9b..fa7a14c8404 100644 --- a/.drone.star +++ b/.drone.star @@ -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 @@ -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"]) + \ @@ -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", @@ -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", diff --git a/test/gui/config.sample.ini b/test/gui/config.sample.ini index 23dc09f61f7..bfda14b0ada 100644 --- a/test/gui/config.sample.ini +++ b/test/gui/config.sample.ini @@ -1,7 +1,6 @@ [DEFAULT] BACKEND_HOST= SECURE_BACKEND_HOST= -MIDDLEWARE_URL= CLIENT_ROOT_SYNC_PATH= MAX_SYNC_TIMEOUT= MIN_SYNC_TIMEOUT= diff --git a/test/gui/shared/scripts/bdd_hooks.py b/test/gui/shared/scripts/bdd_hooks.py index 588e03b2600..a98123b4fd1 100644 --- a/test/gui/shared/scripts/bdd_hooks.py +++ b/test/gui/shared/scripts/bdd_hooks.py @@ -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 @@ -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 @@ -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") @@ -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") diff --git a/test/gui/shared/scripts/helpers/ConfigHelper.py b/test/gui/shared/scripts/helpers/ConfigHelper.py index 34d3be72515..341bc4241dc 100644 --- a/test/gui/shared/scripts/helpers/ConfigHelper.py +++ b/test/gui/shared/scripts/helpers/ConfigHelper.py @@ -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', @@ -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'), @@ -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 ( diff --git a/test/gui/shared/steps/server_context.py b/test/gui/shared/steps/server_context.py index 45917fecc1b..7daaf4d6eeb 100644 --- a/test/gui/shared/steps/server_context.py +++ b/test/gui/shared/steps/server_context.py @@ -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) diff --git a/test/gui/tst_syncing/test.feature b/test/gui/tst_syncing/test.feature index 76d083e8436..51e52457038 100644 --- a/test/gui/tst_syncing/test.feature +++ b/test/gui/tst_syncing/test.feature @@ -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