From 0794151f0bc8c56b8db4266c8390867a98be7035 Mon Sep 17 00:00:00 2001 From: Gagan Deep Date: Thu, 31 Aug 2023 17:08:48 +0530 Subject: [PATCH] [ci] Updated system dependencies --- .github/workflows/ci.yml | 13 ++++++++++- docker-compose.yml | 22 +++++++++++++++++++ .../monitoring/tests/test_metrics.py | 8 +++---- tests/openwisp2/settings.py | 3 ++- 4 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 docker-compose.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index abceb5f5..b1c099a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,18 @@ jobs: - name: Install system libraries run: | sudo apt update - sudo apt-get -qq -y install xmlsec1 gettext + sudo apt-get -qq -y install xmlsec1 gettext \ + sqlite3 \ + fping \ + gdal-bin \ + libproj-dev \ + libgeos-dev \ + libspatialite-dev \ + spatialite-bin \ + libsqlite3-mod-spatialite + + - name: Start InfluxDB and Redis container + run: docker-compose up -d influxdb redis - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..a7592770 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,22 @@ +version: "3" + +services: + influxdb: + image: influxdb:1.8-alpine + volumes: + - influxdb-data:/var/lib/influxdb + ports: + - "8086:8086" + environment: + INFLUXDB_DB: openwisp2 + INFLUXDB_USER: openwisp + INFLUXDB_USER_PASSWORD: openwisp + + redis: + image: redis:alpine + ports: + - "6379:6379" + entrypoint: redis-server --appendonly yes + +volumes: + influxdb-data: {} diff --git a/openwisp_radius/integrations/monitoring/tests/test_metrics.py b/openwisp_radius/integrations/monitoring/tests/test_metrics.py index 6f7c0f62..6d2f5eac 100644 --- a/openwisp_radius/integrations/monitoring/tests/test_metrics.py +++ b/openwisp_radius/integrations/monitoring/tests/test_metrics.py @@ -81,7 +81,7 @@ def test_post_save_registered_user_edge_cases( @patch('logging.Logger.warning') def test_post_save_organization_user(self, *args): user = self._create_user() - self._create_registered_user(user=user) + self._create_registered_user(user=user, method='') self._create_org_user(user=user) self.assertEqual( self.metric_model.objects.filter( @@ -185,9 +185,7 @@ def post_save_radiusaccounting_edge_cases( options['called_station_id'] = '00:00:00:00:00:00' options['unique_id'] = '117' with self.subTest('Test session is not closed'): - with patch.object( - f'{TASK_PATH}.post_save_registereduser.delay' - ) as mocked_task: + with patch(f'{TASK_PATH}.post_save_registereduser.delay') as mocked_task: rad_acc = self._create_radius_accounting(**options) self.assertEqual(rad_acc.stop_time, None) mocked_task.assert_not_called() @@ -206,7 +204,7 @@ def post_save_radiusaccounting_edge_cases( ' Skipping radius_acc metric writing!' ) - self._create_registered_user(user=user, method='') + self._create_registered_user(user=user) options['unique_id'] = '119' mocked_logger.reset_mock() diff --git a/tests/openwisp2/settings.py b/tests/openwisp2/settings.py index abc4c2d0..ef00c1fb 100644 --- a/tests/openwisp2/settings.py +++ b/tests/openwisp2/settings.py @@ -106,8 +106,8 @@ 'OPTIONS': { 'loaders': [ 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', 'openwisp_utils.loaders.DependencyLoader', + 'django.template.loaders.app_directories.Loader', ], 'context_processors': [ 'django.template.context_processors.debug', @@ -370,6 +370,7 @@ }, } } + DATABASES['default']['ENGINE'] = 'openwisp_utils.db.backends.spatialite' if os.environ.get('SAMPLE_APP', False): INSTALLED_APPS.remove('openwisp_radius')