From b77f8685e6de145cbe04e209f2e4594d55db516f Mon Sep 17 00:00:00 2001 From: James Adams Date: Tue, 25 Jul 2023 09:40:44 +0100 Subject: [PATCH] ncm-spma: apt: Test both states of gpgcheck --- .../resources/tests/profiles/apt-sources.pan | 23 ++++++++++++++++--- .../{apt-sources => apt-sources/standard} | 8 +++---- .../tests/regexps/apt-sources/trusted | 10 ++++++++ 3 files changed, 34 insertions(+), 7 deletions(-) rename ncm-spma/src/main/resources/tests/regexps/{apt-sources => apt-sources/standard} (53%) create mode 100644 ncm-spma/src/main/resources/tests/regexps/apt-sources/trusted diff --git a/ncm-spma/src/main/resources/tests/profiles/apt-sources.pan b/ncm-spma/src/main/resources/tests/profiles/apt-sources.pan index ae6367f676..9a94e36831 100644 --- a/ncm-spma/src/main/resources/tests/profiles/apt-sources.pan +++ b/ncm-spma/src/main/resources/tests/profiles/apt-sources.pan @@ -8,24 +8,41 @@ include "components/spma/apt/schema"; '/software/packages' = dict(); prefix '/software/repositories/0'; -'name' = 'a_source'; +'name' = 'standard_source'; 'owner' = 'localuser@localdomain'; 'enabled' = true; +'gpgcheck' = true; 'protocols' = list( dict( 'name', 'http', 'url', 'http://first.example.com/path/to/stuff trusty main', ), + dict( + 'name', 'http', + 'url', 'https://second.example.com/path/to/things trusty main', + ), +); +'includepkgs' = list( + 'foo', +); +'excludepkgs' = list( + 'baz', +); + +prefix '/software/repositories/1'; +'name' = 'trusted_source'; +'owner' = 'localuser@localdomain'; +'enabled' = true; +'gpgcheck' = false; +'protocols' = list( dict( 'name', 'http', 'url', 'http://another.example.org/another/path trusty main', ), ); 'includepkgs' = list( - 'foo', 'bar', ); 'excludepkgs' = list( - 'baz', 'quux', ); diff --git a/ncm-spma/src/main/resources/tests/regexps/apt-sources b/ncm-spma/src/main/resources/tests/regexps/apt-sources/standard similarity index 53% rename from ncm-spma/src/main/resources/tests/regexps/apt-sources rename to ncm-spma/src/main/resources/tests/regexps/apt-sources/standard index 2f86e7d225..a2f65b2391 100644 --- a/ncm-spma/src/main/resources/tests/regexps/apt-sources +++ b/ncm-spma/src/main/resources/tests/regexps/apt-sources/standard @@ -1,12 +1,12 @@ Check that basic apt sources are rendered correctly --- -//software +renderpath=/software rendermodule=apt/source contentspath=/software/repositories/0 --- -^# Name: a_source$ +^# Name: standard_source$ ^# Owner: localuser@localdomain$ ^# Protocol type: http$ -^deb \[trusted=yes\] http://first.example.com/path/to/stuff trusty main$ +^deb http://first.example.com/path/to/stuff trusty main$ ^# Protocol type: http$ -^deb \[trusted=yes\] http://another.example.org/another/path trusty main$ +^deb https://second.example.com/path/to/things trusty main$ diff --git a/ncm-spma/src/main/resources/tests/regexps/apt-sources/trusted b/ncm-spma/src/main/resources/tests/regexps/apt-sources/trusted new file mode 100644 index 0000000000..f9e6433a4c --- /dev/null +++ b/ncm-spma/src/main/resources/tests/regexps/apt-sources/trusted @@ -0,0 +1,10 @@ +Check that trusted (gpgcheck=false) apt sources are rendered correctly +--- +renderpath=/software +rendermodule=apt/source +contentspath=/software/repositories/1 +--- +^# Name: trusted_source$ +^# Owner: localuser@localdomain$ +^# Protocol type: http$ +^deb \[trusted=yes\] http://another.example.org/another/path trusty main