1- /**
2- * Test metrics standard functions
3- *
4- * @group e2e/metrics/standardFunctions
5- */
61import { join } from 'node:path' ;
72import {
83 TestStack ,
@@ -12,6 +7,7 @@ import {
127 CloudWatchClient ,
138 GetMetricStatisticsCommand ,
149} from '@aws-sdk/client-cloudwatch' ;
10+ import { afterAll , beforeAll , describe , expect , it } from 'vitest' ;
1511import { getMetrics , sortDimensions } from '../helpers/metricsUtils.js' ;
1612import { MetricsTestNodejsFunction } from '../helpers/resources.js' ;
1713import {
@@ -72,7 +68,7 @@ describe('Metrics E2E tests, manual usage', () => {
7268
7369 describe ( 'ColdStart metrics' , ( ) => {
7470 it (
75- 'should capture ColdStart Metric' ,
71+ 'captures the ColdStart Metric' ,
7672 async ( ) => {
7773 const { EXPECTED_NAMESPACE : expectedNamespace } = commonEnvironmentVars ;
7874
@@ -92,15 +88,6 @@ describe('Metrics E2E tests, manual usage', () => {
9288 // Check coldstart metric value
9389 const adjustedStartTime = new Date ( startTime . getTime ( ) - 60 * 1000 ) ;
9490 const endTime = new Date ( new Date ( ) . getTime ( ) + 60 * 1000 ) ;
95- console . log (
96- `Manual command: aws cloudwatch get-metric-statistics --namespace ${ expectedNamespace } --metric-name ColdStart --start-time ${ Math . floor (
97- adjustedStartTime . getTime ( ) / 1000
98- ) } --end-time ${ Math . floor (
99- endTime . getTime ( ) / 1000
100- ) } --statistics 'Sum' --period 60 --dimensions '${ JSON . stringify ( [
101- { Name : 'service' , Value : expectedServiceName } ,
102- ] ) } '`
103- ) ;
10491 const coldStartMetricStat = await cloudwatchClient . send (
10592 new GetMetricStatisticsCommand ( {
10693 Namespace : expectedNamespace ,
@@ -125,7 +112,7 @@ describe('Metrics E2E tests, manual usage', () => {
125112
126113 describe ( 'Default and extra dimensions' , ( ) => {
127114 it (
128- 'should produce a Metric with the default and extra one dimensions' ,
115+ 'produces a Metric with the default and extra one dimensions' ,
129116 async ( ) => {
130117 const {
131118 EXPECTED_NAMESPACE : expectedNamespace ,
@@ -165,15 +152,6 @@ describe('Metrics E2E tests, manual usage', () => {
165152 startTime . getTime ( ) - 3 * ONE_MINUTE
166153 ) ;
167154 const endTime = new Date ( new Date ( ) . getTime ( ) + ONE_MINUTE ) ;
168- console . log (
169- `Manual command: aws cloudwatch get-metric-statistics --namespace ${ expectedNamespace } --metric-name ${ expectedMetricName } --start-time ${ Math . floor (
170- adjustedStartTime . getTime ( ) / 1000
171- ) } --end-time ${ Math . floor (
172- endTime . getTime ( ) / 1000
173- ) } --statistics 'Sum' --period 60 --dimensions '${ JSON . stringify (
174- expectedDimensions
175- ) } '`
176- ) ;
177155 const metricStat = await cloudwatchClient . send (
178156 new GetMetricStatisticsCommand ( {
179157 Namespace : expectedNamespace ,
0 commit comments