MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / TestStartStopProfile

Function TestStartStopProfile

utils/profiler_test.go:31–64  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

29)
30
31func TestStartStopProfile(t *testing.T) {
32 Convey("start normally", t, func() {
33 defer os.Remove(cpuProfile)
34 defer os.Remove(memProfile)
35 err := StartProfile(cpuProfile, memProfile)
36 So(err, ShouldBeNil)
37
38 StopProfile()
39 cpuFileInfo, err := os.Stat(cpuProfile)
40 So(cpuFileInfo.Size(), ShouldBeGreaterThan, 0)
41 So(err, ShouldBeNil)
42
43 memFileInfo, err := os.Stat(memProfile)
44 So(memFileInfo.Size(), ShouldBeGreaterThan, 0)
45 So(err, ShouldBeNil)
46 })
47 Convey("start empty", t, func() {
48 err := StartProfile("", "")
49 So(err, ShouldBeNil)
50
51 StopProfile()
52 })
53 Convey("start no such path", t, func() {
54 err := StartProfile("/not/exist/path", "")
55 So(err, ShouldNotBeNil)
56
57 StopProfile()
58
59 err = StartProfile("", "/not/exist/path")
60 So(err, ShouldNotBeNil)
61
62 StopProfile()
63 })
64}

Callers

nothing calls this directly

Calls 4

StartProfileFunction · 0.85
StopProfileFunction · 0.85
StatMethod · 0.80
RemoveMethod · 0.45

Tested by

no test coverage detected