Skip to content

Commit

Permalink
[Backport 4.1.x] Upgrade Remote Docker version for CircleCI (#12021)
Browse files Browse the repository at this point in the history
* Upgrade Remote Docker version for CircleCI (#12020)

(cherry picked from commit cd1ad83)

* Backport 12020 to 4.1.x, fix inconsistent test result

---------

Co-authored-by: Giovanni Allegri <[email protected]>
Co-authored-by: mattiagiupponi <[email protected]>
  • Loading branch information
3 people authored Mar 7, 2024
1 parent 99df666 commit 394b23c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- checkout
- setup_remote_docker:
docker_layer_caching: false
version: 20.10.12
version: docker24

- run:
name: Build the stack
Expand Down
44 changes: 28 additions & 16 deletions geonode/upload/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#
#########################################################################

from geonode.layers.models import Dataset
from geonode.resource.models import ExecutionRequest
import os
import shutil
Expand Down Expand Up @@ -49,7 +50,7 @@
from webdriver_manager.firefox import GeckoDriverManager

from geonode.tests.base import GeoNodeLiveTestSupport
from geonode.geoserver.helpers import ogc_server_settings
from geonode.geoserver.helpers import gs_catalog, ogc_server_settings
from geonode.upload.models import UploadSizeLimit, UploadParallelismLimit
from geonode.upload.tests.utils import GEONODE_USER, GEONODE_PASSWD, rest_upload_by_path

Expand Down Expand Up @@ -229,25 +230,36 @@ def live_upload_file(self, _file):
return response, response.content

@override_settings(CELERY_TASK_ALWAYS_EAGER=True)
@override_settings(FILE_UPLOAD_DIRECTORY_PERMISSIONS=0o777)
@override_settings(FILE_UPLOAD_PERMISSIONS=0o777)
def test_rest_uploads(self):
"""
Ensure we can access the Local Server Uploads list.
"""
# Try to upload a good raster file and check the session IDs
fname = os.path.join(GOOD_DATA, "raster", "relief_san_andres.tif")
resp, data = rest_upload_by_path(fname, self.client)
self.assertEqual(resp.status_code, 201)

url = reverse("uploads-list")
# Anonymous
self.client.logout()
response = self.client.get(url, format="json")
self.assertEqual(response.status_code, 200)
self.assertEqual(len(response.data), 5)
self.assertEqual(response.data["total"], 0)
# Pagination
self.assertEqual(len(response.data["uploads"]), 0)
logger.debug(response.data)
# cleanup existing dataset in geoserver
store = gs_catalog.get_store("relief_san_andres")
if store:
gs_catalog.delete(store, purge="all", recurse=False)
try:
# Try to upload a good raster file and check the session IDs
fname = os.path.join(GOOD_DATA, "raster", "relief_san_andres.tif")
resp, data = rest_upload_by_path(fname, self.client)
self.assertEqual(resp.status_code, 201)

url = reverse("uploads-list")
# Anonymous
self.client.logout()
response = self.client.get(url, format="json")
self.assertEqual(response.status_code, 200)
self.assertEqual(len(response.data), 5)
self.assertEqual(response.data["total"], 0)
# Pagination
self.assertEqual(len(response.data["uploads"]), 0)
logger.debug(response.data)
finally:
dt = Dataset.objects.filter(title="relief_san_andres").first()
if dt:
dt.delete()

@override_settings(CELERY_TASK_ALWAYS_EAGER=True)
def test_rest_uploads_non_interactive(self):
Expand Down

0 comments on commit 394b23c

Please sign in to comment.