You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2025/11/24 18:23:17 UTC

(sling-org-apache-sling-launchpad-integration-tests) branch experimental/SLING-12600-flakyness-tests created (now 96197b8)

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

sseifert pushed a change to branch experimental/SLING-12600-flakyness-tests
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-launchpad-integration-tests.git


      at 96197b8  SLING-12600 ensure most app scripts are uploaded to unique folder with unique resource type

This branch includes the following new commits:

     new 96197b8  SLING-12600 ensure most app scripts are uploaded to unique folder with unique resource type

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(sling-org-apache-sling-launchpad-integration-tests) 01/01: SLING-12600 ensure most app scripts are uploaded to unique folder with unique resource type

Posted by ss...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sseifert pushed a commit to branch experimental/SLING-12600-flakyness-tests
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-launchpad-integration-tests.git

commit 96197b8111592a0b0bc426c4d40460a484549b87
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Mon Nov 24 19:23:10 2025 +0100

    SLING-12600 ensure most app scripts are uploaded to unique folder with unique resource type
---
 pom.xml                                            |  2 +-
 .../webapp/integrationtest/ForwardTest.java        |  5 ++-
 .../webapp/integrationtest/GetWithSuffixTest.java  |  6 +++-
 .../webapp/integrationtest/IncludeTest.java        |  5 ++-
 .../webapp/integrationtest/JspForwardTest.java     |  5 ++-
 .../NodeTypeBasedRenderingTest.java                |  3 +-
 .../integrationtest/NodetypeRenderingTest.java     |  5 ++-
 .../integrationtest/RequestAttributeTest.java      |  8 +++--
 .../integrationtest/util/UniqueResourceType.java   | 37 ++++++++++++++++++++++
 9 files changed, 66 insertions(+), 10 deletions(-)

diff --git a/pom.xml b/pom.xml
index 68629df..8f75111 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
     </parent>
 
     <artifactId>org.apache.sling.launchpad.integration-tests</artifactId>
-    <version>14-SNAPSHOT</version>
+    <version>14.test-SNAPSHOT</version>
     <packaging>jar</packaging>
 
     <name>Apache Sling Launchpad Integration Tests</name>
diff --git a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/ForwardTest.java b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/ForwardTest.java
index fa48793..825d7e4 100644
--- a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/ForwardTest.java
+++ b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/ForwardTest.java
@@ -26,6 +26,7 @@ import java.util.Set;
 
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.sling.commons.testing.integration.HttpTestBase;
+import org.apache.sling.launchpad.webapp.integrationtest.util.UniqueResourceType;
 import org.apache.sling.servlets.post.SlingPostConstants;
 
 /** Test the {link ScriptHelper#forward) functionality */
@@ -48,12 +49,14 @@ public class ForwardTest extends HttpTestBase {
 
         // Create the test nodes under a path that's specific to this class to
         // allow collisions
+        UniqueResourceType urt = new UniqueResourceType();
         final String url = HTTP_BASE_URL + "/" + getClass().getSimpleName() + "/" + System.currentTimeMillis()
                 + SlingPostConstants.DEFAULT_CREATE_SUFFIX;
         final Map<String, String> props = new HashMap<String, String>();
 
         // Create two test nodes and store their paths
         testTextA = "Text A " + System.currentTimeMillis();
+        props.put("sling:resourceType", urt.getResourceType());
         props.put("text", testTextA);
         nodeUrlA = testClient.createNode(url, props);
         String pathToInclude = nodeUrlA.substring(HTTP_BASE_URL.length());
@@ -87,7 +90,7 @@ public class ForwardTest extends HttpTestBase {
         toDelete.add(uploadTestScript(scriptPath, "forward-forced.esp", "html.esp"));
 
         // The main rendering script goes under /apps in the repository
-        scriptPath = "/apps/nt/unstructured";
+        scriptPath = urt.getScriptPath();
         testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);
         toDelete.add(uploadTestScript(scriptPath, "forward-test.esp", "html.esp"));
     }
diff --git a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/GetWithSuffixTest.java b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/GetWithSuffixTest.java
index f1268b9..3b8967b 100644
--- a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/GetWithSuffixTest.java
+++ b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/GetWithSuffixTest.java
@@ -24,6 +24,8 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.sling.launchpad.webapp.integrationtest.util.UniqueResourceType;
+
 /** GET requests with a suffix should fail with a 404, otherwise
  *  we get a lot of extra possible URLs which point to the same
  *  content.
@@ -38,13 +40,15 @@ public class GetWithSuffixTest extends RenderingTestBase {
         testText = "This is a test " + System.currentTimeMillis();
 
         // create the test node, under a path that's specific to this class to allow collisions
+        UniqueResourceType urt = new UniqueResourceType();
         final String url = HTTP_BASE_URL + "/" + getClass().getSimpleName() + "_" + System.currentTimeMillis();
         final Map<String, String> props = new HashMap<String, String>();
+        props.put("sling:resourceType", urt.getResourceType());
         props.put("text", testText);
         displayUrl = testClient.createNode(url, props);
 
         // the rendering script goes under /apps in the repository
-        scriptPath = "/apps/nt/unstructured";
+        scriptPath = urt.getScriptPath();
         testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);
     }
 
diff --git a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/IncludeTest.java b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/IncludeTest.java
index 83fd029..e0e9978 100644
--- a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/IncludeTest.java
+++ b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/IncludeTest.java
@@ -26,6 +26,7 @@ import java.util.Set;
 
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.sling.commons.testing.integration.HttpTestBase;
+import org.apache.sling.launchpad.webapp.integrationtest.util.UniqueResourceType;
 import org.apache.sling.servlets.post.SlingPostConstants;
 
 /** Test the {link ScriptHelper#include) functionality */
@@ -52,7 +53,9 @@ public class IncludeTest extends HttpTestBase {
         final Map<String, String> props = new HashMap<String, String>();
 
         // Create two test nodes and store their paths
+        UniqueResourceType urt = new UniqueResourceType();
         testTextA = "Text A " + System.currentTimeMillis();
+        props.put("sling:resourceType", urt.getResourceType());
         props.put("text", testTextA);
         nodeUrlA = testClient.createNode(url, props);
         String pathToInclude = nodeUrlA.substring(HTTP_BASE_URL.length());
@@ -86,7 +89,7 @@ public class IncludeTest extends HttpTestBase {
         toDelete.add(uploadTestScript(scriptPath, "include-forced.esp", "html.esp"));
 
         // The main rendering script goes under /apps in the repository
-        scriptPath = "/apps/nt/unstructured";
+        scriptPath = urt.getScriptPath();
         testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);
         toDelete.add(uploadTestScript(scriptPath, "include-test.esp", "html.esp"));
     }
diff --git a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspForwardTest.java b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspForwardTest.java
index 9cd09ba..6dc8dbb 100644
--- a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspForwardTest.java
+++ b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspForwardTest.java
@@ -28,6 +28,7 @@ import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.sling.commons.testing.integration.HttpTest;
 import org.apache.sling.commons.testing.junit.Retry;
 import org.apache.sling.commons.testing.junit.RetryRule;
+import org.apache.sling.launchpad.webapp.integrationtest.util.UniqueResourceType;
 import org.apache.sling.servlets.post.SlingPostConstants;
 import org.junit.After;
 import org.junit.Before;
@@ -68,7 +69,9 @@ public class JspForwardTest {
         final Map<String, String> props = new HashMap<String, String>();
 
         // Create two test nodes and store their paths
+        UniqueResourceType urt = new UniqueResourceType();
         testTextA = "Text A " + System.currentTimeMillis();
+        props.put("sling:resourceType", urt.getResourceType());
         props.put("text", testTextA);
         nodeUrlA = H.getTestClient().createNode(url, props);
         String pathToInclude = nodeUrlA.substring(HttpTest.HTTP_BASE_URL.length());
@@ -108,7 +111,7 @@ public class JspForwardTest {
         toDelete.add(H.uploadTestScript(scriptPath, "forward-forced.jsp", "html.jsp"));
 
         // The main rendering script goes under /apps in the repository
-        scriptPath = "/apps/nt/unstructured";
+        scriptPath = urt.getScriptPath();
         H.getTestClient().mkdirs(HttpTest.WEBDAV_BASE_URL, scriptPath);
         toDelete.add(H.uploadTestScript(scriptPath, "forward-test.jsp", "html.jsp"));
     }
diff --git a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/NodeTypeBasedRenderingTest.java b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/NodeTypeBasedRenderingTest.java
index 274880e..8cf2c05 100644
--- a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/NodeTypeBasedRenderingTest.java
+++ b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/NodeTypeBasedRenderingTest.java
@@ -27,7 +27,8 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 /** Test rendering resources based on their JCR node type */
 public class NodeTypeBasedRenderingTest extends RenderingTestBase {
-    public static final String TEST_PATH = "/testing/" + NodeTypeBasedRenderingTest.class.getSimpleName();
+    public static final String TEST_PATH =
+            "/testing/" + NodeTypeBasedRenderingTest.class.getSimpleName() + "/" + System.currentTimeMillis();
     private String testNodeUrl;
     private List<String> toDelete = new ArrayList<String>();
     private static AtomicInteger counter = new AtomicInteger();
diff --git a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/NodetypeRenderingTest.java b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/NodetypeRenderingTest.java
index e84e430..fb1f75c 100644
--- a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/NodetypeRenderingTest.java
+++ b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/NodetypeRenderingTest.java
@@ -22,6 +22,7 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.sling.launchpad.webapp.integrationtest.util.UniqueResourceType;
 import org.apache.sling.servlets.post.SlingPostConstants;
 
 /** Test creating a Node and rendering it using scripts in
@@ -40,15 +41,17 @@ public class NodetypeRenderingTest extends RenderingTestBase {
         testText = "This is a test " + System.currentTimeMillis();
 
         // create the test node, under a path that's specific to this class to allow collisions
+        UniqueResourceType urt = new UniqueResourceType();
         secondFolderOfContentPath = "" + System.currentTimeMillis();
         final String url = HTTP_BASE_URL + "/" + getClass().getSimpleName() + "/" + secondFolderOfContentPath
                 + SlingPostConstants.DEFAULT_CREATE_SUFFIX;
         final Map<String, String> props = new HashMap<String, String>();
+        props.put("sling:resourceType", urt.getResourceType());
         props.put("text", testText);
         displayUrl = testClient.createNode(url, props);
 
         // the rendering script goes under /apps in the repository
-        scriptPath = "/apps/nt/unstructured";
+        scriptPath = urt.getScriptPath();
         testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);
     }
 
diff --git a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/RequestAttributeTest.java b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/RequestAttributeTest.java
index fbb7078..cf874b6 100644
--- a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/RequestAttributeTest.java
+++ b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/RequestAttributeTest.java
@@ -27,6 +27,7 @@ import java.util.Properties;
 import java.util.Set;
 
 import org.apache.sling.commons.testing.integration.HttpTestBase;
+import org.apache.sling.launchpad.webapp.integrationtest.util.UniqueResourceType;
 import org.apache.sling.servlets.post.SlingPostConstants;
 
 /**
@@ -56,17 +57,18 @@ public class RequestAttributeTest extends HttpTestBase {
         final Map<String, String> props = new HashMap<String, String>();
 
         // Create two test nodes and store their paths
+        UniqueResourceType urt = new UniqueResourceType();
         props.put("text", "texta");
-        props.put("jcr:primaryType", "nt:unstructured");
+        props.put("sling:resourceType", urt.getResourceType());
         nodeUrlA = testClient.createNode(url, props);
 
         props.clear();
         props.put("text", "textb");
-        props.put("jcr:primaryType", "nt:unstructured");
+        props.put("sling:resourceType", urt.getResourceType());
         nodeUrlB = testClient.createNode(nodeUrlA + "/child", props);
 
         // The main rendering script goes under /apps in the repository
-        scriptPath = "/apps/nt/unstructured";
+        scriptPath = urt.getScriptPath();
         testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);
         toDelete.add(uploadTestScript(scriptPath, "request-attribute-test.esp", "txt.esp"));
         toDelete.add(uploadTestScript(scriptPath, "request-attribute-test-sel1.esp", "sel1.txt.esp"));
diff --git a/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/UniqueResourceType.java b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/UniqueResourceType.java
new file mode 100644
index 0000000..2c92eb4
--- /dev/null
+++ b/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/util/UniqueResourceType.java
@@ -0,0 +1,37 @@
+/*
+ * 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.launchpad.webapp.integrationtest.util;
+
+import java.util.UUID;
+
+/**
+ * Use a unique resource type for each unit test to avoid interference (SLING-12600).
+ */
+public class UniqueResourceType {
+
+    private final String uid = UUID.randomUUID().toString();
+
+    public String getResourceType() {
+        return "test/rt-" + uid;
+    }
+
+    public String getScriptPath() {
+        return "/apps/" + getResourceType();
+    }
+}