fix: migrate copy-forward is manifest-free, no dead-end on legacy projects (EGB-710)
This commit is contained in:
parent
679ddbc1b7
commit
c121982dcd
2 changed files with 37 additions and 27 deletions
|
|
@ -123,12 +123,29 @@ m_file_src() { mkdir -p "$HOME/keystores"; printf 'KS\x00\x01\x02\xffDATA\n' >
|
|||
[ "$output" = "1" ]
|
||||
}
|
||||
|
||||
@test "migrate with no manifest in cwd dies with a directed message" {
|
||||
@test "migrate copy-forwards a v1 properties blob with no .secrets.json (manifest-free)" {
|
||||
# The EGB-710 repro: a legacy project has a v1 properties blob in the store
|
||||
# but no .secrets.json (it predates the manifest). migrate must NOT dead-end.
|
||||
make_v1_store
|
||||
m_gradle_src $'beaconClerkPkTest=pk_test_abc\n'
|
||||
create_project_dir nomanifestblob
|
||||
printf 'gradle-properties ~/.gradle/gradle.properties beaconClerkPkTest\n' > .secrets-files
|
||||
"$SECRETS_BIN" push nomanifestblob >/dev/null 2>&1
|
||||
rm -f .secrets.json # simulate a pre-manifest project
|
||||
run "$SECRETS_BIN" migrate
|
||||
[ "$status" -eq 0 ]
|
||||
run bash -c "ls $SECRETS_DIR/nomanifestblob/external/*.properties.age"
|
||||
[ "$status" -eq 0 ] # v2 twin written despite no manifest
|
||||
run bash -c "ls $SECRETS_DIR/nomanifestblob/external/*.gradle-properties.age"
|
||||
[ "$status" -eq 0 ] # v1 kept (non-destructive)
|
||||
}
|
||||
|
||||
@test "migrate in a project with no manifest and no store blobs is a clean no-op" {
|
||||
make_v1_store
|
||||
local dir="$WORK_DIR/nomanifest"; mkdir -p "$dir"; cd "$dir"
|
||||
run "$SECRETS_BIN" migrate
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *".secrets.json"* ]] || false
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"no v1 properties blobs"* ]] || false
|
||||
}
|
||||
|
||||
@test "migrate on an already-v2 store is a no-op" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue