0003-dak-admin-suite-config 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #! /bin/bash
  2. #
  3. # © 2019 Niels Thykier <niels@thykier.net>
  4. # License: GPL-2+
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. set -e
  19. set -u
  20. . ${DAK_ROOT:?}/integration-tests/common
  21. . ${DAK_ROOT:?}/integration-tests/setup
  22. # add a unstable suite with amd64
  23. dak admin architecture add amd64 AMD64
  24. for suite in testing stable; do
  25. dak admin suite add "${suite}" ""
  26. dak admin suite-architecture add "${suite}" source all amd64
  27. dak admin suite-component add "${suite}" main contrib non-free
  28. done
  29. echo "---- testing ----"
  30. # Play a bit with testing
  31. (
  32. dak admin suite-config set testing allowcsset=yes accept_source_uploads=no \
  33. accept_binary_uploads=no changelog="dists/testing/ChangeLog" \
  34. changelog_url="http://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog"
  35. )
  36. # Verify that the values match our changes
  37. (
  38. expected="$(cat <<EOF
  39. allowcsset=True
  40. accept_source_uploads=False
  41. accept_binary_uploads=False
  42. changelog=dists/testing/ChangeLog
  43. changelog_url=http://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog
  44. EOF
  45. )"
  46. actual=$(dak admin suite-config get testing allowcsset accept_source_uploads accept_binary_uploads \
  47. changelog changelog_url
  48. )
  49. assert-equal "dak admin s-cfg get allowcsset accept_source_uploads accept_binary_uploads" \
  50. "${actual}" "${expected}"
  51. # Also try to do a listing
  52. dak admin suite-config list testing
  53. )
  54. echo "---- stable ----"
  55. # Set stable to be untouchable (and set allowcsset to a known value)
  56. (
  57. dak admin suite-config set stable allowcsset=no untouchable=yes
  58. )
  59. # Verify the new state
  60. (
  61. expected="$(cat <<EOF
  62. allowcsset=False
  63. untouchable=True
  64. EOF
  65. )"
  66. actual="$(dak admin s-cfg get stable allowcsset untouchable)"
  67. assert-equal "dak admin s-cfg get stable allowcsset untouchable" \
  68. "${actual}" "${expected}"
  69. dak admin suite-config --dry-run set stable allowcsset=yes
  70. dak admin suite-config --dry-run set stable untouchable=no
  71. # And it is nothing really changed anything with dry-run
  72. actual="$(dak admin s-cfg get stable allowcsset untouchable)"
  73. assert-equal "dak admin s-cfg get stable allowcsset untouchable" \
  74. "${actual}" "${expected}"
  75. dak admin suite-config list stable
  76. # And reset/changes the configs for real
  77. dak admin suite-config set stable allowcsset=yes untouchable=no
  78. expected="$(cat <<EOF
  79. allowcsset=True
  80. untouchable=False
  81. EOF
  82. )"
  83. actual="$(dak admin s-cfg get stable allowcsset untouchable)"
  84. assert-equal "dak admin s-cfg get stable allowcsset untouchable" \
  85. "${actual}" "${expected}"
  86. )