Your SlideShare is downloading. ×
Auto-testing production CQ instances with Muppet
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Auto-testing production CQ instances with Muppet


Published on

Presentation “Auto-testing production CQ instances with Muppet“ by Bertrand Delacretaz at CQCON2013 in Basel on 19 and 20 June 2013.

Presentation “Auto-testing production CQ instances with Muppet“ by Bertrand Delacretaz at CQCON2013 in Basel on 19 and 20 June 2013.

Published in: Business, Technology, Travel
1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. CQ5HealthCheckAutomated self-testingand health checkof live CQ instancesBertrand DelacrétazSenior R&D Developer, Adobe Basel@bdelacretaz, grep.codeconsult.chCQCon, Basel, June 2013slides revision 2013-06-17
  • 2. CQ5HealthCheck Bertrand Delacrétaz, Adobe Baselpicture: anitapeppers on morguefile.comThemoreconfigurable,themorebreakable....letstestitlive!Agile softwareneedsTESTING
  • 3. CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselApache Sling Health CheckWebconsole pluginRules configured in contentTagged rulesWebconsole and servletsRuleBuilder OSGi servicesApacheSlingmodule,runsinCQ5.5andlater
  • 4. CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselJSON output selectors map to tagsno news (log) is good news!Rule uses a Logger to complainrule 1rule 2
  • 5. rules
  • 6. CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselRule defined in content$ curl -u admin:adminhttp://localhost:4502/apps/hc/demo/inactive-bundles.tidy.json{"sling:resourceType": "sling/healthcheck/rules","namespace": "osgi","ruleName": "inactive.bundles.count","expression": "<= 3","tags": ["bundles","osgi","sling"],"jcr:primaryType": "nt:unstructured"}Execute the osgi:inactive.bundles.count ruleand verify that its output is <= 3The rules engine executes a tree of such definitions, optionally taking tags into account.
  • 7. CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselHTTP rule execution$ curl -u admin:adminhttp://localhost:4502/apps/hc/demo/inactive-bundles.healthcheck.json{"results": [{"rule": "Rule: InactiveBundlesCount <= 3","info": [{"sling.resource.path": "/apps/hc/demo/inactive-bundles"}],"tags": ["sling","bundles","osgi"]}]}Rule path with .healthcheck selectorWorks with single rules or treesno news (log) is good news!
  • 8. CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselRule scripts$ curl -u admin:adminhttp://localhost:4502/apps/hc/demo/script-that-passes.esp# A rule script must output only TEST_PASSED,# comments like this one and white space.# Anything else is considered failure#(as with the Sling testing tools)TEST_PASSEDCurrently executable only from asling/healthcheck/rules container resource.#theskyisthelimit
  • 9. outof thebox
  • 10. CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselOut of the box rulesas of revision 1490454JMXbeans,service=RequestProcessorRequestsCount < use @TestReference for services) activeOSGiinactivebundlesosgi:inactive.bundles.count < 3Sling defaultlogins failsling:loginfailsadmin#adminpicture:mconnorsonmorguefile.comSlingscripts/apps/hc/demo/somescript.espBYOR!
  • 11. extensibili t y
  • 12. CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselRule evaluates a SystemAttribute
  • 13. CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselRuleBuilder service builds Rulescheck namespacemap ruleName toSystemAttributebuild Ruletest:constant:5 = 5namespace:ruleName:qualifier expr
  • 14. CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselDefaultEvaluator expressionscan use custom Evaluator as well“Some string”< 5> 5<= 5>= 5between 5 and 12public interface Evaluator {void evaluate(SystemAttribute a,String expression,Logger logger);}
  • 15. CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselExtensibility summaryImplement a SystemAttributegetValue(Logger)Register a RuleBuilder servicecheck namesbuild SystemAttribute + RuleThat’s it.(optionally supply custom Evaluator)
  • 16. similarideas
  • 17. CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselJoerg Hoh’s cq5-healthcheck = = com.adobe.granite.replication:type=agent,id="publish" = QueueNumEntries.warn.>.100mbean.providerHint = Warn Queue lengthMBean attribute valueranges or customStatusProvider servicesCQ:Page for statusBased on OSGi configs:
  • 18. CQ5HealthCheck Bertrand Delacrétaz, Adobe BaselDavide Giannella’s sanitycheckAdobe Internal github for now: dgiannel/sanitycheckServlets as sanitycheck services.CQ page componentsfor options, forms.Checks remote CQinstances via HTTP.CQ pages to assemblesanity check pages.
  • 19. future
  • 20. CQ5HealthCheckFuture?Implement CQ security checklist rulesExecute rules via JMX?Scheduling of rules execution + reportingScheduling and time-based range checks, samplingperiods (thx Radu Cotescu)Whatareyourusecases?Execute rules tagged “startup” at startupand report or lock instance if WARN.’m @bdelacretaz - thanks for attending!<YOUR IDEA HERE> or on the Apache Sling mailing lists