(mz: MaterializeApplication)
| 62 | reason="Failpoints mess up the Mz intance https://linear.app/materializeinc/issue/CLU-127" |
| 63 | ) |
| 64 | def test_orphaned_secrets(mz: MaterializeApplication) -> None: |
| 65 | # Use two separate failpoints. One that crashes after modifying the catalog |
| 66 | # (drop_secrets), and one that fails during bootstrap (orphan_secrets) so |
| 67 | # that we can prevent a racy startup from cleaning up the secret before we |
| 68 | # observed it. |
| 69 | mz.set_environmentd_failpoints("orphan_secrets=panic") |
| 70 | mz.environmentd.sql("SET failpoints = 'drop_secrets=panic'") |
| 71 | mz.environmentd.sql("CREATE SECRET orphan AS '123'") |
| 72 | |
| 73 | id = mz.environmentd.sql_query("SELECT id FROM mz_secrets WHERE name = 'orphan'")[ |
| 74 | 0 |
| 75 | ][0] |
| 76 | assert id is not None |
| 77 | secret = f"user-managed-{id}" |
| 78 | |
| 79 | # The failpoint should cause this to fail. |
| 80 | try: |
| 81 | mz.environmentd.sql("DROP SECRET orphan") |
| 82 | raise Exception("Unexpected success") |
| 83 | except InterfaceError: |
| 84 | pass |
| 85 | |
| 86 | describe = mz.kubectl("describe", "secret", secret) |
| 87 | assert "contents: 3 bytes" in describe |
| 88 | |
| 89 | # We saw the secret, allow orphan cleanup. |
| 90 | mz.set_environmentd_failpoints("") |
| 91 | |
| 92 | mz.wait_for_sql() |
| 93 | wait(condition="delete", resource=f"secret/{secret}") |
| 94 | |
| 95 | |
| 96 | @pytest.mark.skip(reason="Flaky, see https://linear.app/materializeinc/issue/DB-136") |
nothing calls this directly
no test coverage detected