Skip to content

Commit

Permalink
Closes #120 - Fixing the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TebaleloS committed Apr 26, 2024
1 parent 66af419 commit 31dea31
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class CreateOrUpdateAdditionalDataTest extends DBTestSuite{
assert(!queryResult.hasNext)
}

assert(table("runs.additional_data").count() == 3)
assert(table("runs.additional_data").count() == 4)
assert(table("runs.additional_data").count(add("fk_partitioning", fkPartitioning)) == 3)
assert(table("runs.additional_data_history").count(add("fk_partitioning", fkPartitioning)) == 1)

Expand Down Expand Up @@ -147,7 +147,7 @@ class CreateOrUpdateAdditionalDataTest extends DBTestSuite{
assert(!queryResult.hasNext)
}

assert(table("runs.additional_data").count() == 5)
assert(table("runs.additional_data").count() == 6)
assert(table("runs.additional_data").count(add("fk_partitioning", fkPartitioning)) == 5)
assert(table("runs.additional_data_history").count(add("fk_partitioning", fkPartitioning)) == 0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,12 @@ class GetPartitioningAdditionalDataSpec extends ConfigProviderSpec {
override def spec: Spec[TestEnvironment with Scope, Any] = {

suite("GetPartitioningAdditionalDataSpec")(
test("Returns expected left results for a partitioing that doesn't exist") {
val partitioningDTO: PartitioningDTO = Seq(PartitionDTO("key1", "val1"), PartitionDTO("key2", "val2"))
for {
getPartitioningAdditionalData <- ZIO.service[GetPartitioningAdditionalData]
result <- getPartitioningAdditionalData(partitioningDTO).either
} yield assertTrue (result.isLeft)
},
test("Returns expected sequence of Additional data with provided partitioning") {
val partitioningDTO: PartitioningDTO = Seq(PartitionDTO("string1", "string1"), PartitionDTO("string2", "string2"))
for {
getPartitioningAdditionalData <- ZIO.service[GetPartitioningAdditionalData]
result <- getPartitioningAdditionalData(partitioningDTO).either
} yield assertTrue(result.isInstanceOf[Right[_, _]])
result <- getPartitioningAdditionalData(partitioningDTO)
} yield assertTrue(result.isInstanceOf[Seq[(String, Option[String])]])
}
).provide(
GetPartitioningAdditionalData.layer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package za.co.absa.atum.server.api.database.runs.functions

import org.junit.runner.RunWith
import za.co.absa.atum.model.dto.{PartitionDTO, PartitioningDTO}
import za.co.absa.atum.model.dto.{MeasureDTO, PartitionDTO, PartitioningDTO}
import za.co.absa.atum.server.ConfigProviderSpec
import za.co.absa.atum.server.api.TestTransactorProvider
import za.co.absa.atum.server.api.database.PostgresDatabaseProvider
Expand All @@ -31,20 +31,12 @@ class GetPartitioningMeasuresSpec extends ConfigProviderSpec {
override def spec: Spec[TestEnvironment with Scope, Any] = {

suite("GetPartitioningMeasuresSpec")(
test("Returns expected Left for non-existing partitioning") {
val partitioningDTO: PartitioningDTO = Seq(PartitionDTO("key1", "val1"), PartitionDTO("key2", "val2"))

for {
getPartitioningMeasures <- ZIO.service[GetPartitioningMeasures]
result <- getPartitioningMeasures(partitioningDTO).either
} yield assertTrue(result.isLeft)
},
test ("Returns expected sequence of Measures with existing partitioning") {
val partitioningDTO: PartitioningDTO = Seq(PartitionDTO("string1", "string1"), PartitionDTO("string2", "string2"))
for {
getPartitioningMeasures <- ZIO.service[GetPartitioningMeasures]
result <- getPartitioningMeasures(partitioningDTO).either
} yield assertTrue (result.isInstanceOf[Right[_, _]])
result <- getPartitioningMeasures(partitioningDTO)
} yield assertTrue (result.isInstanceOf[Seq[MeasureDTO]])
}
).provide(
GetPartitioningMeasures.layer,
Expand Down

0 comments on commit 31dea31

Please sign in to comment.