@@ -21,7 +21,7 @@ import za.co.absa.statusboard.config.RepositoriesConfig
2121import za .co .absa .statusboard .model .AppError .DatabaseError .RecordNotFoundDatabaseError
2222import za .co .absa .statusboard .model .{RawStatus , RefinedStatus }
2323import za .co .absa .statusboard .providers .DynamoDbProvider
24- import za .co .absa .statusboard .testUtils .TestData .rawStatusRed
24+ import za .co .absa .statusboard .testUtils .TestData .{ rawStatusGreen , rawStatusRed }
2525import za .co .absa .statusboard .testUtils .{ConfigProviderSpec , TestData }
2626import za .co .absa .statusboard .utils .DynamoDbUtils .DynamoDbExtensions
2727import zio ._
@@ -52,7 +52,6 @@ object DynamoDbStatusRepositoryDynamoDBIntegrationTests extends ConfigProviderSp
5252 status = RawStatus .Black (),
5353 serviceName = " Dead Test Service" )
5454
55-
5655 override def spec : Spec [TestEnvironment with Scope , Any ] = {
5756 suite(" DynamoDbStatusRepositorySuite" )(
5857 test(" getLatestStatus should retrieve nothing when no state exist" ) {
@@ -167,6 +166,37 @@ object DynamoDbStatusRepositoryDynamoDBIntegrationTests extends ConfigProviderSp
167166 assertZIO(StatusRepository .getLatestStatusOfAllActiveConfigurations())(
168167 equalTo(Set (refinedStatusAnotherService, refinedStatusAnotherRenamed))
169168 )
169+ },
170+ test(" BUG #10 Latest Notified Retrieval 2025-06-11" ) {
171+ val refinedStatus_A : RefinedStatus = RefinedStatus (
172+ serviceName = " BugService" ,
173+ env = " BUG #10" ,
174+ status = RawStatus .Green (" 1 FAIL" ),
175+ maintenanceMessage = " " ,
176+ firstSeen = Instant .parse(" 2025-05-21T12:14:42.030Z" ),
177+ lastSeen = Instant .parse(" 2025-05-21T12:16:31.711Z" ),
178+ notificationSent = true
179+ )
180+
181+ val refinedStatus_B : RefinedStatus = refinedStatus_A.copy(
182+ status = RawStatus .Green (" 2 OK" ),
183+ firstSeen = Instant .parse(" 2025-05-21T12:17:08.006Z" ),
184+ lastSeen = Instant .parse(" 2025-06-11T02:00:21.191Z" ),
185+ notificationSent = true
186+ )
187+
188+ val refinedStatus_C : RefinedStatus = refinedStatus_A.copy(
189+ status = RawStatus .Red (" 3 FAIL" , true ),
190+ firstSeen = Instant .parse(" 2025-06-11T02:10:41.219Z" ),
191+ lastSeen = Instant .parse(" 2025-06-11T02:10:41.219Z" ),
192+ notificationSent = false
193+ )
194+ for {
195+ _ <- StatusRepository .createOrUpdate(refinedStatus_A)
196+ _ <- StatusRepository .createOrUpdate(refinedStatus_B)
197+ _ <- StatusRepository .createOrUpdate(refinedStatus_C)
198+ result <- StatusRepository .getLatestNotifiedStatus(" BUG #10" , " BugService" )
199+ } yield assert(result.status)(equalTo(RawStatus .Green (" 2 OK" )))
170200 }
171201 ) @@
172202 TestAspect .sequential @@
0 commit comments