Skip to content

Commit

Permalink
Add duration metrics for each test case
Browse files Browse the repository at this point in the history
  • Loading branch information
d8660091 committed Jun 5, 2024
1 parent a523231 commit d872d70
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
14 changes: 13 additions & 1 deletion internal/test/e2e/cloudwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,19 @@ func putInstanceTestResultMetrics(r instanceTestsResults) {
putMetric(data, "FailedInstanceTests", failedCount)
putMetric(data, "SucceededInstanceTests", succeededCount)

// TODO: publish time metrics
data.Dimensions = []*cloudwatch.Dimension{
{
Name: aws.String("TestName"),
Value: aws.String(r.conf.Regex),
},
{
Name: aws.String("BranchName"),
Value: aws.String(r.conf.BranchName),
},
}
data.Unit = aws.String(cloudwatch.StandardUnitSeconds)
putMetric(data, "Duration", int(r.endTime)-int(r.startTime))

logger.Info("Test instance metrics published")
}

Expand Down
5 changes: 4 additions & 1 deletion internal/test/e2e/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ type (
conf instanceRunConf
testCommandResult *testCommandResult
err error
startTime int64
endTime int64
}
)

Expand Down Expand Up @@ -123,13 +125,14 @@ func RunTestsInParallel(conf ParallelRunConf) error {
go func() {
defer wg.Done()
for c := range work {
r := instanceTestsResults{conf: c}
r := instanceTestsResults{conf: c, startTime: time.Now().Unix()}

r.conf.InstanceID, r.testCommandResult, err = RunTests(c, invCatalogue)
if err != nil {
r.err = err
}

r.endTime = time.Now().Unix()
results <- r
}
}()
Expand Down

0 comments on commit d872d70

Please sign in to comment.