Skip to content

Commit

Permalink
[QE] limit log size for test reports
Browse files Browse the repository at this point in the history
  • Loading branch information
Alberto Fanjul authored and anjannath committed Oct 28, 2024
1 parent e4fe4f1 commit aea4f39
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
25 changes: 18 additions & 7 deletions images/build-e2e/common/filter.xsl
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>

<!-- identity transform -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>

<xsl:template match="failure">
<xsl:copy>
<xsl:value-of select="@message"/>
</xsl:copy>
<xsl:variable name="max" select="1000000" />
<xsl:variable name="length" select="string-length(@message)" />
<xsl:choose>
<xsl:when test="$length > $max">
<xsl:variable name="first" select="substring(@message, 0, floor($max div 2))" />
<xsl:variable name="second" select="substring(@message, $length - floor($max div 2), $length)" />
<xsl:copy>
<xsl:value-of select="concat($first, '\n...\n', $second)"/>
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:value-of select="@message"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>
25 changes: 18 additions & 7 deletions images/build-integration/common/filter.xsl
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>

<!-- identity transform -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>

<xsl:template match="failure">
<xsl:copy>
<xsl:value-of select="@message"/>
</xsl:copy>
<xsl:variable name="max" select="1000000" />
<xsl:variable name="length" select="string-length(@message)" />
<xsl:choose>
<xsl:when test="$length > $max">
<xsl:variable name="first" select="substring(@message, 0, floor($max div 2))" />
<xsl:variable name="second" select="substring(@message, $length - floor($max div 2), $length)" />
<xsl:copy>
<xsl:value-of select="concat($first, '\n...\n', $second)"/>
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:value-of select="@message"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>

0 comments on commit aea4f39

Please sign in to comment.