[Backport 2025.1] fix(integration-tests): align AWS keystore tests with the Secrets Manager backend - #15690
Conversation
|
@fruch - This PR has conflicts, therefore it was moved to |
3a96415 to
2f6da3a
Compare
Integration test results (build #2) — the
|
2f6da3a to
c53daba
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 reads from Secrets Manager by default, and `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 raises ResourceNotFoundException, so `test_multiple_sync_on_lots_of_files` could not pass. Sync only the ed25519 pair; keep 60 entries so the test still exercises the boto3 session lock. Backport note: the upstream commit also reworked the `keystore_configure` fixture of `unit_tests/integration/test_aws_services.py` to seed moto's Secrets Manager, and a follow-up commit fixed that file's `MOTO_AMIS_PATH`. Neither applies here -- this branch has no `test_aws_services.py`, and master's copy imports `parse_scylla_version_tag`, which does not exist on this branch. Only the sync-test hunk is backported; on this branch the test lives at the repository root rather than under `unit_tests/integration/`. (cherry picked from commit b92d614)
c53daba to
cd929ef
Compare
Backport of #15670 to
branch-2025.1, reduced to the parts that apply to this branch.What this backport delivers on 2025.1
sdcm/keystore.py— chmod the Secrets Manager version sidecar.get_obj_if_neededchmods the downloaded key to the requested permissions 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. 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. Also adds theKEYSTORE_SM_PREFIXconstant. Covered by two new tests inunit_tests/unit/test_keystore.py.test_sync.py— drop the retired keys.KeyStoreon this branch already defaults to the Secrets Manager backend, andscylla-qa-ec2/scylla-testwere never mirrored into Secrets Manager and never will be — they are the legacy RSA keys, replaced everywhere in SCT byscylla_test_id_ed25519. Syncing them raisesResourceNotFoundException, sotest_multiple_sync_on_lots_of_filescould not pass. Now syncs only the ed25519 pair, keeping 60 entries so the test still exercises the boto3 session lock.What was intentionally dropped
The parent PR's third change — the
keystore_configurefixture rework that seeds moto's Secrets Manager, plus the follow-upMOTO_AMIS_PATHfix — lives entirely inunit_tests/integration/test_aws_services.py. That file does not exist onbranch-2025.1, and master's copy importsparse_scylla_version_tagfromsdcm.utils.version_utils, which does not exist anywhere on this branch. Materializing the file here would fail at import time with anImportErrorduring collection, so it is not carried over. TheMOTO_AMIS_PATHcommit touched only that file and is therefore empty on this branch and dropped as well.Consequence for reviewers: this backport does not fix the nine
test_aws_services.pyfailures described in the parent PR — those tests do not exist on 2025.1. It fixes the keystore sidecar permissions andtest_multiple_sync_on_lots_of_files.Note on the
test-integrationlabelpytest.mark.integrationis not registered onbranch-2025.1, so the roottest_sync.pyonly emitsPytestUnknownMarkWarning: Unknown pytest.mark.integrationrather than being selected by the marker. The labelled integration stage may therefore not collect anything from this diff — worth keeping in mind when reading a green integration run as evidence that the sync fix was exercised.Testing
MOTO_AMIS_PATH, empty on this branch)Parent PR: #15670