From b74e1c893866c487c3f393a399f09745b9ef8ad8 Mon Sep 17 00:00:00 2001 From: Max Pfeiffer Date: Wed, 20 Mar 2024 03:53:18 +0100 Subject: [PATCH] fix(arangodb): tests to pass on ARM CPUs - change default image to 3.11.x where ARM image is published (#479) - updated arangodb image version which now supports ARM CPUs - skipping test for legacy version on ARM CPU fixes https://github.com/testcontainers/testcontainers-python/issues/449 ![Screenshot 2024-03-15 at 11 43 35](https://github.com/testcontainers/testcontainers-python/assets/13573675/9fe5edfc-9a83-44d2-beb5-9c917d41438c) --- .../testcontainers/arangodb/__init__.py | 2 +- modules/arangodb/tests/test_arangodb.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/arangodb/testcontainers/arangodb/__init__.py b/modules/arangodb/testcontainers/arangodb/__init__.py index 4977e79ef..a7c954652 100644 --- a/modules/arangodb/testcontainers/arangodb/__init__.py +++ b/modules/arangodb/testcontainers/arangodb/__init__.py @@ -26,7 +26,7 @@ class ArangoDbContainer(DbContainer): >>> from testcontainers.arangodb import ArangoDbContainer >>> from arango import ArangoClient - >>> with ArangoDbContainer("arangodb:3.9.1") as arango: + >>> with ArangoDbContainer("arangodb:3.11.8") as arango: ... client = ArangoClient(hosts=arango.get_connection_url()) ... ... # Connect diff --git a/modules/arangodb/tests/test_arangodb.py b/modules/arangodb/tests/test_arangodb.py index 6c06b4ca3..f526bf383 100644 --- a/modules/arangodb/tests/test_arangodb.py +++ b/modules/arangodb/tests/test_arangodb.py @@ -7,8 +7,10 @@ from arango.exceptions import DatabaseCreateError, ServerVersionError from testcontainers.arangodb import ArangoDbContainer +import platform ARANGODB_IMAGE_NAME = "arangodb" +IMAGE_VERSION = "3.11.8" def arango_test_ops(arango_client, expeced_version, username="root", password=""): @@ -50,8 +52,7 @@ def test_docker_run_arango(): """ Test ArangoDB container with default settings. """ - image_version = "3.9.1" - image = f"{ARANGODB_IMAGE_NAME}:{image_version}" + image = f"{ARANGODB_IMAGE_NAME}:{IMAGE_VERSION}" arango_root_password = "passwd" with ArangoDbContainer(image) as arango: @@ -62,22 +63,22 @@ def test_docker_run_arango(): with pytest.raises(DatabaseCreateError): sys_db.create_database("test") - arango_test_ops(arango_client=client, expeced_version=image_version, password=arango_root_password) + arango_test_ops(arango_client=client, expeced_version=IMAGE_VERSION, password=arango_root_password) def test_docker_run_arango_without_auth(): """ Test ArangoDB container with ARANGO_NO_AUTH var set. """ - image_version = "3.9.1" - image = f"{ARANGODB_IMAGE_NAME}:{image_version}" + image = f"{ARANGODB_IMAGE_NAME}:{IMAGE_VERSION}" with ArangoDbContainer(image, arango_no_auth=True) as arango: client = ArangoClient(hosts=arango.get_connection_url()) - arango_test_ops(arango_client=client, expeced_version=image_version, password="") + arango_test_ops(arango_client=client, expeced_version=IMAGE_VERSION, password="") +@pytest.mark.skipif(platform.processor() == "arm", reason="Test does not run on machines with ARM CPU") def test_docker_run_arango_older_version(): """ Test ArangoDB container with older tag/version. @@ -100,8 +101,7 @@ def test_docker_run_arango_random_root_password(): """ Test ArangoDB container with ARANGO_RANDOM_ROOT_PASSWORD var set. """ - image_version = "3.9.1" - image = f"{ARANGODB_IMAGE_NAME}:{image_version}" + image = f"{ARANGODB_IMAGE_NAME}:{IMAGE_VERSION}" arango_root_password = "passwd" with ArangoDbContainer(image, arango_random_root_password=True) as arango: @@ -110,4 +110,4 @@ def test_docker_run_arango_random_root_password(): # Test invalid auth (we don't know the password in random mode) sys_db = client.db("_system", username="root", password=arango_root_password) with pytest.raises(ServerVersionError): - assert sys_db.version() == image_version + assert sys_db.version() == IMAGE_VERSION