-
Notifications
You must be signed in to change notification settings - Fork 17
/
DisableEnhancedMonitoringTests.scala
48 lines (42 loc) · 1.39 KB
/
DisableEnhancedMonitoringTests.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package kinesis.mock
import scala.jdk.CollectionConverters._
import java.util.stream.Collectors
import software.amazon.awssdk.services.kinesis.model._
import kinesis.mock.syntax.javaFuture._
class DisableEnhancedMonitoringTests extends AwsFunctionalTests {
fixture.test("It should disable enhanced monitoring") { resources =>
for {
_ <- resources.kinesisClient
.enableEnhancedMonitoring(
EnableEnhancedMonitoringRequest
.builder()
.shardLevelMetrics(MetricsName.ALL)
.streamName(resources.streamName.streamName)
.build()
)
.toIO
res <- resources.kinesisClient
.disableEnhancedMonitoring(
DisableEnhancedMonitoringRequest
.builder()
.shardLevelMetrics(MetricsName.INCOMING_BYTES)
.streamName(resources.streamName.streamName)
.build()
)
.toIO
streamMonitoring <- describeStreamSummary(resources).map(
_.streamDescriptionSummary()
.enhancedMonitoring()
.stream()
.flatMap(x => x.shardLevelMetrics().stream())
.collect(Collectors.toList[MetricsName])
)
} yield assert(
res.desiredShardLevelMetrics == streamMonitoring && !res
.desiredShardLevelMetrics()
.asScala
.contains(MetricsName.INCOMING_BYTES),
s"$res\n$streamMonitoring"
)
}
}