diff --git a/.github/workflows/check_build.yml b/.github/workflows/check_build.yml new file mode 100644 index 000000000..5f13de013 --- /dev/null +++ b/.github/workflows/check_build.yml @@ -0,0 +1,21 @@ +name: Build EE2 Docker Image + +on: + pull_request + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Build and push + uses: docker/build-push-action@v6 + with: + push: false + tags: ee2/test:test \ No newline at end of file diff --git a/.github/workflows/ee2-tests.yml b/.github/workflows/ee2-tests.yml index 671644388..c8397e641 100644 --- a/.github/workflows/ee2-tests.yml +++ b/.github/workflows/ee2-tests.yml @@ -1,12 +1,6 @@ # This workflow will install Python dependencies, run tests and lint # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -# To ssh into this build add the following: -#- name: Start SSH session -# uses: luchihoratiu/debug-via-ssh@main -# with: -# NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} -# SSH_PASS: ${{ secrets.SSH_PASS }} name: Execution Engine 2 Test Suite @@ -18,7 +12,7 @@ jobs: runs-on: ubuntu-latest name: Lint With Black steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: psf/black@stable with: options: "--check --verbose" @@ -35,11 +29,11 @@ jobs: name: Lint With Flake8 steps: - name: Check out source repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python environment uses: actions/setup-python@v4 with: - python-version: "3.8" + python-version: "3.10.14" - name: flake8 Lint Lib uses: py-actions/flake8@v2 with: @@ -50,22 +44,38 @@ jobs: path: "./test" + Build_and_Run_Tests_and_CodeCov: name: Build and Run Tests and CodeCov runs-on: ubuntu-latest + strategy: + matrix: + mongo-config: + - version: "7.0" + init-path: "./test/dockerfiles/mongo/docker-entrypoint-initdb.d-7.0/" + - version: "3.6" + init-path: "./test/dockerfiles/mongo/docker-entrypoint-initdb.d-3.6/" steps: - name: Check out source repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 + - name: Set up Python environment + uses: actions/setup-python@v5 + with: + python-version: "3.10.14" - name: Install dependencies run: | pip install -r requirements.txt git clone https://github.com/kbase/jars /opt/jars - - name: Build Docker Image + - name: Set MongoDB Version and Init Path run: | - docker build . -t execution_engine2:test - - name: Run Tests + echo "MONGO_VERSION=${{ matrix.mongo-config.version }}" >> $GITHUB_ENV + echo "INIT_PATH=${{ matrix.mongo-config.init-path }}" >> $GITHUB_ENV + - name: Start Services and Run Tests run: | - docker-compose up -d + docker compose up -d cp test/env/test.travis.env test.env make test-coverage - codecov + codecov --token="${{ secrets.CODECOV_TOKEN }}" + - name: Cleanup + run: | + docker compose down diff --git a/Dockerfile b/Dockerfile index baa46f512..76db5f3a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,23 +26,8 @@ RUN curl -o /tmp/dockerize.tgz https://raw.githubusercontent.com/kbase/dockerize rm /tmp/dockerize.tgz -# install mongodb -RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5 \ - && echo "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/3.6 main" | tee /etc/apt/sources.list.d/mongodb-org-3.6.list \ - && apt-get update \ - && apt-get install -y --no-install-recommends mongodb-org=3.6.11 mongodb-org-server=3.6.11 mongodb-org-shell=3.6.11 mongodb-org-mongos=3.6.11 mongodb-org-tools=3.6.11 \ - && apt-get install -y --no-install-recommends mongodb \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -RUN echo "mongodb-org hold" | dpkg --set-selections \ - && echo "mongodb-org-server hold" | dpkg --set-selections \ - && echo "mongodb-org-shell hold" | dpkg --set-selections \ - && echo "mongodb-org-mongos hold" | dpkg --set-selections \ - && echo "mongodb-org-tools hold" | dpkg --set-selections - #Install Python3 and Libraries (source /root/miniconda/bin/activate) -RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh \ +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-py310_24.5.0-0-Linux-x86_64.sh -O ~/miniconda.sh \ && bash ~/miniconda.sh -b -p /miniconda-latest # Setup Cron diff --git a/Makefile b/Makefile index 0e3ad8c5e..3eebfda65 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ setup-database: test-coverage: # Set up travis user in mongo @echo "Run tests for $(TESTS)" - PYTHONPATH=.:lib:test pytest --cov-report=xml --cov lib/execution_engine2/ --verbose $(TESTS) + PYTHONPATH=.:lib:test pytest --cov-report=xml --cov-report=term --cov lib/execution_engine2/ --verbose $(TESTS) build-condor-test-image: cd test/dockerfiles/condor && echo `pwd` && docker build -f Dockerfile . -t $(CONDOR_DOCKER_IMAGE_TAG_NAME) diff --git a/docker-compose.yml b/docker-compose.yml index 46896e28c..92e900828 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,157 +2,160 @@ version: "3.1" services: + # For Local Dev # Requires a ` docker build . -t execution_engine2:test ` # Requires a ` make database ` - ee2: - image: execution_engine2:test - command: - - "-poll" - - "-template" - - "/kb/module/build/templates/condor_config.templ:/etc/condor/condor_config" - - "-template" - - "/kb/module/test/deploy.cfg:/kb/module/deploy.cfg" - - "-timeout" - - "120s" - - "-wait" - - "tcp://mongodb:27017" - - "-stdout" - - "/kb/deployment/jettybase/logs/request.log" - - "./scripts/entrypoint.sh" - entrypoint: [ "dockerize" ] - depends_on: ["mongodb","condor"] - environment: - - POOL_PASSWORD=weakpassword - env_file: test/deploy.cfg - volumes: - - ./:/ee2 +# ee2: +# image: execution_engine2:test +# command: +# - "-poll" +# - "-template" +# - "/kb/module/build/templates/condor_config.templ:/etc/condor/condor_config" +# - "-template" +# - "/kb/module/test/deploy.cfg:/kb/module/deploy.cfg" +# - "-timeout" +# - "120s" +# - "-wait" +# - "tcp://mongodb:27017" +# - "-stdout" +# - "/kb/deployment/jettybase/logs/request.log" +# - "./scripts/entrypoint.sh" +# entrypoint: [ "dockerize" ] +# depends_on: ["mongodb","condor"] +# environment: +# - POOL_PASSWORD=weakpassword +# env_file: test/deploy.cfg +# volumes: +# - ./:/ee2 +# +# ee2_with_ssh: +# image: execution_engine2:test +# command: +# - "-poll" +# - "-template" +# - "/kb/module/build/templates/condor_config.templ:/etc/condor/condor_config" +# - "-template" +# - "/kb/module/build/templates/deploy.docker.cfg.templ:/kb/module/deploy.cfg" +# - "-timeout" +# - "120s" +# - "-wait" +# - "tcp://mongodb:27017" +# - "-stdout" +# - "/kb/deployment/jettybase/logs/request.log" +# - "./scripts/entrypoint.sh" +# entrypoint: [ "dockerize" ] +# depends_on: ["mongodb","condor"] +# environment: +# - POOL_PASSWORD=weakpassword +# - LOCAL_DEV=1 +# - KB_DEPLOYMENT_CONFIG=/kb/module/deploy.cfg +# env_file: test/deploy.cfg +# ports: ["23:22","5678:5678"] +# volumes: +# - ./:/ee2 +# - /Users:/Users - ee2_with_ssh: - image: execution_engine2:test - command: - - "-poll" - - "-template" - - "/kb/module/build/templates/condor_config.templ:/etc/condor/condor_config" - - "-template" - - "/kb/module/build/templates/deploy.docker.cfg.templ:/kb/module/deploy.cfg" - - "-timeout" - - "120s" - - "-wait" - - "tcp://mongodb:27017" - - "-stdout" - - "/kb/deployment/jettybase/logs/request.log" - - "./scripts/entrypoint.sh" - entrypoint: [ "dockerize" ] - depends_on: ["mongodb","condor"] - environment: - - POOL_PASSWORD=weakpassword - - LOCAL_DEV=1 - - KB_DEPLOYMENT_CONFIG=/kb/module/deploy.cfg - env_file: test/deploy.cfg - ports: ["23:22","5678:5678"] - volumes: - - ./:/ee2 - - /Users:/Users + # condor_worker_mini: + # privileged: true + # image: kbase/condor-worker:develop + # hostname: condor_worker_mini + # command: + # - "-poll" + # - "-template" + # - "/kb/deployment/conf/.templates/condor_config_worker.templ:/etc/condor/condor_config.local" + # - "-template" + # - "/kb/deployment/conf/.templates/shared_port_config.templ:/etc/condor/config.d/shared_port_config" + # - "-timeout" + # - "120s" + # - "-stdout" + # - "/var/log/condor/ProcLog" + # - "-stdout" + # - "/var/log/condor/StartLog" + # - "/kb/deployment/bin/start-condor.sh" + # depends_on: ["condor"] + # environment: + # - POOL_PASSWORD=weakpassword + # - COLLECTOR_HOST=condor:9618?sock=collector + # - USE_TCP=True + # - EXECUTE_SUFFIX=mini_kb + # volumes: + # - /var/run/docker.sock:/var/run/docker.sock + # - /sys/fs/cgroup:/sys/fs/cgroup - condor_worker_mini: - privileged: true - image: kbase/condor-worker:develop - hostname: condor_worker_mini - command: - - "-poll" - - "-template" - - "/kb/deployment/conf/.templates/condor_config_worker.templ:/etc/condor/condor_config.local" - - "-template" - - "/kb/deployment/conf/.templates/shared_port_config.templ:/etc/condor/config.d/shared_port_config" - - "-timeout" - - "120s" - - "-stdout" - - "/var/log/condor/ProcLog" - - "-stdout" - - "/var/log/condor/StartLog" - - "/kb/deployment/bin/start-condor.sh" - depends_on: ["condor"] - environment: - - POOL_PASSWORD=weakpassword - - COLLECTOR_HOST=condor:9618?sock=collector - - USE_TCP=True - - EXECUTE_SUFFIX=mini_kb - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - /sys/fs/cgroup:/sys/fs/cgroup + # condor: + # image: kbase/condor:develop + # hostname: condor + # environment: + # - POOL_PASSWORD=weakpassword + # - USE_TCP=True + # ports: + # - "9618:9618" + # entrypoint: + # - "/usr/bin/dockerize" + # command: + # - "-poll" + # - "-template" + # - "/etc/condor/.templates/condor_config.local.templ:/etc/condor/condor_config.local" + # - "-stdout" + # - "/var/log/condor/MasterLog" + # - "-stdout" + # - "/var/log/condor/SchedLog" + # - "/usr/sbin/start-condor.sh" + # volumes: + # - ./condor_shared/:/condor_shared/ + # - ./condor_shared/cdr/:/cdr/ - condor: - image: kbase/condor:develop - hostname: condor - environment: - - POOL_PASSWORD=weakpassword - - USE_TCP=True - ports: - - "9618:9618" - entrypoint: - - "/usr/bin/dockerize" - command: - - "-poll" - - "-template" - - "/etc/condor/.templates/condor_config.local.templ:/etc/condor/condor_config.local" - - "-stdout" - - "/var/log/condor/MasterLog" - - "-stdout" - - "/var/log/condor/SchedLog" - - "/usr/sbin/start-condor.sh" - volumes: - - ./condor_shared/:/condor_shared/ - - ./condor_shared/cdr/:/cdr/ + # manager: + # image: kafkamanager/kafka-manager + # hostname: manager + # ports: + # - "0.0.0.0:9000:9000" + # depends_on: + # - zookeeper + # environment: + # ZK_HOSTS: zookeeper - manager: - image: kafkamanager/kafka-manager - hostname: manager - ports: - - "0.0.0.0:9000:9000" - depends_on: - - zookeeper - environment: - ZK_HOSTS: zookeeper + # kafka: + # image: confluentinc/cp-kafka:5.0.0 + # hostname: kafka + # ports: + # - "0.0.0.0:9092:9092" + # depends_on: + # - zookeeper + # environment: + # KAFKA_BROKER_ID: 1 + # KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + # KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092 + # KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + # KAFKA_HEAP_OPTS: -Xmx512m -Xms512m - kafka: - image: confluentinc/cp-kafka:5.0.0 - hostname: kafka - ports: - - "0.0.0.0:9092:9092" - depends_on: - - zookeeper - environment: - KAFKA_BROKER_ID: 1 - KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 - KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092 - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 - KAFKA_HEAP_OPTS: -Xmx512m -Xms512m + # # Required for kafka + # zookeeper: + # image: confluentinc/cp-zookeeper:latest + # hostname: zookeeper + # ports: + # - "0.0.0.0:2181:2181" + # environment: + # ZOOKEEPER_SERVER_ID: 1 + # ZOOKEEPER_CLIENT_PORT: 2181 + # ZOOKEEPER_TICK_TIME: 2000 + # ZOOKEEPER_INIT_LIMIT: 5 + # ZOOKEEPER_SYNC_LIMIT: 2docker-compose rm + # ZOOKEEPER_SERVERS: zookeeper:12888:13888 - # Required for kafka - zookeeper: - image: confluentinc/cp-zookeeper:latest - hostname: zookeeper - ports: - - "0.0.0.0:2181:2181" - environment: - ZOOKEEPER_SERVER_ID: 1 - ZOOKEEPER_CLIENT_PORT: 2181 - ZOOKEEPER_TICK_TIME: 2000 - ZOOKEEPER_INIT_LIMIT: 5 - ZOOKEEPER_SYNC_LIMIT: 2docker-compose rm - ZOOKEEPER_SERVERS: zookeeper:12888:13888 mongodb: - image: mongo:3.2 + image: mongo:${MONGO_VERSION:-7.0} # Use 7.0 as the default if MONGO_VERSION is not set environment: - # provide your credentials here - MONGO_INITDB_ROOT_USERNAME=travis - MONGO_INITDB_ROOT_PASSWORD=travis - MONGO_INITDB_DATABASE=ee2 - ports: ["27018:27017","27017:27017"] + ports: + - "27018:27017" + - "27017:27017" volumes: - - "./test/dockerfiles/mongo/docker-entrypoint-initdb.d/:/docker-entrypoint-initdb.d/" + - ${INIT_PATH:-./test/dockerfiles/mongo/docker-entrypoint-initdb.d-7.0/}:/docker-entrypoint-initdb.d/ diff --git a/lib/execution_engine2/sdk/EE2Runjob.py b/lib/execution_engine2/sdk/EE2Runjob.py index 5a7a8a635..745788eab 100644 --- a/lib/execution_engine2/sdk/EE2Runjob.py +++ b/lib/execution_engine2/sdk/EE2Runjob.py @@ -483,10 +483,10 @@ def run_batch( :return: A list of condor job ids or a failure notification """ - if type(params) != list: + if not isinstance(params, list): raise IncorrectParamsException("params must be a list") - if type(batch_params) != dict: + if not isinstance(batch_params, dict): raise IncorrectParamsException("batch params must be a mapping") wsid = batch_params.get(_WORKSPACE_ID) @@ -586,7 +586,7 @@ def _check_job_requirements_vs_admin( def _check_is_string(self, putative_str, name): if not putative_str: return None - if type(putative_str) != str: + if not isinstance(putative_str, str): raise IncorrectParamsException(f"{name} must be a string") return putative_str @@ -924,7 +924,7 @@ def run( """ # TODO Test this - if type(params) != dict: + if not isinstance(params, dict): raise IncorrectParamsException("params must be a mapping") self._preflight(runjob_params=params, as_admin=as_admin) @@ -949,10 +949,10 @@ def _get_job_reqs_from_concierge_params( rl = concierge_params.get(_REQUIREMENTS_LIST) schd_reqs = {} if rl: - if type(rl) != list: + if not isinstance(rl, list): raise IncorrectParamsException(f"{_REQUIREMENTS_LIST} must be a list") for s in rl: - if type(s) != str or "=" not in s: + if not isinstance(s, str) or "=" not in s: raise IncorrectParamsException( f"Found illegal requirement in {_REQUIREMENTS_LIST}: {s}" ) diff --git a/lib/execution_engine2/sdk/job_submission_parameters.py b/lib/execution_engine2/sdk/job_submission_parameters.py index 90bc58d73..6408f3108 100644 --- a/lib/execution_engine2/sdk/job_submission_parameters.py +++ b/lib/execution_engine2/sdk/job_submission_parameters.py @@ -124,9 +124,11 @@ def check_parameters( client_group, None if client_group_regex is None else bool(client_group_regex), _check_string(bill_to_user, "bill_to_user", optional=True), - None - if ignore_concurrency_limits is None - else bool(ignore_concurrency_limits), + ( + None + if ignore_concurrency_limits is None + else bool(ignore_concurrency_limits) + ), cls._check_scheduler_requirements(scheduler_requirements), None if debug_mode is None else bool(debug_mode), ) @@ -145,7 +147,7 @@ def _params(self): ) def __eq__(self, other): - if type(self) == type(other): + if type(self) == type(other): # noqa E721 return self._params() == ( other.cpus, other.memory_MB, @@ -214,7 +216,7 @@ def __init__( ) self.wsid = _gt_zero(wsid, "wsid", optional=True) source_ws_objects = source_ws_objects if source_ws_objects else [] - if type(source_ws_objects) != list: + if not isinstance(source_ws_objects, list): raise IncorrectParamsException("source_ws_objects must be a list") for i, ref in enumerate(source_ws_objects): upa, is_valid = _is_valid_UPA(ref) @@ -238,7 +240,7 @@ def _params(self): ) def __eq__(self, other): - if type(self) == type(other): + if type(self) == type(other): # noqa E721 return self._params() == ( other.job_id, other.app_info, diff --git a/lib/execution_engine2/utils/application_info.py b/lib/execution_engine2/utils/application_info.py index 5ebc6d02d..ce81e41c5 100644 --- a/lib/execution_engine2/utils/application_info.py +++ b/lib/execution_engine2/utils/application_info.py @@ -116,7 +116,7 @@ def get_application_id(self) -> str: return self.application_module def __eq__(self, other): - if type(self) == type(other): + if type(self) == type(other): # noqa E721 return ( self.module, self.method, diff --git a/lib/execution_engine2/utils/job_requirements_resolver.py b/lib/execution_engine2/utils/job_requirements_resolver.py index c0f17cdc6..92c753088 100644 --- a/lib/execution_engine2/utils/job_requirements_resolver.py +++ b/lib/execution_engine2/utils/job_requirements_resolver.py @@ -77,13 +77,13 @@ def _check_clientgroup(clientgroup, source): def _string_request(putative_string, name, source): - if type(putative_string) != str: + if not isinstance(putative_string, str): _check_raise(name, putative_string, source) return putative_string.strip() def _int_request(putative_int, original, name, source): - if type(putative_int) == float: + if isinstance(putative_int, float): _check_raise(f"{name} request", original, source) try: return int(putative_int) @@ -96,7 +96,7 @@ def _check_cpus(cpus, source): def _check_memory(memory, source): - if type(memory) == int: + if isinstance(memory, int): return memory memory2 = _string_request(memory, "memory request", source) if memory2.endswith("M"): @@ -107,7 +107,7 @@ def _check_memory(memory, source): def _check_disk(disk, source): - if type(disk) == int: + if isinstance(disk, int): return disk disk2 = _string_request(disk, "disk request", source) if disk2.endswith("GB"): @@ -116,7 +116,7 @@ def _check_disk(disk, source): def _bool_request(putative_bool, name, source): - if type(putative_bool) == bool or type(putative_bool) == int: + if isinstance(putative_bool, bool) or isinstance(putative_bool, int): return bool(putative_bool) pbs = _string_request(putative_bool, name, source).lower() if pbs == "true": @@ -347,7 +347,7 @@ def normalize_job_reqs( def _has_value(cls, inc): if inc is None: return False - if type(inc) == str and not inc.strip(): + if isinstance(inc, str) and not inc.strip(): return False return True diff --git a/lib/execution_engine2/utils/user_info.py b/lib/execution_engine2/utils/user_info.py index 1a7a4e10f..d1a2cbfba 100644 --- a/lib/execution_engine2/utils/user_info.py +++ b/lib/execution_engine2/utils/user_info.py @@ -28,7 +28,7 @@ def __init__(self, username: str, token: str): self.token = _check_string(token, "token") def __eq__(self, other): - if type(self) == type(other): + if type(self) == type(other): # noqa E721 return (self.username, self.token) == (other.username, other.token) return False diff --git a/requirements.txt b/requirements.txt index be905f7b1..c5b928b43 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,17 +7,16 @@ configparser==5.0.2 confluent-kafka==1.9.2 coverage==5.5 docker==5.0.0 -gevent==21.12.0 -greenlet==1.1.0 +gevent==24.2.1 ; python_version >= "3.10" and python_version < "4.0" gunicorn==20.1.0 -htcondor==9.12.0 +htcondor==23.8.1 Jinja2==3.0.1 JSONRPCBase==0.2.0 mock==4.0.3 maps==5.1.1 -mongoengine==0.23.1 +mongoengine==0.28.2 psutil==5.8.0 -pymongo==3.12.0 +pymongo==4.8.0 pytest==6.2.4 pytest-cov==2.12.1 python-dateutil==2.8.2 diff --git a/test/dockerfiles/mongo/docker-entrypoint-initdb.d/mongo-init.js b/test/dockerfiles/mongo/docker-entrypoint-initdb.d-3.6/mongo-init.js similarity index 82% rename from test/dockerfiles/mongo/docker-entrypoint-initdb.d/mongo-init.js rename to test/dockerfiles/mongo/docker-entrypoint-initdb.d-3.6/mongo-init.js index 9a9ec8bf6..c9e30a380 100755 --- a/test/dockerfiles/mongo/docker-entrypoint-initdb.d/mongo-init.js +++ b/test/dockerfiles/mongo/docker-entrypoint-initdb.d-3.6/mongo-init.js @@ -1,7 +1,6 @@ +print("Adding travis username to ee2 database for mongo 3.6") db.auth('travis', 'travis') - db = db.getSiblingDB('ee2') - db.createUser( { user: "travis", diff --git a/test/dockerfiles/mongo/docker-entrypoint-initdb.d-7.0/mongo-init.js b/test/dockerfiles/mongo/docker-entrypoint-initdb.d-7.0/mongo-init.js new file mode 100755 index 000000000..729808929 --- /dev/null +++ b/test/dockerfiles/mongo/docker-entrypoint-initdb.d-7.0/mongo-init.js @@ -0,0 +1,14 @@ +print("Adding travis username to ee2 database for mongo 7.0") +db = db.getSiblingDB('ee2') +db.createUser( + { + user: "travis", + pwd: "travis", + roles: [ + { + role: "dbOwner", + db: "ee2" + } + ] + } +); \ No newline at end of file diff --git a/test/tests_for_auth/ee2_admin_mode_test.py b/test/tests_for_auth/ee2_admin_mode_test.py index 15ee0682a..b12c30e06 100644 --- a/test/tests_for_auth/ee2_admin_mode_test.py +++ b/test/tests_for_auth/ee2_admin_mode_test.py @@ -287,12 +287,14 @@ def test_no_user(self): runner = self.getRunner() method_1 = "module_name.function_name" job_params_1 = get_sample_job_params(method=method_1, wsid=self.ws_id) - + error_regex = ( + r"\('An error occurred while fetching user permissions from the Workspace', " + r"ServerError\('Token validation failed: Auth service returned an error: 10020 Invalid token'\)\)" + ) with self.assertRaisesRegex( - expected_exception=RuntimeError, - expected_regex=r"ServerError\('Token validation failed: Login failed! Server responded with code 401 Unauthorized'\)", + expected_exception=RuntimeError, expected_regex=error_regex ): - runner.run_job(params=job_params_1, as_admin=False) + runner.run_job(params=job_params_1) def test_admin_reader(self): # Admin User with READ