Skip to content

Commit

Permalink
Fixing test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
TebaleloS committed Jul 30, 2024
1 parent 9292faa commit e26ce12
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@

package za.co.absa.atum.server.api.database.runs.functions

import doobie.Fragment
import doobie.implicits.toSqlInterpolator
import doobie.util.Read
import za.co.absa.atum.model.dto.AdditionalDataSubmitDTO
import za.co.absa.atum.server.api.database.PostgresDatabaseProvider
import za.co.absa.atum.server.api.database.runs.Runs
import za.co.absa.atum.server.model.PartitioningForDB
import za.co.absa.db.fadb.DBSchema
import za.co.absa.db.fadb.doobie.DoobieFunction.DoobieSingleResultFunctionWithStatus
import za.co.absa.db.fadb.doobie.{DoobieEngine, StatusWithData}
import za.co.absa.db.fadb.doobie.DoobieEngine
import za.co.absa.db.fadb.status.handling.implementations.StandardStatusHandling
import zio._
import zio.interop.catz._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@

package za.co.absa.atum.server.api.database.runs.functions


import doobie.Fragment
import doobie.implicits.toSqlInterpolator
import doobie.util.Read
import za.co.absa.atum.model.dto.PartitioningSubmitDTO
import za.co.absa.atum.server.model.PartitioningForDB
import za.co.absa.db.fadb.DBSchema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

package za.co.absa.atum.server.api.database.runs.functions

import doobie.Fragment
import doobie.implicits.toSqlInterpolator
import doobie.util.Read
import za.co.absa.atum.model.dto.PartitioningDTO
import za.co.absa.atum.server.api.database.PostgresDatabaseProvider
import za.co.absa.atum.server.api.database.runs.Runs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

package za.co.absa.atum.server.api.database.runs.functions

import doobie.Fragment
import doobie.implicits.toSqlInterpolator
import doobie.util.Read
import za.co.absa.atum.model.dto.CheckpointQueryDTO
import za.co.absa.atum.server.api.database.PostgresDatabaseProvider
import za.co.absa.atum.server.api.database.runs.Runs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

package za.co.absa.atum.server.api.database.runs.functions

import doobie.Fragment
import doobie.implicits.toSqlInterpolator
import doobie.util.Read
import za.co.absa.atum.model.dto.{MeasureDTO, PartitioningDTO}
import za.co.absa.atum.server.model.PartitioningForDB
import za.co.absa.db.fadb.DBSchema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package za.co.absa.atum.server.api.database.runs.functions

import doobie.Fragment
import doobie.implicits.toSqlInterpolator
import za.co.absa.atum.model.dto.CheckpointDTO
import za.co.absa.atum.server.model.PartitioningForDB
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2021 ABSA Group Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package za.co.absa.atum.server.model

case class AdditionalDataFromDB (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ import za.co.absa.atum.model.dto.{PartitionDTO, PartitioningDTO}
import za.co.absa.atum.server.ConfigProviderTest
import za.co.absa.atum.server.api.TestTransactorProvider
import za.co.absa.atum.server.api.database.PostgresDatabaseProvider
import za.co.absa.db.fadb.exceptions.DataNotFoundException
import za.co.absa.db.fadb.status.FunctionStatus
import zio._
import zio.interop.catz.asyncInstance
import zio.test._
import zio.test.Assertion._

object GetPartitioningAdditionalDataIntegrationTests extends ConfigProviderTest {
override def spec: Spec[TestEnvironment with Scope, Any] = {
Expand All @@ -32,8 +33,8 @@ object GetPartitioningAdditionalDataIntegrationTests extends ConfigProviderTest
val partitioningDTO: PartitioningDTO = Seq(PartitionDTO("stringA", "stringB"), PartitionDTO("string2", "string2"))
for {
getPartitioningAdditionalData <- ZIO.service[GetPartitioningAdditionalData]
exit <- getPartitioningAdditionalData(partitioningDTO).exit
} yield assert(exit)(failsWithA[doobie.util.invariant.NonNullableColumnRead])
result <- getPartitioningAdditionalData(partitioningDTO)
} yield assertTrue(result == Left(DataNotFoundException(FunctionStatus(41, "Partitioning not found"))))
}
).provide(
GetPartitioningAdditionalData.layer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ object GetPartitioningMeasuresIntegrationTests extends ConfigProviderTest {

suite("GetPartitioningMeasuresSuite")(
test("Returns expected sequence of Measures with existing partitioning") {
val partitioningDTO: PartitioningDTO = Seq(PartitionDTO("string1", "string1"), PartitionDTO("string2", "string2"))
val partitioningDTO: PartitioningDTO = Seq(PartitionDTO("string11", "string11"), PartitionDTO("string12", "string12"))
for {
getPartitioningMeasures <- ZIO.service[GetPartitioningMeasures]
result <- getPartitioningMeasures(partitioningDTO).exit
Expand Down

0 comments on commit e26ce12

Please sign in to comment.