Use framework.ExpectEqual() in unit test

Signed-off-by: clarklee92 <clarklee1992@hotmail.com>
This commit is contained in:
clarklee92
2019-11-06 13:57:13 +08:00
parent 0c0408c790
commit 7ce12844d2
3 changed files with 17 additions and 13 deletions

View File

@@ -21,6 +21,8 @@ import (
"time"
"github.com/onsi/gomega"
"k8s.io/kubernetes/test/e2e/framework"
)
var currentTime time.Time
@@ -64,9 +66,9 @@ func TestTimer(t *testing.T) {
}
]
}`))
gomega.Expect(timer.PrintHumanReadable()).To(gomega.Equal(`Phase 001-one: 5.5s so far
framework.ExpectEqual(timer.PrintHumanReadable(), `Phase 001-one: 5.5s so far
Phase 033-two: 3.5s
`))
`)
setCurrentTimeSinceEpoch(7*time.Second + 500*time.Millisecond)
phaseOne.End()
@@ -86,7 +88,7 @@ Phase 033-two: 3.5s
}
]
}`))
gomega.Expect(timer.PrintHumanReadable()).To(gomega.Equal(`Phase 001-one: 6.5s
framework.ExpectEqual(timer.PrintHumanReadable(), `Phase 001-one: 6.5s
Phase 033-two: 3.5s
`))
`)
}