Skip to content

Commit

Permalink
Tests: adapt code to new tests location
Browse files Browse the repository at this point in the history
  • Loading branch information
Radu Carpa authored and bari12 committed Jul 21, 2023
1 parent f61d2ab commit 84a71c3
Show file tree
Hide file tree
Showing 41 changed files with 75 additions and 62 deletions.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@
# Testing
/.github/ @maany
/etc/docker/test/ @maany
/lib/rucio/tests/conftest.py @maany
/lib/rucio/tests/ruciopytest/ @maany
/tests/conftest.py @maany
/tests/ruciopytest/ @maany
/tools/github/ @maany
/tools/test/ @maany

Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,28 +126,28 @@ jobs:
docker exec -t dev_rucio_1 cp etc/rse-accounts.cfg.template etc/rse-accounts.cfg
docker exec -t dev_rucio_1 tools/run_tests_docker.sh -ir
- name: File Upload/Download Test
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short test_rucio_server.py
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short tests/test_rucio_server.py
- name: UploadClient Test
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short test_upload.py
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short tests/test_upload.py
- name: File Upload/Download Test using 'impl' parameter
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short test_impl_upload_download.py
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short tests/test_impl_upload_download.py
- name: Test gfal2 implementation on xrootd protocol
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short test_rse_protocol_gfal2_impl.py
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short tests/test_rse_protocol_gfal2_impl.py
- name: Test Protocol XrootD
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short test_rse_protocol_xrootd.py
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short tests/test_rse_protocol_xrootd.py
- name: Test Protocol SSH (scp)
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short test_rse_protocol_ssh.py
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short tests/test_rse_protocol_ssh.py
- name: Test Protocol Rsync
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short test_rse_protocol_rsync.py
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short tests/test_rse_protocol_rsync.py
- name: Test Protocol Rclone
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short test_rse_protocol_rclone.py
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short tests/test_rse_protocol_rclone.py
- name: Test Conveyor
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short test_conveyor.py
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short tests/test_conveyor.py
- name: Execute transfer and export FTS transfer details
id: tpc
shell: bash
run: |
docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short --export-artifacts-from="test_tpc" test_tpc.py
docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short --export-artifacts-from="test_tpc" tests/test_tpc.py
FTS_LOG_FILE=$(docker exec -t dev_rucio_1 cat /tmp/test_tpc.artifact)
echo "::set-output name=fts3log::$FTS_LOG_FILE"
- name: Verify TPC transfers from FTS logs
Expand All @@ -167,10 +167,10 @@ jobs:
run: |
docker exec -t dev_rucio_1 cat /var/log/rucio/httpd_error_log
- name: Archive Upload/Download Test
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short test_download.py::test_download_from_archive_on_xrd
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short tests/test_download.py::test_download_from_archive_on_xrd
- name: Test external metadata plugin (mongo)
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short test_did_meta_plugins.py::TestDidMetaMongo
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short tests/test_did_meta_plugins.py::TestDidMetaMongo
- name: Test external metadata plugin (postgres)
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short test_did_meta_plugins.py::TestDidMetaExternalPostgresJSON
run: docker exec -t dev_rucio_1 tools/pytest.sh -v --tb=short tests/test_did_meta_plugins.py::TestDidMetaExternalPostgresJSON
- name: Stop containers
run: docker-compose -f $GITHUB_WORKSPACE/dev/rucio/etc/docker/dev/docker-compose-storage-externalmetadata.yml down
6 changes: 3 additions & 3 deletions etc/docker/dev/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ To verify that everything is in order, you can now either run the full unit test
Alternatively, you can bootstrap the test environment once with the `-i` option and then selectively or repeatedly run test case modules, test case groups, or even single test cases, for example::

tools/run_tests_docker.sh -i
tools/pytest.sh test_replica.py
tools/pytest.sh -vvv test_replica.py::TestReplicaCore
tools/pytest.sh -vvv --full-trace test_replica.py::TestReplicaCore::test_delete_replicas_from_datasets
tools/pytest.sh tests/test_replica.py
tools/pytest.sh -vvv tests/test_replica.py::TestReplicaCore
tools/pytest.sh -vvv --full-trace tests/test_replica.py::TestReplicaCore::test_delete_replicas

Using the environment including storage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 2 additions & 0 deletions etc/docker/dev/docker-compose-storage-alldb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ services:
- ../../../tools:/opt/rucio/tools:Z
- ../../../bin:/opt/rucio/bin:Z
- ../../../lib:/opt/rucio/lib:Z
- ../../../tests:/opt/rucio/tests:Z
environment:
- X509_USER_CERT=/opt/rucio/etc/usercert.pem
- X509_USER_KEY=/opt/rucio/etc/userkey.pem
Expand All @@ -35,6 +36,7 @@ services:
- ../../../tools:/opt/rucio/tools:Z
- ../../../bin:/opt/rucio/bin:Z
- ../../../lib:/opt/rucio/lib:Z
- ../../../tests:/opt/rucio/tests:Z
environment:
- X509_USER_CERT=/opt/rucio/etc/usercert.pem
- X509_USER_KEY=/opt/rucio/etc/userkey.pem
Expand Down
2 changes: 2 additions & 0 deletions etc/docker/dev/docker-compose-storage-externalmetadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ services:
- ../../../tools:/opt/rucio/tools:Z
- ../../../bin:/opt/rucio/bin:Z
- ../../../lib:/opt/rucio/lib:Z
- ../../../tests:/opt/rucio/tests:Z
environment:
- X509_USER_CERT=/opt/rucio/etc/usercert.pem
- X509_USER_KEY=/opt/rucio/etc/userkey.pem
Expand All @@ -35,6 +36,7 @@ services:
- ../../../tools:/opt/rucio/tools:Z
- ../../../bin:/opt/rucio/bin:Z
- ../../../lib:/opt/rucio/lib:Z
- ../../../tests:/opt/rucio/tests:Z
environment:
- X509_USER_CERT=/opt/rucio/etc/usercert.pem
- X509_USER_KEY=/opt/rucio/etc/userkey.pem
Expand Down
2 changes: 2 additions & 0 deletions etc/docker/dev/docker-compose-storage-monit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ services:
- ../../../tools:/opt/rucio/tools:Z
- ../../../bin:/opt/rucio/bin:Z
- ../../../lib:/opt/rucio/lib:Z
- ../../../tests:/opt/rucio/tests:Z
environment:
- X509_USER_CERT=/opt/rucio/etc/usercert.pem
- X509_USER_KEY=/opt/rucio/etc/userkey.pem
Expand All @@ -35,6 +36,7 @@ services:
- ../../../tools:/opt/rucio/tools:Z
- ../../../bin:/opt/rucio/bin:Z
- ../../../lib:/opt/rucio/lib:Z
- ../../../tests:/opt/rucio/tests:Z
environment:
- X509_USER_CERT=/opt/rucio/etc/usercert.pem
- X509_USER_KEY=/opt/rucio/etc/userkey.pem
Expand Down
2 changes: 2 additions & 0 deletions etc/docker/dev/docker-compose-storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ services:
- ../../../tools:/opt/rucio/tools:Z
- ../../../bin:/opt/rucio/bin:Z
- ../../../lib:/opt/rucio/lib:Z
- ../../../tests:/opt/rucio/tests:Z
environment:
- X509_USER_CERT=/opt/rucio/etc/usercert.pem
- X509_USER_KEY=/opt/rucio/etc/userkey.pem
Expand All @@ -35,6 +36,7 @@ services:
- ../../../tools:/opt/rucio/tools:Z
- ../../../bin:/opt/rucio/bin:Z
- ../../../lib:/opt/rucio/lib:Z
- ../../../tests:/opt/rucio/tests:Z
environment:
- X509_USER_CERT=/opt/rucio/etc/usercert.pem
- X509_USER_KEY=/opt/rucio/etc/userkey.pem
Expand Down
2 changes: 2 additions & 0 deletions etc/docker/dev/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ services:
- ../../../tools:/opt/rucio/tools:Z
- ../../../bin:/opt/rucio/bin:Z
- ../../../lib:/opt/rucio/lib:Z
- ../../../tests:/opt/rucio/tests:Z
environment:
- X509_USER_CERT=/opt/rucio/etc/usercert.pem
- X509_USER_KEY=/opt/rucio/etc/userkey.pem
Expand All @@ -35,6 +36,7 @@ services:
- ../../../tools:/opt/rucio/tools:Z
- ../../../bin:/opt/rucio/bin:Z
- ../../../lib:/opt/rucio/lib:Z
- ../../../tests:/opt/rucio/tests:Z
environment:
- X509_USER_CERT=/opt/rucio/etc/usercert.pem
- X509_USER_KEY=/opt/rucio/etc/userkey.pem
Expand Down
3 changes: 2 additions & 1 deletion etc/docker/test/alma9.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ FROM python as rucio-runtime
COPY bin bin
COPY lib lib
COPY etc etc
COPY tests tests
COPY .flake8 .pep8 .pycodestyle pylintrc setup.py setup_rucio.py setup_rucio_client.py setup_webui.py requirements.txt setuputil.py ./

RUN dnf install -y epel-release.noarch && \
Expand Down Expand Up @@ -164,7 +165,7 @@ FROM rucio-runtime as final
COPY --from=mod_wsgi /etc/httpd/conf.modules.d/05-wsgi-python.conf /etc/httpd/conf.modules.d/05-wsgi-python.conf

WORKDIR /opt/rucio
RUN cp -r /usr/local/src/rucio/{lib,bin,tools,etc} ./
RUN cp -r /usr/local/src/rucio/{lib,bin,tools,etc,tests} ./

RUN ldconfig

Expand Down
3 changes: 2 additions & 1 deletion etc/docker/test/fedora35.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ COPY .flake8 .pep8 .pycodestyle pylintrc setuputil.py setup.py setup_rucio.py se
COPY tools tools
COPY bin bin
COPY lib lib
COPY tests tests

# Install Rucio server + dependencies
RUN python -m pip --no-cache-dir install --upgrade .[oracle,postgresql,mysql,kerberos,dev,saml] && \
python -m pip list

WORKDIR /opt/rucio
RUN cp -r /usr/local/src/rucio/{lib,bin,tools,etc} ./
RUN cp -r /usr/local/src/rucio/{lib,bin,tools,etc,tests} ./

CMD ["httpd","-D","FOREGROUND"]
2 changes: 1 addition & 1 deletion lib/rucio/tests/common_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from rucio.core.vo import map_vo
from rucio.db.sqla import models
from rucio.db.sqla.session import transactional_session, get_session
from rucio.tests.common import get_long_vo
from .common import get_long_vo


# Functions containing server-only includes that can't be included in client tests
Expand Down
3 changes: 1 addition & 2 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"lib"
],
"exclude": [
"lib/rucio/db",
"lib/rucio/tests",
"lib/rucio/db"
],
"pythonVersion": "3.10",
"typeCheckingMode": "basic",
Expand Down
8 changes: 4 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def containerized_rses(rucio_client):

@pytest.fixture
def rse_factory(request, vo, function_scope_prefix):
from rucio.tests.temp_factories import TemporaryRSEFactory
from .temp_factories import TemporaryRSEFactory

session = None
if 'db_session' in request.fixturenames:
Expand All @@ -282,7 +282,7 @@ def rse_factory_unittest(request, vo, class_scope_prefix):
"""
unittest classes can get access to rse_factory fixture via this fixture
"""
from rucio.tests.temp_factories import TemporaryRSEFactory
from .temp_factories import TemporaryRSEFactory

with TemporaryRSEFactory(vo=vo, name_prefix=class_scope_prefix) as factory:
request.cls.rse_factory = factory
Expand All @@ -291,7 +291,7 @@ def rse_factory_unittest(request, vo, class_scope_prefix):

@pytest.fixture
def did_factory(request, vo, mock_scope, function_scope_prefix, file_factory, root_account):
from rucio.tests.temp_factories import TemporaryDidFactory
from .temp_factories import TemporaryDidFactory

session = None
if 'db_session' in request.fixturenames:
Expand All @@ -304,7 +304,7 @@ def did_factory(request, vo, mock_scope, function_scope_prefix, file_factory, ro

@pytest.fixture
def file_factory(tmp_path_factory):
from rucio.tests.temp_factories import TemporaryFileFactory
from .temp_factories import TemporaryFileFactory

with TemporaryFileFactory(pytest_path_factory=tmp_path_factory) as factory:
yield factory
Expand Down
2 changes: 1 addition & 1 deletion tests/ruciopytest/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def pytest_configure(config):
'noparallel(reason): marks test being unable to run in parallel to other tests, i.e. changing global state',
)
if config.pluginmanager.hasplugin('xdist'):
from rucio.tests.ruciopytest.rucioxdist import NoParallelXDist
from .rucioxdist import NoParallelXDist

config.pluginmanager.register(NoParallelXDist(config))

Expand Down
2 changes: 1 addition & 1 deletion tests/test_bb8.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from rucio.daemons.judge.evaluator import re_evaluator
from rucio.daemons.undertaker import undertaker
from rucio.db.sqla.constants import RuleState
from rucio.tests.test_rule import create_files, tag_generator
from .test_rule import create_files, tag_generator


@pytest.mark.noparallel(reason='uses daemons')
Expand Down
2 changes: 1 addition & 1 deletion tests/test_bin_rucio.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def setup_obj(self, vo, function_scope_prefix):
self.account_client = AccountLimitClient()
rse_factory = None
if environ.get('SUITE', 'remote_dbs') != 'client':
from rucio.tests.temp_factories import TemporaryRSEFactory
from .temp_factories import TemporaryRSEFactory

rse_factory = TemporaryRSEFactory(vo=vo, name_prefix=function_scope_prefix)
self.def_rse, self.def_rse_id = rse_factory.make_posix_rse()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from rucio.common import dumper
from rucio.tests.common import make_temp_file
from rucio.tests.common import mock_open
from rucio.tests.mocks import gfal2
from .mocks import gfal2

DATE_SECONDS = "2015-03-10 14:00:35"
DATE_TENTHS = "2015-03-10T14:00:35.5"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_judge_cleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from rucio.daemons.judge.cleaner import rule_cleaner
from rucio.db.sqla.constants import DIDType
from rucio.tests.common_server import get_vo
from rucio.tests.test_rule import create_files, tag_generator
from .test_rule import create_files, tag_generator


@pytest.fixture(scope="class")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_judge_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
from rucio.db.sqla.session import transactional_session
from rucio.tests.common import RSE_namedtuple
from rucio.tests.common_server import get_vo
from rucio.tests.test_rule import create_files, tag_generator
from .test_rule import create_files, tag_generator

from typing import TYPE_CHECKING
if TYPE_CHECKING:
from rucio.tests.temp_factories import TemporaryDidFactory, TemporaryRSEFactory
from .temp_factories import TemporaryDidFactory, TemporaryRSEFactory


@pytest.fixture(scope="class")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_judge_injector.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from rucio.db.sqla.models import ReplicationRule
from rucio.db.sqla.session import transactional_session
from rucio.tests.common_server import get_vo
from rucio.tests.test_rule import create_files, tag_generator
from .test_rule import create_files, tag_generator


@pytest.fixture(scope="class")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_judge_repairer.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from rucio.db.sqla.session import get_session
from rucio.tests.common import rse_name_generator, did_name_generator
from rucio.tests.common_server import get_vo
from rucio.tests.test_rule import create_files, tag_generator
from .test_rule import create_files, tag_generator


@pytest.fixture(scope="class")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_multi_vo.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
from rucio.daemons.automatix.automatix import automatix
from rucio.db.sqla import models, session as db_session
from rucio.tests.common import execute, headers, hdrdict, vohdr, auth, loginhdr, get_long_vo
from rucio.tests.test_authentication import PRIVATE_KEY, PUBLIC_KEY
from rucio.tests.test_oidc import get_mock_oidc_client, NEW_TOKEN_DICT
from .test_authentication import PRIVATE_KEY, PUBLIC_KEY
from .test_oidc import get_mock_oidc_client, NEW_TOKEN_DICT

LOG = getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_replica.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

from typing import TYPE_CHECKING
if TYPE_CHECKING:
from rucio.tests.temp_factories import TemporaryRSEFactory
from .temp_factories import TemporaryRSEFactory


def mocked_VP_requests_get(*args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_replica_sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from rucio.core.replica import add_replicas, delete_replicas
from rucio.core.rse import add_rse, del_rse, add_rse_attribute, add_protocol, del_rse_attribute
from rucio.tests.common import rse_name_generator, headers, auth, vohdr, Mime, accept
from rucio.tests.inputs import GEOIP_LITE2_CITY_TEST_DB
from .inputs import GEOIP_LITE2_CITY_TEST_DB

LOCATION_TO_IP = {
'Switzerland': '2a02:d000::1',
Expand Down
2 changes: 1 addition & 1 deletion tests/test_rse.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from rucio.db.sqla.constants import RSEType, DIDType
from rucio.rse import rsemanager as mgr
from rucio.tests.common import rse_name_generator, hdrdict, auth, headers, did_name_generator
from rucio.tests.test_rule import create_files
from .test_rule import create_files


class TestRSECoreApi:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_rse_lfn2path.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def test_module_load(self):
"""LFN2PFN: Test ability to provide LFN2PFN functions via module (Success)"""
if not config.config_has_section('policy'):
config.config_add_section('policy')
config.config_set('policy', 'lfn2pfn_module', 'rucio.tests.lfn2pfn_module_test')
config.config_set('policy', 'lfn2pfn_module', 'tests.lfn2pfn_module_test')
RSEDeterministicTranslation._module_init_() # pylint: disable=protected-access
translator = RSEDeterministicTranslation(
rse=self.rse,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_rse_protocol_gfal2.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from rucio.common.utils import execute
from rucio.rse import rsemanager as mgr
from rucio.tests.common import skip_rse_tests_with_accounts, load_test_conf_file
from rucio.tests.rsemgr_api_test import MgrTestCases
from .rsemgr_api_test import MgrTestCases


@skip_rse_tests_with_accounts
Expand Down
2 changes: 1 addition & 1 deletion tests/test_rse_protocol_gfal2_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from rucio.common.utils import execute
from rucio.rse import rsemanager
from rucio.tests.common import skip_rse_tests_with_accounts, load_test_conf_file
from rucio.tests.rsemgr_api_test import MgrTestCases
from .rsemgr_api_test import MgrTestCases


@pytest.mark.noparallel(reason='creates and removes a test directory with a fixed name')
Expand Down
2 changes: 1 addition & 1 deletion tests/test_rse_protocol_posix.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from rucio.rse import rsemanager as mgr
from rucio.tests.common import skip_rse_tests_with_accounts, load_test_conf_file
from rucio.tests.rsemgr_api_test import MgrTestCases
from .rsemgr_api_test import MgrTestCases


def setup_posix_test_env(rse_name, rse_settings, user):
Expand Down
Loading

0 comments on commit 84a71c3

Please sign in to comment.