Skip to content

Commit

Permalink
test: try to fix ci test problem
Browse files Browse the repository at this point in the history
  • Loading branch information
QuadStingray committed Jan 30, 2025
1 parent 11d09b5 commit f56f934
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main_test_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
mongodb-version: ['4.4', '5.0', '6.0', '7.0']
mongodb-version: ['4.4', '5.0', '6.0', '7.0', '8.0']
java: [ '21', '23' ]
steps:
- uses: actions/checkout@main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/other_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
mongodb-version: [ '4.4', '5.0', '6.0', '7.0' ]
mongodb-version: [ '4.4', '5.0', '6.0', '7.0', '8.0' ]
java: [ '21', '23' ]
steps:
- uses: actions/checkout@main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,20 +218,17 @@ object LuceneQueryConverter extends LazyLogging {
val convertedValue: Option[Any] =
(List() ++ checkOrReturn(() => s.toDouble) ++ checkOrReturn(() => s.toLong) ++ checkOrReturn(() => s.toBoolean)).headOption
convertedValue.getOrElse({
val parsedOptions: Option[Date] = datePatters
.map(pattern => {
try {
val formatter = new SimpleDateFormat(pattern)
Option(formatter.parse(s))
}
catch {
case _: Exception =>
None
}
})
.find(_.nonEmpty)
.flatten
parsedOptions.getOrElse(s)
val parsedOptions: List[Date] = datePatters.flatMap(pattern => {
try {
val formatter = new SimpleDateFormat(pattern)
Option(formatter.parse(s))
}
catch {
case _: Exception =>
None
}
})
parsedOptions.headOption.getOrElse(s)
})
}
catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@ class LuceneSearchSpec extends PersonSpecification {
}

"between filter for date value" in {
val luceneQuery = LuceneQueryConverter.parse("[2014-04-19T22:00:00Z TO 2014-04-22T23:59:59Z]", "registered")
val luceneQuery = LuceneQueryConverter.parse("[2014-04-20T00:00:00Z TO 2014-04-22T23:59:59Z]", "registered")
val luceneDocument = LuceneQueryConverter.toDocument(luceneQuery)
luceneDocument.toString must beEqualTo("Iterable((registered,{\"$lte\": {\"$date\": \"2014-04-22T21:59:59Z\"}, \"$gte\": {\"$date\": \"2014-04-19T22:00:00Z\"}}))")
val expected = "Iterable((registered,{\"$lte\": {\"$date\": \"2014-04-22T23:59:59Z\"}, \"$gte\": {\"$date\": \"2014-04-20T00:00:00Z\"}}))"
println(luceneDocument.toString)
println(expected)
luceneDocument.toString must beEqualTo(expected)
val search = PersonDAO.find(luceneDocument, sortByBalance).resultList()
search must haveSize(10)
search.head.age mustEqual 25
search.head.name mustEqual "Allison Turner"
search.head.balance mustEqual 3961.0
true mustEqual false
}

"equals Query with Date" in {
Expand Down

0 comments on commit f56f934

Please sign in to comment.