0007-policy-queue 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #! /bin/bash
  2. #
  3. # © 2020, 😸 <😸@43-1.org>
  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. # setup archive
  23. (
  24. # add unstable with amd64
  25. dak admin architecture add amd64 AMD64
  26. dak admin suite add unstable "" codename=sid
  27. dak admin suite-architecture add unstable source all amd64
  28. dak admin suite-component add unstable main contrib non-free
  29. # add embargoed policy queue
  30. dak admin suite add embargoed "" codename=embargoed archive=policy
  31. psql -1 -d projectb <<-EOT
  32. \set ON_ERROR_STEP
  33. INSERT INTO policy_queue (queue_name, path, send_to_build_queues, suite_id)
  34. VALUES ('embargoed',
  35. '${DAKBASE}/queue/embargoed',
  36. TRUE,
  37. (SELECT id FROM suite WHERE suite_name = 'embargoed'));
  38. UPDATE suite
  39. SET policy_queue_id = (SELECT id FROM policy_queue WHERE queue_name = 'embargoed')
  40. WHERE suite_name = 'unstable';
  41. EOT
  42. )
  43. suite_with_contents="\
  44. linux-image-all 42.0-1 all
  45. linux-image-all-signed-template 42.0-1 all
  46. linux 42.0-1 source"
  47. # upload something to NEW
  48. (
  49. packages=$(fixture-package-dir)
  50. import-fixture-signing-key
  51. dcmd cp -n -t ${DAKBASE}/tmp ${packages:?}/linux_42.0-1_amd64.changes
  52. dak process-upload -d ${DAKBASE}/tmp --automatic
  53. assert-equal "dak control-suite -l embargoed" "$(dak control-suite -l embargoed)" ""
  54. assert-equal "dak control-suite -l new" "$(dak control-suite -l new)" "${suite_with_contents}"
  55. assert-equal "dak control-suite -l unstable" "$(dak control-suite -l unstable)" ""
  56. )
  57. # accept upload form NEW into policy queue
  58. (
  59. echo a | dak process-new linux_42.0-1_amd64.changes
  60. dak process-policy new
  61. dak clean-suites
  62. assert-equal "dak control-suite -l embargoed" "$(dak control-suite -l embargoed)" "${suite_with_contents}"
  63. assert-equal "dak control-suite -l new" "$(dak control-suite -l new)" ""
  64. assert-equal "dak control-suite -l unstable" "$(dak control-suite -l unstable)" ""
  65. )
  66. # accept upload from policy queue into target suite
  67. (
  68. mkdir ${DAKBASE}/queue/embargoed/COMMENTS
  69. echo OK > ${DAKBASE}/queue/embargoed/COMMENTS/ACCEPT.linux_42.0-1
  70. dak process-policy embargoed
  71. dak clean-suites
  72. assert-equal "dak control-suite -l embargoed" "$(dak control-suite -l embargoed)" ""
  73. assert-equal "dak control-suite -l new" "$(dak control-suite -l new)" ""
  74. assert-equal "dak control-suite -l unstable" "$(dak control-suite -l unstable)" "${suite_with_contents}"
  75. )