diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2024-02-20 19:04:36 +0100 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2024-02-20 19:12:16 +0100 |
commit | 78c3ad795de7f14de3ee22e9f04fe24b5f21f0ea (patch) | |
tree | a5cc7cef8f48e0b71d36516aa96521df25356074 | |
parent | 1f67cf94ec2df0d30349f033c777495b80b41484 (diff) |
test-snapshot: Add test case for automatic snapshot
1. repository not supporting snapshots, implicit Enabled
2. repository not supporting snapshots, Enabled: yes
3. URL-based lookup, implicit Enabled
-rwxr-xr-x | test/integration/test-snapshot | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/test/integration/test-snapshot b/test/integration/test-snapshot index 7c7725ba3..26ef5a721 100755 --- a/test/integration/test-snapshot +++ b/test/integration/test-snapshot @@ -13,6 +13,13 @@ buildsimplenativepackage 'libbar' 'all' '1.0' 'stable' getlabelfromsuite() { echo 'Testcases'; } getoriginfromsuite() { echo 'Debian'; } +releasechanger() { + # modifying the Release files in lists… bad stuff. Good that this is only a test… + msgmsg "Changing $1 to $2" + sed -i "s#^${1}: .*#${1}: ${2}#" $(find rootdir/var/lib/apt/lists -name '*Release') + rm -f rootdir/var/cache/apt/*.bin +} + setupaptarchive --no-update changetowebserver @@ -35,9 +42,24 @@ testsuccessequal "'https://snapshot.debian.org/archive/debian/OPTIONNOTSET/dists 'http://localhost:${APTHTTPPORT}/dists/stable/main/binary-all/Packages.xz' localhost:${APTHTTPPORT}_dists_stable_main_binary-all_Packages 0 'http://localhost:${APTHTTPPORT}/dists/stable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris --snapshot OPTIONNOTSET +# repository does not support snapshots: we succeed here by silently ignoring the snapshot for the repository because it's not forced-on +releasechanger 'Origin' 'NoSnapshotsKnown' +testsuccessequal "'http://localhost:${APTHTTPPORT}/dists/stable/InRelease' localhost:${APTHTTPPORT}_dists_stable_InRelease 0 +'http://localhost:${APTHTTPPORT}/dists/stable/main/source/Sources.xz' localhost:${APTHTTPPORT}_dists_stable_main_source_Sources 0 +'http://localhost:${APTHTTPPORT}/dists/stable/main/binary-amd64/Packages.xz' localhost:${APTHTTPPORT}_dists_stable_main_binary-amd64_Packages 0 +'http://localhost:${APTHTTPPORT}/dists/stable/main/binary-all/Packages.xz' localhost:${APTHTTPPORT}_dists_stable_main_binary-all_Packages 0 +'http://localhost:${APTHTTPPORT}/dists/stable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris --snapshot OPTION-NOT-SET-AND-RELEASE-SAYS-NO + + # Enable the snapshot feature sed -i 's/http:/[snapshot=enable] http:/' rootdir/etc/apt/sources.list.d/* +# repository does not support snapshots: we fail here because now, we actually forced the feature enabled +testfailuremsg "E: Snapshots not supported for http://localhost:${APTHTTPPORT}/ stable +E: Snapshots not supported for http://localhost:${APTHTTPPORT}/ stable +E: The list of sources could not be read." aptget update --print-uris -S OPTION-SET-AND-RELEASE-SAYS-NO + +releasechanger 'Origin' 'Debian' testsuccessequal "'http://localhost:${APTHTTPPORT}/dists/stable/InRelease' localhost:${APTHTTPPORT}_dists_stable_InRelease 0 'http://localhost:${APTHTTPPORT}/dists/stable/main/source/Sources.xz' localhost:${APTHTTPPORT}_dists_stable_main_source_Sources 0 'http://localhost:${APTHTTPPORT}/dists/stable/main/binary-amd64/Packages.xz' localhost:${APTHTTPPORT}_dists_stable_main_binary-amd64_Packages 0 @@ -100,12 +122,6 @@ testsuccessequal "'http://localhost:${APTHTTPPORT}/snapshot/BANANA/pool/awesome_ aptget install --print-uris -qq awesome -o Acquire::Snapshots::URI::Label::Testcases="http://localhost:${APTHTTPPORT}/snapshot/@SNAPSHOTID@/" -SBANANA -releasechanger() { - # modifying the Release files in lists… bad stuff. Good that this is only a test… - sed -i "s#^${1}: .*#${1}: ${2}#" $(find rootdir/var/lib/apt/lists -name '*Release') - rm -f rootdir/var/cache/apt/*.bin -} - msgmsg "Origin: Ubuntu" releasechanger 'Origin' 'Ubuntu' testsuccessequal "'https://snapshot.ubuntu.com/ubuntu/BANANA/dists/stable/InRelease' snapshot.ubuntu.com_ubuntu_BANANA_dists_stable_InRelease 0 @@ -202,6 +218,16 @@ rm rootdir/etc/apt/apt.conf.d/changelog.conf msgmsg "Testing host-based seed: Ubuntu" +echo "deb http://security.ubuntu.com/ubuntu/ mantic-security main" > rootdir/etc/apt/security.list +testsuccessequal "'https://snapshot.ubuntu.com/ubuntu/BANANA/dists/mantic-security/InRelease' snapshot.ubuntu.com_ubuntu_BANANA_dists_mantic-security_InRelease 0 +'https://snapshot.ubuntu.com/ubuntu/BANANA/dists/mantic-security/main/binary-amd64/Packages.xz' snapshot.ubuntu.com_ubuntu_BANANA_dists_mantic-security_main_binary-amd64_Packages 0 +'https://snapshot.ubuntu.com/ubuntu/BANANA/dists/mantic-security/main/binary-all/Packages.xz' snapshot.ubuntu.com_ubuntu_BANANA_dists_mantic-security_main_binary-all_Packages 0 +'https://snapshot.ubuntu.com/ubuntu/BANANA/dists/mantic-security/main/i18n/Translation-en.xz' snapshot.ubuntu.com_ubuntu_BANANA_dists_mantic-security_main_i18n_Translation-en 0 +'http://security.ubuntu.com/ubuntu/dists/mantic-security/InRelease' security.ubuntu.com_ubuntu_dists_mantic-security_InRelease 0 +'http://security.ubuntu.com/ubuntu/dists/mantic-security/main/binary-amd64/Packages.xz' security.ubuntu.com_ubuntu_dists_mantic-security_main_binary-amd64_Packages 0 +'http://security.ubuntu.com/ubuntu/dists/mantic-security/main/binary-all/Packages.xz' security.ubuntu.com_ubuntu_dists_mantic-security_main_binary-all_Packages 0 +'http://security.ubuntu.com/ubuntu/dists/mantic-security/main/i18n/Translation-en.xz' security.ubuntu.com_ubuntu_dists_mantic-security_main_i18n_Translation-en 0 " aptget update --print-uris -o Dir::Etc::SourceList=security.list -o Dir::Etc::SourceParts=/dev/null -SBANANA + echo "deb [snapshot=BANANA] http://security.ubuntu.com/ubuntu/ mantic-security main" > rootdir/etc/apt/security.list testsuccessequal "'https://snapshot.ubuntu.com/ubuntu/BANANA/dists/mantic-security/InRelease' snapshot.ubuntu.com_ubuntu_BANANA_dists_mantic-security_InRelease 0 'https://snapshot.ubuntu.com/ubuntu/BANANA/dists/mantic-security/main/binary-amd64/Packages.xz' snapshot.ubuntu.com_ubuntu_BANANA_dists_mantic-security_main_binary-amd64_Packages 0 |