From c2398175bcc17aff23a93231d521df30e757b844 Mon Sep 17 00:00:00 2001 From: vgmoose Date: Sat, 25 Nov 2023 00:57:21 -0500 Subject: [PATCH] tests: update fake manifest test checks --- tests/9_FakeManifestTest.hpp | 15 +++++++++++++++ tests/server/c/zips/missingmanifest.zip | Bin 39825 -> 40867 bytes tests/test_utils.cpp | 4 +++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/9_FakeManifestTest.hpp b/tests/9_FakeManifestTest.hpp index e4379cd..a95a73c 100644 --- a/tests/9_FakeManifestTest.hpp +++ b/tests/9_FakeManifestTest.hpp @@ -9,6 +9,11 @@ class FakeManifestTest : public Test { { install(get, "missingmanifest"); + if (!exists("sdroot/image.png")) { + error << "The downloaded file in package 'missingmanifest' on server 'c' did not successfully extract" << endl; + return false; + } + std::string sum = calculateMD5("sdroot/image.png").c_str(); const char * rightSum = "26a7965e5aa6acced42de92eeee76d7a"; if (rightSum != sum) { @@ -16,6 +21,13 @@ class FakeManifestTest : public Test { return false; } + // make sure the missingmanifest has "installed" state + auto missingmanifest = get->lookup("missingmanifest"); + if (!missingmanifest || missingmanifest->getStatus() != INSTALLED) { + error << "The package 'missingmanifest' on server 'c' was not installed" << endl; + return false; + } + // install one more time, and make sure we're still all good install(get, "missingmanifest"); @@ -25,6 +37,9 @@ class FakeManifestTest : public Test { return false; } + // TODO: test zip extractions with an extra folder or no folder directory + // TODO: test upgrade of fake manifest packages + return true; } }; \ No newline at end of file diff --git a/tests/server/c/zips/missingmanifest.zip b/tests/server/c/zips/missingmanifest.zip index 612d456f98eb1135bb854a8ae774825f26c3aa99..793903670acfc85dec7057fb3f8f4c7cc0eef7b3 100644 GIT binary patch delta 1224 zcmbQZooVrYCZ7OrW)=|!4j{~Bstjj?cp2F5Hz%eR zbSI`h2hyb#+zgB?Ul|z~fZBmznnULPjq1}JSQ#cc3vDfR@I``#L)N2S@1Z#bdWWum{8bUcZfgOpXGz?NS#{ z9m&wi)XC{%W>SoCb@I^BlTy4`-?!!tllZ&5{#4F~{C`-z_aETj@QwY=Uj|`sZ|?hr z8l0UMXP&uzbLRInHtXZNPcY7VA+BfDI{VP6OH$t?QV&!;JYAnB{eM&1_Ufsr-bdBd zpO|YzN6LmiShHR!TE$c2t%uY@Ze^+D^`&_!SAsrUgdCb)=Plv6D^$sbaryr2b?)^+ zr?-V&GQFrIl)R2zpDg7Va z_9iW7&$raRs=H&Qd+)Qd*~Upc|84%(1(nRHsz13lG<#{)QTZLRh5}XvA6Wyu**O&4 z4Oi=eA`lqvh!~ly)gVoO-g=l%} zYMncCK6q15fYBA>fJdvIGBMPH>}#2`R7wJ9BFI$i_H6*lpr-(=R%1y4$qAy#=?O^* zAAEhnKJbTi1T-*BkYH99kY+5D6{v6iAuZ9t)TgNE7@+2HoJm2-z;v&3=dXI} zXq@o8dfHP*PgB>=*V9wSGn9{mP4myCIWxEx?d{cdbua-smz_hW`pT*ppaVgU4De=T z5@AN<8|1_d3NRR0(gJ{XrZ}gewu=%;e zB!|s)jh7|!8JX;vap_V483qIj4NDq9G~5g>1_cnGfssLip+R!(*EsoGj19jQ{RY!# X3x9#=0B=?{h#E$QXdpvjHi!oRSiUdi diff --git a/tests/test_utils.cpp b/tests/test_utils.cpp index a2f6247..a3d0d43 100644 --- a/tests/test_utils.cpp +++ b/tests/test_utils.cpp @@ -60,7 +60,9 @@ std::string calculateMD5(const char* path) char* file_buffer; file_descript = open(path, O_RDONLY); - if(file_descript < 0) exit(-1); + if(file_descript < 0) { + return ""; + } file_size = get_size_by_fd(file_descript);