[java-idp-integration-tests] branch main updated: Test fix for consent serialization and record pruning
Tom Zeller
tzeller at dragonacea.biz
Fri Jun 6 13:15:26 UTC 2025
This is an automated email from the git hooks/post-receive script.
tzeller pushed a commit to branch main
in repository java-idp-integration-tests.
View the commit online:
http://git.shibboleth.net/view/?p=java-idp-integration-tests.git;a=commit;h=07704c8a1b5f20892acd030d4e5c61c8f7594494
The following commit(s) were added to refs/heads/main by this push:
new 07704c8 Test fix for consent serialization and record pruning
07704c8 is described below
commit 07704c8a1b5f20892acd030d4e5c61c8f7594494
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Fri Jun 6 08:15:03 2025 -0500
Test fix for consent serialization and record pruning
https://shibboleth.atlassian.net/browse/IDP-2323
---
.../tests/consent/PostgresConsentTest.java | 8 +-
.../consent/PruneRecordsPostgresConsentTest.java | 108 +++++++++++++++++++--
2 files changed, 101 insertions(+), 15 deletions(-)
diff --git a/src/test/java/net/shibboleth/idp/integration/tests/consent/PostgresConsentTest.java b/src/test/java/net/shibboleth/idp/integration/tests/consent/PostgresConsentTest.java
index c2e4610..d244648 100644
--- a/src/test/java/net/shibboleth/idp/integration/tests/consent/PostgresConsentTest.java
+++ b/src/test/java/net/shibboleth/idp/integration/tests/consent/PostgresConsentTest.java
@@ -88,14 +88,8 @@ public class PostgresConsentTest extends BasePostgresConsentTest {
submitForm();
- if (true) {
- sleep(1000);
- }
-
// expect JSON runtime exception for IdP 5.1 (or earlier)
- // TODO remove "5.2" once fixed
- // if (idpVersion.startsWith("5.1")) {
- if (idpVersion.startsWith("5.1") || idpVersion.startsWith("5.2")) {
+ if (idpVersion.startsWith("5.1")) {
waitForPageBodyContains("jakarta.json.stream.JsonParsingException");
return;
}
diff --git a/src/test/java/net/shibboleth/idp/integration/tests/consent/PruneRecordsPostgresConsentTest.java b/src/test/java/net/shibboleth/idp/integration/tests/consent/PruneRecordsPostgresConsentTest.java
index 6c1fa68..a7abdd5 100644
--- a/src/test/java/net/shibboleth/idp/integration/tests/consent/PruneRecordsPostgresConsentTest.java
+++ b/src/test/java/net/shibboleth/idp/integration/tests/consent/PruneRecordsPostgresConsentTest.java
@@ -17,6 +17,7 @@
package net.shibboleth.idp.integration.tests.consent;
+import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -25,6 +26,7 @@ import javax.annotation.Nonnull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import net.shibboleth.idp.integration.tests.util.testng.annotation.LinuxOnly;
@@ -36,21 +38,27 @@ public class PruneRecordsPostgresConsentTest extends BasePostgresConsentTest {
@Nonnull
private final Logger log = LoggerFactory.getLogger(PruneRecordsPostgresConsentTest.class);
- @Test
- @LinuxOnly
- public void testPruneStorageRecords() throws Exception {
-
+ @BeforeClass(dependsOnMethods = { "setUpEndpoints" })
+ public void setUpLocalDynamicSPs() throws Exception {
setUpLocalDynamicSPMetadata(10);
+ }
- startBrowser();
-
- // TODO Assert that idp.consent.expandedMaxStoredRecords = 0
-
+ @BeforeClass(dependsOnMethods = { "setUpIdPPaths" })
+ public void enableTraceConsentLogging() throws IOException {
// Bump consent logging to TRACE
final Path pathToLogbackXML = Paths.get("conf", "logback.xml");
final String oldText = "</configuration>";
final String newText = "<logger name=\"net.shibboleth.idp.consent\" level=\"TRACE\"/>";
replaceIdPHomeFile(pathToLogbackXML, oldText, newText + System.lineSeparator() + oldText);
+ }
+
+ @Test
+ @LinuxOnly
+ public void testPruneStorageRecords() throws Exception {
+
+ startBrowser();
+
+ replaceIdPProperty("idp.consent.expandedMaxStoredRecords", "0");
startServer();
@@ -74,6 +82,8 @@ public class PruneRecordsPostgresConsentTest extends BasePostgresConsentTest {
// response
+ responsePageURLPath = "/sp/SAML2/POST/ACS";
+
waitForResponsePage();
validateResponse();
@@ -121,4 +131,86 @@ public class PruneRecordsPostgresConsentTest extends BasePostgresConsentTest {
Assert.assertEquals(queryDatabase().size(), 6);
}
+ @Test
+ @LinuxOnly
+ public void testPruneStorageRecordsWithInvalidData() throws Exception {
+
+ startBrowser();
+
+ replaceIdPProperty("idp.consent.expandedMaxStoredRecords", "0");
+
+ startServer();
+
+ writeInvalidDataToIndexRecord();
+
+ // log in to sp.example.org
+
+ startFlow();
+
+ waitForLoginPage();
+
+ login();
+
+ // attribute release
+
+ waitForAttributeReleasePage();
+
+ releaseAllAttributes();
+
+ rememberConsent();
+
+ submitForm();
+
+ // response
+
+ responsePageURLPath = "/sp/SAML2/POST/ACS";
+
+ waitForResponsePage();
+
+ validateResponse();
+
+ // log in to sp.example.org again
+
+ startFlow();
+
+ waitForResponsePage();
+
+ validateResponse();
+
+ // log in to more SPs
+
+ loginToLocalDynamicSP("sp1");
+
+ loginToLocalDynamicSP("sp2");
+
+ loginToLocalDynamicSP("sp3");
+
+ loginToLocalDynamicSP("sp4");
+
+ loginToLocalDynamicSP("sp5");
+
+ loginToLocalDynamicSP("sp6");
+
+ loginToLocalDynamicSP("sp7");
+
+ loginToLocalDynamicSP("sp8");
+
+ loginToLocalDynamicSP("sp9");
+
+ // Should be 10 records + 1 index record
+ Assert.assertEquals(queryDatabase().size(), 11);
+
+ stopServer();
+
+ replaceIdPProperty("idp.consent.expandedMaxStoredRecords", "5");
+
+ startServer();
+
+ loginToLocalDynamicSP("sp10");
+
+ // Should be max (5) + 1 records after pruning
+ // but there are 11 since the index records is invalid
+ Assert.assertEquals(queryDatabase().size(), 11);
+ }
+
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list