[Backport perf-v17] fix(integration-tests): align AWS keystore tests with the Secrets Manager backend - #15680
Conversation
|
@fruch - This PR has conflicts, therefore it was moved to |
40b73f8 to
4c31e3e
Compare
|
Resolved the backport conflict and adapted it to this branch. Path mapping — Conflict ( Dropped commit: Verified locally (Python 3.13, real AWS creds + moto):
|
Integration test results (build #2) — this PR's own tests pass;
|
751eee9 to
bda86f3
Compare
`get_obj_if_needed` chmods the downloaded key to the requested permissions but wrote the `<file>.version` sidecar with whatever the umask allowed (0o664 on a default setup). The sidecar lands next to the key it describes -- usually in `~/.ssh` -- where ssh refuses to use a directory holding group/world readable material. Apply the same permissions to the sidecar. The chmod sits outside the download branch on purpose: a sidecar whose version is still current is never rewritten, so one left at 0o664 by an earlier sync would keep those permissions forever if the fix only ran after a download. (cherry picked from commit 5ebb5e3)
KeyStore now reads from Secrets Manager by default, which broke these tests in two ways: * `scylla-qa-ec2` and `scylla-test` were never mirrored into Secrets Manager and never will be -- they are the legacy RSA keys, replaced everywhere in SCT by `scylla_test_id_ed25519`. Syncing them raised ResourceNotFoundException from the session-scoped `fixture_get_real_keys`, failing every test in `test_aws_services.py` on setup and taking `test_multiple_sync_on_lots_of_files` down with it. Sync only the ed25519 pair; keep 60 entries in the sync test so it still exercises the boto3 session lock. * `keystore_configure` seeded the moto S3 bucket only, so once the keys synced the tests still failed on GetSecretValue. Seed the same entries into moto's Secrets Manager under the `sct/` prefix, and reuse the keystore constants instead of repeating the bucket name and prefix. (cherry picked from commit b92d614)
bda86f3 to
0f119ab
Compare
Fixes the 9 Secrets Manager related integration test failures seen in PR-15647 build 1. They are unrelated to that PR (a renovate gemini bump) — the tests were still written for the S3 keystore backend, which
KeyStoreno longer defaults to.What was failing
all with
ResourceNotFoundException ... calling the DescribeSecret operation.Root causes
Three distinct bugs, stacked — CI only ever showed the first because it aborted at session-fixture time.
Retired keys.
fixture_get_real_keyssyncedscylla-qa-ec2andscylla-test. Those are the legacy RSA keys; they exist in thescylla-qa-keystorebucket but were never mirrored into Secrets Manager and never will be. Everything in SCT (includingsct.py) already usesscylla_test_id_ed25519. Verified against the real account:Fixture seeded the wrong backend.
keystore_configurepopulated the moto S3 bucket only, so with the keys fixed the tests still failed onGetSecretValue. Now the same entries are seeded into moto's Secrets Manager under thesct/prefix, and the fixture uses theKEYSTORE_*constants instead of repeating the bucket name and prefix.Broken
MOTO_AMIS_PATH. The AMI fixtures live inunit_tests/test_data/, but the path was computed relative to the test file, which since the move tounit_tests/integration/resolves to a directory that does not exist. Moto loaded no AMI data and returned a 500 for everyDescribeImages, so the four EC2 tests could not pass even with a working keystore.Also fixed
get_obj_if_neededchmods the downloaded key but wrote the<file>.versionsidecar at the umask (0o664). The sidecar lands next to the key it describes, usually in~/.ssh, where ssh refuses a directory holding group/world readable material.test_02_keystore_syncasserts every synced file is 0600 and caught it. Covered by a new unit test.Testing
Parent PR: #15670