MaxGekk commented on code in PR #38998:
URL: https://github.com/apache/spark/pull/38998#discussion_r1045013373
##########
core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala:
##########
@@ -147,6 +147,18 @@ class SparkThrowableSuite extends SparkFunSuite {
assert(rereadErrorClassToInfoMap == errorReader.errorInfoMap)
}
+ test("Error class names should contain only capital letters, numbers and
underscores") {
+ val allowedChars = "[A-Z0-9_]*"
+ errorReader.errorInfoMap.foreach { e =>
+ assert(e._1.matches(allowedChars))
Review Comment:
This one doesn't show which error class among 1500 is invalid, see:
```
e._1.matches(allowedChars) was false
ScalaTestFailureLocation: org.apache.spark.SparkThrowableSuite at
(SparkThrowableSuite.scala:153)
org.scalatest.exceptions.TestFailedException: e._1.matches(allowedChars) was
false
```
Could you output the error class name:
```suggestion
assert(e._1.matches(allowedChars), s"The error class is invalid:
${e._1}")
```
##########
core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala:
##########
@@ -147,6 +147,18 @@ class SparkThrowableSuite extends SparkFunSuite {
assert(rereadErrorClassToInfoMap == errorReader.errorInfoMap)
}
+ test("Error class names should contain only capital letters, numbers and
underscores") {
+ val allowedChars = "[A-Z0-9_]*"
+ errorReader.errorInfoMap.foreach { e =>
+ assert(e._1.matches(allowedChars))
+ e._2.subClass.map { s =>
+ s.keys.foreach { k =>
+ assert(k.matches(allowedChars))
Review Comment:
```suggestion
assert(k.matches(allowedChars), s"The error sub-class is invalid:
$k")
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]