You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by en...@apache.org on 2020/09/16 20:56:02 UTC

[sling-org-apache-sling-jcr-contentloader] branch master updated: SLING-9736 use content loader health check component to make the integration tests more stable

This is an automated email from the ASF dual-hosted git repository.

enorman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentloader.git


The following commit(s) were added to refs/heads/master by this push:
     new 602e438  SLING-9736 use content loader health check component to make the integration tests more stable
602e438 is described below

commit 602e4380ff5a97d6531838c0ae3827fdf5e39de0
Author: Eric Norman <en...@apache.org>
AuthorDate: Wed Sep 16 13:55:47 2020 -0700

    SLING-9736 use content loader health check component to make the
    integration tests more stable
---
 .../contentloader/it/BasicInitialContentIT.java    |  31 ++++--
 .../contentloader/it/ContentloaderTestSupport.java | 113 ++++++++++++++++++---
 .../jcr/contentloader/it/I18nInitialContentIT.java |  33 ++++--
 .../contentloader/it/OrderedInitialContentIT.java  |  27 ++++-
 .../apache/sling/jcr/contentloader/it/Retry.java   |  46 +++++++++
 .../it/SLING7268InitialContentIT.java              |  29 +++++-
 .../it/SLING8118InitialContentIT.java              |  29 +++++-
 7 files changed, 268 insertions(+), 40 deletions(-)

diff --git a/src/test/java/org/apache/sling/jcr/contentloader/it/BasicInitialContentIT.java b/src/test/java/org/apache/sling/jcr/contentloader/it/BasicInitialContentIT.java
index 7389224..c83c4ee 100644
--- a/src/test/java/org/apache/sling/jcr/contentloader/it/BasicInitialContentIT.java
+++ b/src/test/java/org/apache/sling/jcr/contentloader/it/BasicInitialContentIT.java
@@ -18,12 +18,17 @@
  */
 package org.apache.sling.jcr.contentloader.it;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
+
 import java.io.IOException;
 
 import javax.jcr.RepositoryException;
 
-import com.google.common.collect.ImmutableListMultimap;
-import com.google.common.collect.Multimap;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Configuration;
@@ -33,10 +38,8 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.osgi.framework.Bundle;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.ops4j.pax.exam.CoreOptions.options;
+import com.google.common.collect.ImmutableListMultimap;
+import com.google.common.collect.Multimap;
 
 /**
  * Basic test of a bundle that provides initial content
@@ -55,12 +58,28 @@ public class BasicInitialContentIT extends ContentloaderTestSupport {
             DEFAULT_PATH_IN_BUNDLE, "folder-with-descriptor/test2.txt"
         );
         final Option bundle = buildInitialContentBundle(header, content);
+        // configure the health check component
+        Option hcConfig = factoryConfiguration("org.apache.sling.jcr.contentloader.hc.BundleContentLoadedCheck")
+            .put("hc.tags", new String[] {TAG_TESTING_CONTENT_LOADING})
+            .asOption();
         return options(
             baseConfiguration(),
+            hcConfig,
             bundle
         );
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.sling.jcr.contentloader.it.ContentloaderTestSupport#setup()
+     */
+    @Before
+    @Override
+    public void setup() throws Exception {
+        super.setup();
+        
+        waitForContentLoaded();
+    }
+
     @Test
     public void bundleStarted() {
         final Bundle b = findBundle(BUNDLE_SYMBOLICNAME);
diff --git a/src/test/java/org/apache/sling/jcr/contentloader/it/ContentloaderTestSupport.java b/src/test/java/org/apache/sling/jcr/contentloader/it/ContentloaderTestSupport.java
index 97d3e53..8a2d894 100644
--- a/src/test/java/org/apache/sling/jcr/contentloader/it/ContentloaderTestSupport.java
+++ b/src/test/java/org/apache/sling/jcr/contentloader/it/ContentloaderTestSupport.java
@@ -18,15 +18,39 @@
  */
 package org.apache.sling.jcr.contentloader.it;
 
+import static org.apache.sling.testing.paxexam.SlingOptions.slingQuickstartOakTar;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingResourcePresence;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.streamBundle;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
+import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd;
+import static org.apache.felix.hc.api.FormattingResultLog.msHumanReadable;
+
+import java.io.BufferedWriter;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.StringWriter;
+import java.text.SimpleDateFormat;
+import java.util.List;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
 import javax.inject.Inject;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
-import com.google.common.collect.Multimap;
+import org.apache.felix.hc.api.Result;
+import org.apache.felix.hc.api.ResultLog;
+import org.apache.felix.hc.api.execution.HealthCheckExecutionResult;
+import org.apache.felix.hc.api.execution.HealthCheckExecutor;
+import org.apache.felix.hc.api.execution.HealthCheckSelector;
 import org.apache.sling.jcr.api.SlingRepository;
 import org.apache.sling.resource.presence.ResourcePresence;
 import org.apache.sling.testing.paxexam.SlingOptions;
@@ -44,21 +68,12 @@ import org.osgi.framework.Constants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.sling.testing.paxexam.SlingOptions.slingQuickstartOakTar;
-import static org.apache.sling.testing.paxexam.SlingOptions.slingResourcePresence;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.ops4j.pax.exam.CoreOptions.composite;
-import static org.ops4j.pax.exam.CoreOptions.junitBundles;
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.CoreOptions.streamBundle;
-import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
-import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
-import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd;
+import com.google.common.collect.Multimap;
 
 public abstract class ContentloaderTestSupport extends TestSupport {
 
+    protected static final String TAG_TESTING_CONTENT_LOADING = "testing-content-loading";
+
     @Inject
     protected BundleContext bundleContext;
 
@@ -84,6 +99,9 @@ public abstract class ContentloaderTestSupport extends TestSupport {
     @Filter(value = "(path=" + CONTENT_ROOT_PATH + ")")
     private ResourcePresence resourcePresence;
 
+    @Inject
+    private HealthCheckExecutor hcExecutor;
+    
     public ModifiableCompositeOption baseConfiguration() {
         final Option contentloader = mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.jcr.contentloader").version(SlingOptions.versionResolver.getVersion("org.apache.sling", "org.apache.sling.jcr.contentloader"));
         return composite(
@@ -122,6 +140,75 @@ public abstract class ContentloaderTestSupport extends TestSupport {
     }
 
     /**
+     * Wait for the bundle content loading to be completed.
+     * Timeout is 2 minutes with 5 second iteration delay.
+     */
+    protected void waitForContentLoaded() throws Exception {
+        waitForContentLoaded(TimeUnit.MINUTES.toMillis(2), TimeUnit.SECONDS.toMillis(5));
+    }
+    /**
+     * Wait for the bundle content loading to be completed
+     * 
+     * @param timeoutMsec the max time to wait for the content to be loaded
+     * @param nextIterationDelay the sleep time between the check attempts
+     */
+    protected void waitForContentLoaded(long timeoutMsec, long nextIterationDelay) throws Exception {
+        new Retry(timeoutMsec, nextIterationDelay) {
+            /* (non-Javadoc)
+             * @see org.apache.sling.jcr.contentloader.it.Retry#exec()
+             */
+            @Override
+            protected void exec() throws Exception {
+                logger.info("Performing content-loaded health check");
+                HealthCheckSelector hcs = HealthCheckSelector.tags(TAG_TESTING_CONTENT_LOADING);
+                List<HealthCheckExecutionResult> results = hcExecutor.execute(hcs);
+                logger.info("content-loaded health check got {} results", results.size());
+                assertFalse(results.isEmpty());
+                for (final HealthCheckExecutionResult exR : results) {
+                    final Result r = exR.getHealthCheckResult();
+                    logger.info("content-loaded health check: {}", toHealthCheckResultInfo(exR, false));
+                    assertTrue(r.isOk());
+                }
+            }
+        };
+    }
+    
+    /**
+     * Produce a human readable report of the health check results that is suitable for
+     * debugging or writing to a log
+     */
+    protected String toHealthCheckResultInfo(final HealthCheckExecutionResult exResult, final boolean debug)  throws IOException {
+        String value = null;
+        try (StringWriter resultWriter = new StringWriter(); BufferedWriter writer = new BufferedWriter(resultWriter)) {
+            final Result result = exResult.getHealthCheckResult();
+
+            writer.append('"').append(exResult.getHealthCheckMetadata().getTitle()).append('"');
+            writer.append(" result is: ").append(result.getStatus().toString());
+            writer.newLine();
+            writer.append("   Finished: ").append(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(exResult.getFinishedAt()) + " after "
+                    + msHumanReadable(exResult.getElapsedTimeInMs()));
+
+            for (final ResultLog.Entry e : result) {
+                if (!debug && e.isDebug()) {
+                    continue;
+                }
+                writer.newLine();
+                writer.append("   ");
+                writer.append(e.getStatus().toString());
+                writer.append(' ');
+                writer.append(e.getMessage());
+                if (e.getException() != null) {
+                    writer.append(" ");
+                    writer.append(e.getException().toString());
+                }
+            }
+            writer.flush();
+            value = resultWriter.toString();
+        }
+        return value;
+    }
+    
+    /**
      * Add content to our test bundle
      */
     protected void addContent(final TinyBundle bundle, String pathInBundle, String resourcePath) throws IOException {
diff --git a/src/test/java/org/apache/sling/jcr/contentloader/it/I18nInitialContentIT.java b/src/test/java/org/apache/sling/jcr/contentloader/it/I18nInitialContentIT.java
index 64daeee..9eafd13 100644
--- a/src/test/java/org/apache/sling/jcr/contentloader/it/I18nInitialContentIT.java
+++ b/src/test/java/org/apache/sling/jcr/contentloader/it/I18nInitialContentIT.java
@@ -18,14 +18,20 @@
  */
 package org.apache.sling.jcr.contentloader.it;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
+
 import java.io.IOException;
 
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.NodeType;
 
-import com.google.common.collect.ImmutableListMultimap;
-import com.google.common.collect.Multimap;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Configuration;
@@ -35,11 +41,8 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.osgi.framework.Bundle;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.ops4j.pax.exam.CoreOptions.options;
+import com.google.common.collect.ImmutableListMultimap;
+import com.google.common.collect.Multimap;
 
 /**
  * Basic test of a bundle that provides I18N initial content
@@ -56,12 +59,28 @@ public class I18nInitialContentIT extends ContentloaderTestSupport {
             DEFAULT_PATH_IN_BUNDLE, "i18n/en.json.xml"
         );
         final Option bundle = buildInitialContentBundle(header, content);
+        // configure the health check component
+        Option hcConfig = factoryConfiguration("org.apache.sling.jcr.contentloader.hc.BundleContentLoadedCheck")
+            .put("hc.tags", new String[] {TAG_TESTING_CONTENT_LOADING})
+            .asOption();
         return options(
             baseConfiguration(),
+            hcConfig,
             bundle
         );
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.sling.jcr.contentloader.it.ContentloaderTestSupport#setup()
+     */
+    @Before
+    @Override
+    public void setup() throws Exception {
+        super.setup();
+        
+        waitForContentLoaded();
+    }
+    
     @Test
     public void bundleStarted() {
         final Bundle b = findBundle(BUNDLE_SYMBOLICNAME);
diff --git a/src/test/java/org/apache/sling/jcr/contentloader/it/OrderedInitialContentIT.java b/src/test/java/org/apache/sling/jcr/contentloader/it/OrderedInitialContentIT.java
index 64e2ae7..1cfd596 100644
--- a/src/test/java/org/apache/sling/jcr/contentloader/it/OrderedInitialContentIT.java
+++ b/src/test/java/org/apache/sling/jcr/contentloader/it/OrderedInitialContentIT.java
@@ -18,12 +18,15 @@
  */
 package org.apache.sling.jcr.contentloader.it;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
+
 import java.io.IOException;
 
 import javax.jcr.RepositoryException;
 
-import com.google.common.collect.ImmutableListMultimap;
-import com.google.common.collect.Multimap;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Configuration;
@@ -33,8 +36,8 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.osgi.framework.Bundle;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import com.google.common.collect.ImmutableListMultimap;
+import com.google.common.collect.Multimap;
 
 /**
  * Test the SLING-5682 ordered content loading
@@ -50,12 +53,28 @@ public class OrderedInitialContentIT extends ContentloaderTestSupport {
             DEFAULT_PATH_IN_BUNDLE, "ordered-content.ordered-json"
         );
         final Option bundle = buildInitialContentBundle(header, content);
+        // configure the health check component
+        Option hcConfig = factoryConfiguration("org.apache.sling.jcr.contentloader.hc.BundleContentLoadedCheck")
+            .put("hc.tags", new String[] {TAG_TESTING_CONTENT_LOADING})
+            .asOption();
         return new Option[]{
             baseConfiguration(),
+            hcConfig,
             bundle
         };
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.sling.jcr.contentloader.it.ContentloaderTestSupport#setup()
+     */
+    @Before
+    @Override
+    public void setup() throws Exception {
+        super.setup();
+        
+        waitForContentLoaded();
+    }
+    
     @Test
     public void bundleStarted() {
         final Bundle b = findBundle(BUNDLE_SYMBOLICNAME);
diff --git a/src/test/java/org/apache/sling/jcr/contentloader/it/Retry.java b/src/test/java/org/apache/sling/jcr/contentloader/it/Retry.java
new file mode 100644
index 0000000..788eafd
--- /dev/null
+++ b/src/test/java/org/apache/sling/jcr/contentloader/it/Retry.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.jcr.contentloader.it;
+
+import static org.junit.Assert.fail;
+
+/** Simple Retry loop for tests */
+public abstract class Retry {
+
+    public Retry(long timeoutMsec, long nextIterationDelay) throws InterruptedException {
+        final long timeout = System.currentTimeMillis() + timeoutMsec;
+        Throwable lastT = null;
+        while (System.currentTimeMillis() < timeout) {
+            try {
+                lastT = null;
+                exec();
+                break;
+            } catch(Throwable t) {
+                lastT = t;
+                Thread.sleep(nextIterationDelay);               
+            }
+        }
+
+        if (lastT != null) {
+            fail("Failed after " + timeoutMsec + " msec: " + lastT);
+        }
+    }
+
+    protected abstract void exec() throws Exception;
+}
diff --git a/src/test/java/org/apache/sling/jcr/contentloader/it/SLING7268InitialContentIT.java b/src/test/java/org/apache/sling/jcr/contentloader/it/SLING7268InitialContentIT.java
index f7e0e57..83861b4 100644
--- a/src/test/java/org/apache/sling/jcr/contentloader/it/SLING7268InitialContentIT.java
+++ b/src/test/java/org/apache/sling/jcr/contentloader/it/SLING7268InitialContentIT.java
@@ -18,6 +18,11 @@
  */
 package org.apache.sling.jcr.contentloader.it;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
+
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -35,12 +40,11 @@ import javax.jcr.security.AccessControlManager;
 import javax.jcr.security.AccessControlPolicy;
 import javax.jcr.security.Privilege;
 
-import com.google.common.collect.ImmutableListMultimap;
-import com.google.common.collect.Multimap;
 import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.api.security.user.Group;
 import org.apache.jackrabbit.api.security.user.UserManager;
 import org.apache.sling.jcr.base.util.AccessControlUtil;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Configuration;
@@ -50,9 +54,8 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.osgi.framework.Bundle;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import com.google.common.collect.ImmutableListMultimap;
+import com.google.common.collect.Multimap;
 
 /**
  * test of a bundle that provides initial content that creates a user/group and defines an ace
@@ -70,12 +73,28 @@ public class SLING7268InitialContentIT extends ContentloaderTestSupport {
             DEFAULT_PATH_IN_BUNDLE, "SLING-7268.json"
         );
         final Option bundle = buildInitialContentBundle(header, content);
+        // configure the health check component
+        Option hcConfig = factoryConfiguration("org.apache.sling.jcr.contentloader.hc.BundleContentLoadedCheck")
+            .put("hc.tags", new String[] {TAG_TESTING_CONTENT_LOADING})
+            .asOption();
         return new Option[]{
             baseConfiguration(),
+            hcConfig,
             bundle
         };
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.sling.jcr.contentloader.it.ContentloaderTestSupport#setup()
+     */
+    @Before
+    @Override
+    public void setup() throws Exception {
+        super.setup();
+        
+        waitForContentLoaded();
+    }
+    
     @Test
     public void bundleStarted() {
         final Bundle b = findBundle(BUNDLE_SYMBOLICNAME);
diff --git a/src/test/java/org/apache/sling/jcr/contentloader/it/SLING8118InitialContentIT.java b/src/test/java/org/apache/sling/jcr/contentloader/it/SLING8118InitialContentIT.java
index 12c96db..4060b5b 100644
--- a/src/test/java/org/apache/sling/jcr/contentloader/it/SLING8118InitialContentIT.java
+++ b/src/test/java/org/apache/sling/jcr/contentloader/it/SLING8118InitialContentIT.java
@@ -18,6 +18,11 @@
  */
 package org.apache.sling.jcr.contentloader.it;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
+
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -36,13 +41,12 @@ import javax.jcr.security.AccessControlManager;
 import javax.jcr.security.AccessControlPolicy;
 import javax.jcr.security.Privilege;
 
-import com.google.common.collect.ImmutableListMultimap;
-import com.google.common.collect.Multimap;
 import org.apache.jackrabbit.api.security.JackrabbitAccessControlEntry;
 import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.api.security.user.Group;
 import org.apache.jackrabbit.api.security.user.UserManager;
 import org.apache.sling.jcr.base.util.AccessControlUtil;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Configuration;
@@ -52,9 +56,8 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.osgi.framework.Bundle;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import com.google.common.collect.ImmutableListMultimap;
+import com.google.common.collect.Multimap;
 
 /**
  * test of a bundle that provides initial content that defines an ace with restrictions
@@ -70,12 +73,28 @@ public class SLING8118InitialContentIT extends ContentloaderTestSupport {
             DEFAULT_PATH_IN_BUNDLE, "SLING-8118.json"
         );
         final Option bundle = buildInitialContentBundle(header, content);
+        // configure the health check component
+        Option hcConfig = factoryConfiguration("org.apache.sling.jcr.contentloader.hc.BundleContentLoadedCheck")
+            .put("hc.tags", new String[] {TAG_TESTING_CONTENT_LOADING})
+            .asOption();
         return new Option[]{
             baseConfiguration(),
+            hcConfig,
             bundle
         };
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.sling.jcr.contentloader.it.ContentloaderTestSupport#setup()
+     */
+    @Before
+    @Override
+    public void setup() throws Exception {
+        super.setup();
+        
+        waitForContentLoaded();
+    }
+    
     @Test
     public void bundleStarted() {
         final Bundle b = findBundle(BUNDLE_SYMBOLICNAME);