Skip to content

Commit

Permalink
Print remediations time in e2e tests before deleting far CR
Browse files Browse the repository at this point in the history
Printing remediation time per cr. Whenever one of the e2e tests we could still know the remediation time of the successful remediations by printing independently
  • Loading branch information
razo7 committed Dec 12, 2023
1 parent bf4667f commit d58949c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/e2e/far_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ var _ = Describe("FAR E2e", func() {

startTime = time.Now()
far := createFAR(nodeName, fenceAgent, testShareParam, testNodeParam)
DeferCleanup(deleteFAR, far)
DeferCleanup(deleteFAR, startTime, far)
})
When("running FAR to reboot two nodes", func() {
It("should successfully remediate the first node", func() {
Expand All @@ -148,7 +148,7 @@ var _ = Describe("FAR E2e", func() {
averageTimeDuration += remTime.Seconds()
fmt.Printf("\nRemediation time #%d: %s\n", index+1, remTime)
}
averageTime := int(averageTimeDuration)/ len(remediationTimes)
averageTime := int(averageTimeDuration) / len(remediationTimes)
fmt.Printf("\nAverage remediation time: %d minutes and %d seconds\n", averageTime/60, averageTime%60)
}
})
Expand Down Expand Up @@ -266,7 +266,8 @@ func createFAR(nodeName string, agent string, sharedParameters map[v1alpha1.Para
}

// deleteFAR deletes the CR with offset
func deleteFAR(far *v1alpha1.FenceAgentsRemediation) {
func deleteFAR(startTime time.Time, far *v1alpha1.FenceAgentsRemediation) {
fmt.Printf("\nRemediation time: %s\n\n", time.Since(startTime))
EventuallyWithOffset(1, func() error {
err := k8sClient.Delete(context.Background(), far)
if apiErrors.IsNotFound(err) {
Expand Down

0 comments on commit d58949c

Please sign in to comment.