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

Make CI tests not fail #535

Merged
merged 10 commits into from
Jan 9, 2024
41 changes: 24 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

js-unit-tests:

runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
Expand All @@ -38,12 +38,14 @@ jobs:

build:

runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Use Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Build
working-directory: ./src
run: ./setup.py bdist_wheel
Expand All @@ -56,7 +58,7 @@ jobs:

django-unit-tests:

runs-on: ubuntu-latest
runs-on: ubuntu-20.04

strategy:
matrix:
Expand All @@ -65,15 +67,16 @@ jobs:
- "2.1"
- "2.2"
python-version:
- "3.6"
#- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"

steps:
- name: Setup PostgreSQL
run: |
docker run -e POSTGRES_DB=postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=wirecloud -d -p 5432:5432 postgres:latest
docker run --rm -e POSTGRES_DB=postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=wirecloud -d -p 5432:5432 --name postgres-wirecloud postgres:latest
- uses: actions/checkout@v2
- name: Use Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
Expand Down Expand Up @@ -102,7 +105,7 @@ jobs:

django-search-indexes-tests:

runs-on: ubuntu-latest
runs-on: ubuntu-20.04

strategy:
matrix:
Expand All @@ -113,19 +116,21 @@ jobs:
steps:
- name: Setup PostgreSQL
run: |
docker run -e POSTGRES_DB=postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=wirecloud -d -p 5432:5432 postgres:latest
docker run --rm -e POSTGRES_DB=postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=wirecloud -d -p 5432:5432 --name postgres-wirecloud postgres:latest
- uses: actions/checkout@v2
- name: Use Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Use Elasticsearch
working-directory: ./src
run: |
docker run -p 9200:9200 --rm -d elasticsearch:2.4
docker run -p 9200:9200 --rm -d --name elasticsearch-wirecloud elasticsearch:2.4
if: ${{ matrix.engine == 'Elasticsearch' }}
- name: Use Solr
working-directory: ./src
run: |
docker run -p 8983:8983 --rm --name solr -d solr:6
docker run -p 8983:8983 --rm --name solr-wirecloud -d solr:6
if: ${{ matrix.engine == 'Solr' }}
- name: Setup and run tests
working-directory: ./src
Expand All @@ -143,10 +148,10 @@ jobs:
cat ci_scripts/templates/solr-conf.template >> settings.py
mkdir solr_conf
python manage.py build_solr_schema --configure-directory solr_conf
docker exec --user=solr solr bin/solr create -c tester -n basic_config
docker exec solr rm -f /opt/solr/server/solr/tester/conf/managed-schema.xml
docker cp solr_conf/schema.xml solr:/opt/solr/server/solr/tester/conf/
docker cp solr_conf/solrconfig.xml solr:/opt/solr/server/solr/tester/conf/
docker exec --user=solr solr-wirecloud bin/solr create -c tester -n basic_config
docker exec solr-wirecloud rm -f /opt/solr/server/solr/tester/conf/managed-schema.xml
docker cp solr_conf/schema.xml solr-wirecloud:/opt/solr/server/solr/tester/conf/
docker cp solr_conf/solrconfig.xml solr-wirecloud:/opt/solr/server/solr/tester/conf/

# Reload the Solr core
curl "http://localhost:8983/solr/admin/cores?action=RELOAD&core=tester"
Expand All @@ -164,21 +169,23 @@ jobs:

django-selenium-tests:

runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- name: Setup PostgreSQL
run: |
docker run -e POSTGRES_DB=postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=wirecloud -d -p 5432:5432 postgres:latest
docker run --rm -e POSTGRES_DB=postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=wirecloud -d -p 5432:5432 --name postgres-wirecloud postgres:latest
- name: Use Geckodriver
uses: browser-actions/setup-geckodriver@latest
- uses: actions/checkout@v2
- name: Use Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Use Elasticsearch
working-directory: ./src
run: |
docker run -p 9200:9200 --rm -d elasticsearch:2.4
docker run -p 9200:9200 --rm -d --name elasticsearch-wirecloud elasticsearch:2.4
- name: Setup and run tests
working-directory: ./src
env:
Expand Down Expand Up @@ -210,7 +217,7 @@ jobs:
- django-selenium-tests
- js-unit-tests

runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- name: Coveralls Finished
Expand Down
14 changes: 14 additions & 0 deletions src/manage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
#!/usr/bin/env python
import os
import sys
# Collections.abc imports for Python 3.10+ compatibility
if sys.version_info.major == 3 and sys.version_info.minor >= 10:
import collections
from collections.abc import Callable as collectionsCallable
from collections.abc import Iterable as collectionsIterable
from collections.abc import Iterator as collectionsIterator
from collections.abc import Mapping as collectionsMapping
from collections.abc import Sequence as collectionsSequence
collections.Callable = collectionsCallable
collections.Iterable = collectionsIterable
collections.Iterator = collectionsIterator
collections.Mapping = collectionsMapping
collections.Sequence = collectionsSequence


if __name__ == "__main__":

Expand Down
2 changes: 1 addition & 1 deletion src/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ regex
markdown
django-haystack>=2.8.0,<2.9.0
whoosh>=2.7.2
pycrypto
pycryptodome
pyScss>=1.3.4,<2.0
Pygments
pillow
Expand Down
8 changes: 4 additions & 4 deletions src/wirecloud/commons/utils/expected_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __call__(self, driver):
try:
wrapper_element = element
if self.check_parent is True:
wrapper_element = element.find_element_by_xpath('..')
wrapper_element = element.find_element(By.XPATH, '..')

if 'disabled' in wrapper_element.get_attribute('class'):
return False
Expand All @@ -70,7 +70,7 @@ def __call__(self, driver):
ActionChains(driver).move_to_element(element).perform()
return False

top_element = top_element.find_element_by_xpath('..')
top_element = top_element.find_element(By.XPATH, '..')

return False
except (NoSuchElementException, StaleElementReferenceException):
Expand Down Expand Up @@ -162,12 +162,12 @@ def __call__(self, driver):
return False

if self.expected_owner is not None:
workspace_owner = self.testcase.driver.find_element_by_css_selector('#wirecloud_breadcrum .first_level').text
workspace_owner = self.testcase.driver.find_element(By.CSS_SELECTOR, '#wirecloud_breadcrum .first_level').text
if workspace_owner != self.expected_owner:
return False

if self.expected_name is not None:
workspace_name = self.testcase.driver.find_element_by_css_selector('#wirecloud_breadcrum .second_level').text
workspace_name = self.testcase.driver.find_element(By.CSS_SELECTOR, '#wirecloud_breadcrum .second_level').text
if workspace_name != self.expected_name:
return False

Expand Down
Loading
Loading