Write an encrypted parquet, verify it's encrypted, and then read it multithreaded in a loop.
(tempdir, data_table, basic_encryption_config)
| 786 | |
| 787 | |
| 788 | def test_encrypted_parquet_loop(tempdir, data_table, basic_encryption_config): |
| 789 | """Write an encrypted parquet, verify it's encrypted, |
| 790 | and then read it multithreaded in a loop.""" |
| 791 | path = tempdir / PARQUET_NAME |
| 792 | |
| 793 | # Encrypt the footer with the footer key, |
| 794 | # encrypt column `a` and column `b` with another key, |
| 795 | # keep `c` plaintext, defined in basic_encryption_config |
| 796 | kms_connection_config, crypto_factory = write_encrypted_file( |
| 797 | path, data_table, FOOTER_KEY_NAME, COL_KEY_NAME, FOOTER_KEY, COL_KEY, |
| 798 | basic_encryption_config) |
| 799 | |
| 800 | verify_file_encrypted(path) |
| 801 | |
| 802 | decryption_config = pe.DecryptionConfiguration( |
| 803 | cache_lifetime=timedelta(minutes=5.0)) |
| 804 | |
| 805 | for i in range(50): |
| 806 | # Read with decryption properties |
| 807 | file_decryption_properties = crypto_factory.file_decryption_properties( |
| 808 | kms_connection_config, decryption_config) |
| 809 | assert file_decryption_properties is not None |
| 810 | |
| 811 | result = pq.ParquetFile( |
| 812 | path, decryption_properties=file_decryption_properties) |
| 813 | result_table = result.read(use_threads=True) |
| 814 | assert data_table.equals(result_table) |
| 815 | |
| 816 | |
| 817 | def test_read_with_deleted_crypto_factory(tempdir, data_table, basic_encryption_config): |
nothing calls this directly
no test coverage detected