Skip to content

Commit

Permalink
reduce entropy use in integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mjurbanski-reef committed Nov 15, 2023
1 parent 2b01cf5 commit 458d915
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions test/integration/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,26 +66,30 @@
BUCKET_NAME_LENGTH = BUCKET_NAME_LENGTH_RANGE[1]
BUCKET_CREATED_AT_MILLIS = 'created_at_millis'

RNG = secrets.SystemRandom()
RNG_SEED = str(RNG.random())
RNG_COUNTER = 0

if sys.version_info < (3, 9):
RNG.randbytes = lambda n: RNG.getrandbits(n * 8).to_bytes(n, 'little')

SSE_NONE = EncryptionSetting(mode=EncryptionMode.NONE,)
SSE_B2_AES = EncryptionSetting(
mode=EncryptionMode.SSE_B2,
algorithm=EncryptionAlgorithm.AES256,
)
_SSE_KEY = RNG.randbytes(32)
SSE_C_AES = EncryptionSetting(
mode=EncryptionMode.SSE_C,
algorithm=EncryptionAlgorithm.AES256,
key=EncryptionKey(secret=os.urandom(32), key_id='user-generated-key-id')
key=EncryptionKey(secret=_SSE_KEY, key_id='user-generated-key-id')
)
SSE_C_AES_2 = EncryptionSetting(
mode=EncryptionMode.SSE_C,
algorithm=EncryptionAlgorithm.AES256,
key=EncryptionKey(secret=os.urandom(32), key_id='another-user-generated-key-id')
key=EncryptionKey(secret=_SSE_KEY, key_id='another-user-generated-key-id')
)

RNG = secrets.SystemRandom()
RNG_SEED = str(RNG.random())
RNG_COUNTER = 0


def bucket_name_part(length: int) -> str:
assert length >= 1
Expand Down

0 comments on commit 458d915

Please sign in to comment.