Skip to content

Commit

Permalink
#476 Add test suites for the new feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
yruslan committed Aug 27, 2024
1 parent 9e13025 commit de1ecde
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 57 deletions.
5 changes: 3 additions & 2 deletions pramen/core/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@ pramen {
notifications {
# The maximum length in characters of the Reason field in the completed tasks table.
reason.max.length = 1024
# The maximum length of errors and exceptions in the notification body.
body.error.max.length = 32758
# The maximum length of errors and exceptions in the notification body. The default value is selected
# so that Pramen can handle at least 100 exceptions in a single email notification.
exception.max.length = 65536
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import com.typesafe.config.Config
import za.co.absa.pramen.api.notification.NotificationEntry.Paragraph
import za.co.absa.pramen.api.notification.{Style, TableHeader, TextElement}
import za.co.absa.pramen.core.exceptions.OsSignalException
import za.co.absa.pramen.core.notify.pipeline.PipelineNotificationBuilderHtml.NOTIFICATION_ERROR_MAX_LENGTH_KEY
import za.co.absa.pramen.core.notify.pipeline.PipelineNotificationBuilderHtml.NOTIFICATION_EXCEPTION_MAX_LENGTH_KEY
import za.co.absa.pramen.core.utils.{ConfigUtils, ResourceUtils}
import za.co.absa.pramen.core.utils.StringUtils.{renderThreadDumps, renderThrowable}

Expand All @@ -29,7 +29,7 @@ import scala.compat.Platform.EOL

class MessageBuilderHtml(conf: Config) extends MessageBuilder {
private val style = ResourceUtils.getResourceString("/email_template/style.css")
private val maxExceptionLength = ConfigUtils.getOptionInt(conf, NOTIFICATION_ERROR_MAX_LENGTH_KEY)
private val maxExceptionLength = ConfigUtils.getOptionInt(conf, NOTIFICATION_EXCEPTION_MAX_LENGTH_KEY)
private val body = new ListBuffer[String]

override def withParagraph(text: Seq[TextElement]): MessageBuilderHtml = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ object PipelineNotificationBuilderHtml {
val MIN_RPS_RECORDS = 1000
val MIN_MEGABYTES = 10
val NOTIFICATION_REASON_MAX_LENGTH_KEY = "pramen.notifications.reason.max.length"
val NOTIFICATION_ERROR_MAX_LENGTH_KEY = "pramen.notifications.body.error.max.length"
val NOTIFICATION_EXCEPTION_MAX_LENGTH_KEY = "pramen.notifications.exception.max.length"
}

class PipelineNotificationBuilderHtml(implicit conf: Config) extends PipelineNotificationBuilder {
Expand All @@ -57,7 +57,7 @@ class PipelineNotificationBuilderHtml(implicit conf: Config) extends PipelineNot
private var goodRps = Int.MaxValue

private val maxReasonLength = ConfigUtils.getOptionInt(conf, NOTIFICATION_REASON_MAX_LENGTH_KEY)
private val maxExceptionLength = ConfigUtils.getOptionInt(conf, NOTIFICATION_ERROR_MAX_LENGTH_KEY)
private val maxExceptionLength = ConfigUtils.getOptionInt(conf, NOTIFICATION_EXCEPTION_MAX_LENGTH_KEY)

var appException: Option[Throwable] = None
var warningFlag: Boolean = false
Expand Down
Loading

0 comments on commit de1ecde

Please sign in to comment.