File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 11import contextlib
2- import hashlib
32import logging
3+ import pickle
44import sys
5+ import zlib
56from os import PathLike
67from socket import socket
78from types import TracebackType
@@ -217,7 +218,7 @@ def start(self) -> Self:
217218 self .volumes ,
218219 str (tuple (sorted (self ._kwargs .values ()))),
219220 ]
220- hash_ = hashlib . sha256 ( bytes ( str ( args ), encoding = "utf-8" )). hexdigest ( )
221+ hash_ = str ( zlib . crc32 ( pickle . dumps ( args )) )
221222 docker_client = self .get_docker_client ()
222223 container = docker_client .find_container_by_hash (hash_ )
223224 if container is not None :
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ def test_docker_container_labels_hash_default():
114114def test_docker_container_labels_hash (monkeypatch ):
115115 tc_properties_mock = testcontainers_config .tc_properties | {"testcontainers.reuse.enable" : "true" }
116116 monkeypatch .setattr (testcontainers_config , "tc_properties" , tc_properties_mock )
117- expected_hash = "1bade17a9d8236ba71ffbb676f2ece3fb419ea0e6adb5f82b5a026213c431d8e "
117+ expected_hash = "1296172062 "
118118 with DockerContainer ("hello-world" ).with_reuse () as container :
119119 assert container ._container is not None
120120 assert container ._container .labels ["hash" ] == expected_hash
You can’t perform that action at this time.
0 commit comments