Verify published articles across paginated feeds during deployment
wiki CI and deployment / verify-and-deploy (push) Successful in 3m41s
wiki CI and deployment / verify-and-deploy (push) Successful in 3m41s
This commit is contained in:
+20
-1
@@ -96,7 +96,26 @@ compose exec -T web node container-health.mjs
|
||||
compose exec -T web node -e "fetch('http://127.0.0.1:3000/').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))"
|
||||
compose exec -T web node scripts/import-character-packs.mjs
|
||||
compose exec -T worker sh -c 'test "$(id -u)" -ne 0 && ffmpeg -version >/dev/null'
|
||||
compose exec -T web node -e "(async()=>{const feed=await fetch('http://127.0.0.1:3000/api/feed?section=articles').then(r=>r.json());const slugs=['learning-skills-notes','learning-skills-teaching','learning-skills-english'];for(const slug of slugs){const post=feed.posts.find(p=>p.slug===slug);if(!post)throw Error('Published article missing: '+slug);const res=await fetch('http://127.0.0.1:3000/p/'+slug);if(!res.ok)throw Error('Article unavailable: '+slug)}console.log('Verified three published article pages')})().catch(e=>{console.error(e.message);process.exit(1)})"
|
||||
# Editorial posts may be older than the first 24 entries. Verify the complete paged feed.
|
||||
compose exec -T web node - <<'NODE'
|
||||
(async()=>{
|
||||
const slugs=['learning-skills-notes','learning-skills-teaching','learning-skills-english'];
|
||||
const missing=new Set(slugs),seen=new Set();let cursor='';
|
||||
while(missing.size){
|
||||
const query=new URLSearchParams({section:'articles',...(cursor?{cursor}:{})});
|
||||
const response=await fetch('http://127.0.0.1:3000/api/feed?'+query);
|
||||
if(!response.ok)throw Error('Article feed unavailable: '+response.status);
|
||||
const feed=await response.json();for(const post of feed.posts)missing.delete(post.slug);
|
||||
if(!missing.size||!feed.nextCursor)break;
|
||||
if(seen.has(feed.nextCursor))throw Error('Article pagination did not advance');
|
||||
seen.add(feed.nextCursor);cursor=feed.nextCursor;
|
||||
}
|
||||
if(missing.size)throw Error('Published articles missing: '+[...missing].join(', '));
|
||||
for(const slug of slugs){const res=await fetch('http://127.0.0.1:3000/p/'+slug);if(!res.ok)throw Error('Article unavailable: '+slug);}
|
||||
console.log('Verified three published article pages across the paged feed');
|
||||
})().catch(error=>{console.error(error.message);process.exit(1)});
|
||||
NODE
|
||||
|
||||
ln -sfn "$RELEASE_DIR" "$APP_ROOT/.current.next"
|
||||
mv -Tf "$APP_ROOT/.current.next" "$APP_ROOT/current"
|
||||
compose ps
|
||||
|
||||
Reference in New Issue
Block a user