Write an encrypted parquet, verify it's encrypted, and then read it multithreaded in a loop.
(tempdir, data_table, basic_encryption_config)
| 651 | |
| 652 | |
| 653 | def test_encrypted_parquet_loop(tempdir, data_table, basic_encryption_config): |
| 654 | """Write an encrypted parquet, verify it's encrypted, |
| 655 | and then read it multithreaded in a loop.""" |
| 656 | path = tempdir / PARQUET_NAME |
| 657 | |
| 658 | # Encrypt the footer with the footer key, |
| 659 | # encrypt column `a` and column `b` with another key, |
| 660 | # keep `c` plaintext, defined in basic_encryption_config |
| 661 | kms_connection_config, crypto_factory = write_encrypted_file( |
| 662 | path, data_table, FOOTER_KEY_NAME, COL_KEY_NAME, FOOTER_KEY, COL_KEY, |
| 663 | basic_encryption_config) |
| 664 | |
| 665 | verify_file_encrypted(path) |
| 666 | |
| 667 | decryption_config = pe.DecryptionConfiguration( |
| 668 | cache_lifetime=timedelta(minutes=5.0)) |
| 669 | |
| 670 | for i in range(50): |
| 671 | # Read with decryption properties |
| 672 | file_decryption_properties = crypto_factory.file_decryption_properties( |
| 673 | kms_connection_config, decryption_config) |
| 674 | assert file_decryption_properties is not None |
| 675 | |
| 676 | result = pq.ParquetFile( |
| 677 | path, decryption_properties=file_decryption_properties) |
| 678 | result_table = result.read(use_threads=True) |
| 679 | assert data_table.equals(result_table) |
| 680 | |
| 681 | |
| 682 | def test_read_with_deleted_crypto_factory(tempdir, data_table, basic_encryption_config): |
nothing calls this directly
no test coverage detected