6 #include <boost/test/auto_unit_test.hpp>
7 #include <solv/solvversion.h>
9 #include "zypp/base/Logger.h"
11 #include "zypp/PathInfo.h"
12 #include "zypp/TmpPath.h"
13 #include "zypp/repo/yum/Downloader.h"
14 #include "tests/zypp/KeyRingTestReceiver.h"
19 using namespace boost::unit_test;
21 #define DATADIR (Pathname(TESTS_SRC_DIR) + "/repo/yum/data")
23 BOOST_AUTO_TEST_CASE(yum_download)
25 KeyRingTestReceiver keyring_callbacks;
26 keyring_callbacks.answerAcceptKey(KeyRingReport::KEY_TRUST_TEMPORARILY);
28 Pathname p = DATADIR + "/ZCHUNK";
29 Url url(p.asDirUrl());
30 MediaSetAccess media(url);
32 repoinfo.setAlias("testrepo");
33 repoinfo.setPath("/");
34 repo::yum::Downloader yum(repoinfo);
35 filesystem::TmpDir tmp;
37 Pathname localdir(tmp.path());
39 yum.download(media, localdir);
41 #ifdef LIBSOLVEXT_FEATURE_ZSTD_COMPRESSION
42 const bool zchunk = true;
44 const bool zchunk = false;
46 std::map<std::string,bool> files {
47 { "filelists.xml.gz", false&&!zchunk },
48 { "filelists.xml.zck", false&&zchunk },
49 { "other.xml.gz", false&&!zchunk },
50 { "other.xml.zck", false&&zchunk },
51 { "patterns.xml.gz", true },
52 { "primary.xml.gz", !zchunk },
53 { "primary.xml.zck", zchunk },
54 { "repomd.xml", true },
55 { "repomd.xml.asc", true },
56 { "repomd.xml.key", true },
59 for ( const auto & el : files )
61 Pathname stem { "/repodata/"+el.first };
62 bool downloaded { PathInfo(localdir/stem).isExist() };
63 BOOST_CHECK_MESSAGE( downloaded == el.second, std::string(el.second?"missing ":"unexpected ")+stem );
68 // vim: set ts=2 sts=2 sw=2 ai et: