diff --git a/p4dlog_test.go b/p4dlog_test.go index c654d2f..4f3797e 100644 --- a/p4dlog_test.go +++ b/p4dlog_test.go @@ -3,6 +3,7 @@ package p4dlog import ( "bufio" "context" + "encoding/json" "sort" "strings" "testing" @@ -50,6 +51,41 @@ type lbrRegex struct { result bool } +// cleanJSON removes fields with a value of 0 from the JSON string. +func cleanJSON(jsonStr string) string { + var result map[string]interface{} + err := json.Unmarshal([]byte(jsonStr), &result) + if err != nil { + return "" + } + cleanMap(result) + cleanedJSON, err := json.Marshal(result) + if err != nil { + return "" + } + return string(cleanedJSON) +} + +// cleanMap recursively removes fields with a value of 0 from the map. +func cleanMap(m map[string]interface{}) { + for key, value := range m { + switch v := value.(type) { + case map[string]interface{}: + cleanMap(v) + case []interface{}: + for _, item := range v { + if itemMap, ok := item.(map[string]interface{}); ok { + cleanMap(itemMap) + } + } + case float64: + if v == 0.0 { + delete(m, key) + } + } + } +} + func TestLogParse(t *testing.T) { testInput := ` Perforce server info: @@ -60,8 +96,8 @@ Perforce server info: 2015/09/02 15:23:09 pid 1616 completed .031s` output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) - assert.JSONEq(t, `{"processKey":"4d4e5096f7b732e4ce95230ef085bf51","cmd":"user-sync","pid":1616,"lineNo":2,"user":"robert","workspace":"robert-test","computeLapse":0.031,"completedLapse":0.031,"ip":"127.0.0.1","app":"Microsoft Visual Studio 2013/12.0.21005.1","args":"//...","startTime":"2015/09/02 15:23:09","endTime":"2015/09/02 15:23:09","running":1,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey": "4d4e5096f7b732e4ce95230ef085bf51","cmd": "user-sync","pid": 1616,"lineNo": 2,"user": "robert","workspace": "robert-test","computeLapse": 0.031,"completedLapse": 0.031,"ip": "127.0.0.1","app": "Microsoft Visual Studio 2013/12.0.21005.1","args": "//...","startTime": "2015/09/02 15:23:09","endTime": "2015/09/02 15:23:09","running": 1,"cmdError": false,"tables": []}`), + cleanJSON(output[0])) // Sames as above with invalid Unicode strings testInput = ` @@ -73,8 +109,8 @@ Perforce server info: 2015/09/02 15:23:09 pid 1616 completed .031s` output = parseLogLines(testInput) assert.Equal(t, 1, len(output)) - assert.JSONEq(t, `{"processKey":"1f360d628fb2c9fe5354b8cf5022f7bd","cmd":"user-sync","pid":1616,"lineNo":2,"user":"robert","workspace":"robert-test","computeLapse":0.031,"completedLapse":0.031,"ip":"127.0.0.1","app":"Microsoft® Visual Studio® 2013/12.0.21005.1","args":"//...","startTime":"2015/09/02 15:23:09","endTime":"2015/09/02 15:23:09","running":1,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"1f360d628fb2c9fe5354b8cf5022f7bd","cmd":"user-sync","pid":1616,"lineNo":2,"user":"robert","workspace":"robert-test","computeLapse":0.031,"completedLapse":0.031,"ip":"127.0.0.1","app":"Microsoft® Visual Studio® 2013/12.0.21005.1","args":"//...","startTime":"2015/09/02 15:23:09","endTime":"2015/09/02 15:23:09","running":1,"cmdError":false,"tables":[]}`), + cleanJSON(output[0])) } @@ -103,8 +139,8 @@ Perforce server info: --- peek count 20 wait+held total/max 21ms+22ms/23ms+24ms` output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) - assert.JSONEq(t, `{"processKey":"7868f2723d35c6cb91784afa6bef4a7a","cmd":"user-client","pid":81805,"lineNo":2,"user":"bruno","workspace":"robert_cowham-dvcs-1487082773","computeLapse":0,"completedLapse":0.009,"ip":"10.62.185.98","app":"p4/2016.2/LINUX26X86_64/1468155","args":"-d -f bruno.139631598948304.irp210-h03","startTime":"2017/02/15 13:46:42","endTime":"2017/02/15 13:46:42","running":1,"uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":0,"memMB":0,"memPeakMB":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":20,"rpcMsgsOut":21,"rpcSizeIn":22,"rpcSizeOut":23,"rpcHimarkFwd":318788,"rpcHimarkRev":318789,"rpcSnd":0.001,"rpcRcv":0.002,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"have","pagesIn":1,"pagesOut":2,"pagesCached":3,"pagesSplitInternal":41,"pagesSplitLeaf":42,"readLocks":4,"writeLocks":5,"getRows":6,"posRows":7,"scanRows":8,"putRows":9,"delRows":10,"totalReadWait":12,"totalReadHeld":13,"totalWriteWait":14,"totalWriteHeld":15,"maxReadWait":32,"maxReadHeld":33,"maxWriteWait":34,"maxWriteHeld":35,"peekCount":20,"totalPeekWait":21,"totalPeekHeld":22,"maxPeekWait":23,"maxPeekHeld":24,"triggerLapse":0}]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"7868f2723d35c6cb91784afa6bef4a7a","cmd":"user-client","pid":81805,"lineNo":2,"user":"bruno","workspace":"robert_cowham-dvcs-1487082773","completedLapse":0.009,"ip":"10.62.185.98","app":"p4/2016.2/LINUX26X86_64/1468155","args":"-d -f bruno.139631598948304.irp210-h03","startTime":"2017/02/15 13:46:42","endTime":"2017/02/15 13:46:42","running":1,"uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"rpcMsgsIn":20,"rpcMsgsOut":21,"rpcSizeIn":22,"rpcSizeOut":23,"rpcHimarkFwd":318788,"rpcHimarkRev":318789,"rpcSnd":0.001,"rpcRcv":0.002,"cmdError":false,"tables":[{"tableName":"have","pagesIn":1,"pagesOut":2,"pagesCached":3,"pagesSplitInternal":41,"pagesSplitLeaf":42,"readLocks":4,"writeLocks":5,"getRows":6,"posRows":7,"scanRows":8,"putRows":9,"delRows":10,"totalReadWait":12,"totalReadHeld":13,"totalWriteWait":14,"totalWriteHeld":15,"maxReadWait":32,"maxReadHeld":33,"maxWriteWait":34,"maxWriteHeld":35,"peekCount":20,"totalPeekWait":21,"totalPeekHeld":22,"maxPeekWait":23,"maxPeekHeld":24}]}`), + cleanJSON(output[0])) } func TestStorageRecords(t *testing.T) { @@ -132,8 +168,11 @@ Perforce server info: ` output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) - assert.JSONEq(t, `{"processKey":"7ca020fc087e28ca774cc2267a45cedf","cmd":"user-client","pid":8748,"lineNo":2,"user":"build","workspace":"commander-controller","computeLapse":0,"completedLapse":0.012,"ip":"10.5.20.152","app":"p4/2018.1/LINUX26X86_64/1957529","args":"-i","startTime":"2020/10/16 06:00:01","endTime":"2020/10/16 06:00:01","running":1,"uCpu":4,"sCpu":4,"diskIn":8,"diskOut":80,"ipcIn":0,"ipcOut":0,"maxRss":9984,"pageFaults":0,"memMB":0,"memPeakMB":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":3,"rpcMsgsOut":5,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":795800,"rpcHimarkRev":318788,"rpcSnd":0,"rpcRcv":0.004,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":3,"pagesOut":0,"pagesCached":2,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":1,"writeLocks":0,"getRows":1,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"storagemasterup_R","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":3,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"storageup_R","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":3,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[0]) + expected := cleanJSON(`{"processKey":"7ca020fc087e28ca774cc2267a45cedf","cmd":"user-client","pid":8748,"lineNo":2,"user":"build","workspace":"commander-controller","completedLapse":0.012,"ip":"10.5.20.152","app":"p4/2018.1/LINUX26X86_64/1957529","args":"-i","startTime":"2020/10/16 06:00:01","endTime":"2020/10/16 06:00:01","running":1,"uCpu":4,"sCpu":4,"diskIn":8,"diskOut":80,"maxRss":9984,"rpcMsgsIn":3,"rpcMsgsOut":5,"rpcHimarkFwd":795800,"rpcHimarkRev":318788,"rpcRcv":0.004,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":3,"pagesCached":2,"readLocks":1,"getRows":1},{"tableName":"storagemasterup_R","totalReadHeld":3},{"tableName":"storageup_R","totalReadHeld":3}]}`) + actual := cleanJSON(output[0]) + assert.JSONEq(t, expected, actual) + // assert.JSONEq(t, cleanJSON(`{"processKey":"7ca020fc087e28ca774cc2267a45cedf","cmd":"user-client","pid":8748,"lineNo":2,"user":"build","workspace":"commander-controller","completedLapse":0.012,"ip":"10.5.20.152","app":"p4/2018.1/LINUX26X86_64/1957529","args":"-i","startTime":"2020/10/16 06:00:01","endTime":"2020/10/16 06:00:01","running":1,"uCpu":4,"sCpu":4,"diskIn":8,"diskOut":80,"maxRss":9984,"rpcMsgsIn":3,"rpcMsgsOut":5,"rpcHimarkFwd":795800,"rpcHimarkRev":318788,"rpcRcv":0.004,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":3,"pagesCached":2,"readLocks":1,"getRows":1},{"tableName":"storagemasterup_R","totalReadHeld":3},{"tableName":"storageup_R","totalReadHeld":3}]}`), + // cleanJSON(output[0])) } func TestLabelRecords(t *testing.T) { @@ -158,10 +197,10 @@ Perforce server info: ` output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) - assert.JSONEq(t, `{"processKey":"7e3d11dfb4701f7818a630d0b2c2c1ba","cmd":"user-label","pid":8748,"lineNo":2,"user":"build","workspace":"commander-controller","computeLapse":0,"completedLapse":0.012,"ip":"10.5.20.152","app":"p4/2018.1/LINUX26X86_64/1957529","args":"-i","startTime":"2020/10/16 06:00:01","endTime":"2020/10/16 06:00:01","running":1,"uCpu":4,"sCpu":4,"diskIn":8,"diskOut":80,"ipcIn":0,"ipcOut":0,"maxRss":9984,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":3,"rpcMsgsOut":5,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":795800,"rpcHimarkRev":318788,"rpcSnd":0,"rpcRcv":0.004,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"monitor","pagesIn":2,"pagesOut":4,"pagesCached":4096,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":2,"getRows":0,"posRows":0,"scanRows":0,"putRows":2,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"7e3d11dfb4701f7818a630d0b2c2c1ba","cmd":"user-label","pid":8748,"lineNo":2,"user":"build","workspace":"commander-controller","completedLapse":0.012,"ip":"10.5.20.152","app":"p4/2018.1/LINUX26X86_64/1957529","args":"-i","startTime":"2020/10/16 06:00:01","endTime":"2020/10/16 06:00:01","running":1,"uCpu":4,"sCpu":4,"diskIn":8,"diskOut":80,"maxRss":9984,"rpcMsgsIn":3,"rpcMsgsOut":5,"rpcHimarkFwd":795800,"rpcHimarkRev":318788,"rpcRcv":0.004,"cmdError":false,"tables":[{"tableName":"monitor","pagesIn":2,"pagesOut":4,"pagesCached":4096,"writeLocks":2,"putRows":2}]}`), + cleanJSON(output[0])) // assert.Equal(t, ``, - // output[0]) + // cleanJSON(output[0])) } func TestLogParseSwarm(t *testing.T) { @@ -173,8 +212,8 @@ Perforce server info: ` output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) - assert.JSONEq(t, `{"processKey":"d0ae06fd40d95180ca403a9c30084a66","cmd":"user-counter","pid":14769,"lineNo":2,"user":"perforce","workspace":"~tmp.1482305462.13038.585a2fb6041cc1.60954329","computeLapse":0,"completedLapse":0.003,"ip":"192.168.18.31","app":"SWARM/2016.2/1446446","args":"-u swarm-activity-fffec3dd","startTime":"2016/12/21 08:39:39","endTime":"2016/12/21 08:39:39","running":1,"uCpu":4,"sCpu":0,"diskIn":0,"diskOut":16,"ipcIn":0,"ipcOut":0,"maxRss":6432,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"d0ae06fd40d95180ca403a9c30084a66","cmd":"user-counter","pid":14769,"lineNo":2,"user":"perforce","workspace":"~tmp.1482305462.13038.585a2fb6041cc1.60954329","completedLapse":0.003,"ip":"192.168.18.31","app":"SWARM/2016.2/1446446","args":"-u swarm-activity-fffec3dd","startTime":"2016/12/21 08:39:39","endTime":"2016/12/21 08:39:39","running":1,"uCpu":4,"diskOut":16,"maxRss":6432,"cmdError":false,"tables":[]}`), + cleanJSON(output[0])) } func TestLogParseGitFusion(t *testing.T) { @@ -209,8 +248,8 @@ Perforce server info: 2016/10/19 12:01:09 pid 10664 completed .844s` output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) - assert.JSONEq(t, `{"processKey":"1eec998ae9cc1ce44058f4503a01f2c0","cmd":"user-key","pid":10664,"lineNo":2,"user":"git-fusion-user","workspace":"GF-TRIGGER-567d67de-962","computeLapse":0,"completedLapse":0.844,"ip":"10.100.104.199","app":"p4/2016.1/NTX64/1396108","args":"git-fusion-reviews-common-lock-owner","startTime":"2016/10/19 12:01:08","endTime":"2016/10/19 12:01:09","running":1,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":2,"rpcMsgsOut":3,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":523588,"rpcHimarkRev":523588,"rpcSnd":0,"rpcRcv":0.015,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"group","pagesIn":7,"pagesOut":0,"pagesCached":6,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":1,"writeLocks":0,"getRows":0,"posRows":3,"scanRows":67,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":15,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"nameval","pagesIn":6,"pagesOut":4,"pagesCached":4,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":1,"getRows":0,"posRows":0,"scanRows":0,"putRows":1,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":16,"totalWriteHeld":15,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"protect","pagesIn":282,"pagesOut":0,"pagesCached":96,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":1,"writeLocks":0,"getRows":0,"posRows":1,"scanRows":14495,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":641,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"trigger","pagesIn":21,"pagesOut":0,"pagesCached":20,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":1,"writeLocks":0,"getRows":0,"posRows":1,"scanRows":486,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":47,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"user","pagesIn":4,"pagesOut":0,"pagesCached":3,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":1,"writeLocks":0,"getRows":1,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":16,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"1eec998ae9cc1ce44058f4503a01f2c0","cmd":"user-key","pid":10664,"lineNo":2,"user":"git-fusion-user","workspace":"GF-TRIGGER-567d67de-962","completedLapse":0.844,"ip":"10.100.104.199","app":"p4/2016.1/NTX64/1396108","args":"git-fusion-reviews-common-lock-owner","startTime":"2016/10/19 12:01:08","endTime":"2016/10/19 12:01:09","running":1,"rpcMsgsIn":2,"rpcMsgsOut":3,"rpcHimarkFwd":523588,"rpcHimarkRev":523588,"rpcRcv":0.015,"cmdError":false,"tables":[{"tableName":"group","pagesIn":7,"pagesCached":6,"readLocks":1,"posRows":3,"scanRows":67,"totalReadHeld":15},{"tableName":"nameval","pagesIn":6,"pagesOut":4,"pagesCached":4,"writeLocks":1,"putRows":1,"totalWriteWait":16,"totalWriteHeld":15},{"tableName":"protect","pagesIn":282,"pagesCached":96,"readLocks":1,"posRows":1,"scanRows":14495,"totalReadHeld":641},{"tableName":"trigger","pagesIn":21,"pagesCached":20,"readLocks":1,"posRows":1,"scanRows":486,"totalReadHeld":47},{"tableName":"user","pagesIn":4,"pagesCached":3,"readLocks":1,"getRows":1,"totalReadHeld":16}]}`), + cleanJSON(output[0])) } func TestLongCommand(t *testing.T) { @@ -227,8 +266,8 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) //assert.Equal(t, "", output[0]) - assert.JSONEq(t, `{"processKey":"e2bf456007fe305acdae759996dbbeb9","cmd":"user-reconcile","pid":4500,"lineNo":2,"user":"robert","workspace":"robert-test","computeLapse":0,"completedLapse":0.187,"ip":"127.0.0.1","app":"Microsoft Visual Studio 2013/12.0.21005.1","args":"-eadf -c 12253 c:\\temp\\robert-test\\test\\VEER!-%-#-@-$-\u0026-(-)\\fred - Copy.txt c:\\temp\\robert-test\\test\\VEER!-%-#-@-$-\u0026-(-)\\fred - Copy.txt c:\\temp\\robert-test\\test\\VEER!-%-#-@-$-\u0026-(-)\\fred - Copy.txt c:\\temp\\robert-test\\test\\VEER!-%-#-@-$-\u0026-(-)\\fred - Copy.txt","startTime":"2015/09/02 16:43:36","endTime":"2015/09/02 16:43:36","running":1,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"e2bf456007fe305acdae759996dbbeb9","cmd":"user-reconcile","pid":4500,"lineNo":2,"user":"robert","workspace":"robert-test","completedLapse":0.187,"ip":"127.0.0.1","app":"Microsoft Visual Studio 2013/12.0.21005.1","args":"-eadf -c 12253 c:\\temp\\robert-test\\test\\VEER!-%-#-@-$-\u0026-(-)\\fred - Copy.txt c:\\temp\\robert-test\\test\\VEER!-%-#-@-$-\u0026-(-)\\fred - Copy.txt c:\\temp\\robert-test\\test\\VEER!-%-#-@-$-\u0026-(-)\\fred - Copy.txt c:\\temp\\robert-test\\test\\VEER!-%-#-@-$-\u0026-(-)\\fred - Copy.txt","startTime":"2015/09/02 16:43:36","endTime":"2015/09/02 16:43:36","running":1,"cmdError":false,"tables":[]}`), + cleanJSON(output[0])) } func TestNetworkEstimates(t *testing.T) { @@ -247,10 +286,10 @@ Perforce server info: 2017/02/15 10:11:30 pid 4917 completed .034s 19+4us 0+8io 0+0net 8996k 0pf` output := parseLogLines(testInput) assert.Equal(t, 2, len(output)) - assert.JSONEq(t, `{"processKey":"4964a5f82541f47985f0965ab47c1e39","cmd":"user-have","pid":4917,"lineNo":2,"user":"bruno","workspace":"bruno.140451462678608","computeLapse":0,"completedLapse":0.002,"ip":"10.62.185.99","app":"unnamed p4-python script/v81","args":"","startTime":"2017/02/15 10:11:30","endTime":"2017/02/15 10:11:30","running":1,"uCpu":2,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":8932,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[0]) - assert.JSONEq(t, `{"processKey":"7c65428ac3b32f6f42f84ead5694ffb4","cmd":"user-sync","pid":4917,"lineNo":6,"user":"bruno","workspace":"bruno.140451462678608","computeLapse":0.02,"completedLapse":0.034,"ip":"10.62.185.99","app":"unnamed p4-python script/v81","args":"//bruno.140451462678608/...","startTime":"2017/02/15 10:11:30","endTime":"2017/02/15 10:11:30","running":1,"uCpu":19,"sCpu":4,"diskIn":0,"diskOut":8,"ipcIn":0,"ipcOut":0,"maxRss":8996,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":1,"netFilesUpdated":2,"netFilesDeleted":3,"netBytesAdded":111325,"netBytesUpdated":813906,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[1]) + assert.JSONEq(t, cleanJSON(`{"processKey":"4964a5f82541f47985f0965ab47c1e39","cmd":"user-have","pid":4917,"lineNo":2,"user":"bruno","workspace":"bruno.140451462678608","completedLapse":0.002,"ip":"10.62.185.99","app":"unnamed p4-python script/v81","args":"","startTime":"2017/02/15 10:11:30","endTime":"2017/02/15 10:11:30","running":1,"uCpu":2,"maxRss":8932,"cmdError":false,"tables":[]}`), + cleanJSON(output[0])) + assert.JSONEq(t, cleanJSON(`{"processKey":"7c65428ac3b32f6f42f84ead5694ffb4","cmd":"user-sync","pid":4917,"lineNo":6,"user":"bruno","workspace":"bruno.140451462678608","computeLapse":0.02,"completedLapse":0.034,"ip":"10.62.185.99","app":"unnamed p4-python script/v81","args":"//bruno.140451462678608/...","startTime":"2017/02/15 10:11:30","endTime":"2017/02/15 10:11:30","running":1,"uCpu":19,"sCpu":4,"diskOut":8,"maxRss":8996,"netFilesAdded":1,"netFilesUpdated":2,"netFilesDeleted":3,"netBytesAdded":111325,"netBytesUpdated":813906,"cmdError":false,"tables":[]}`), + cleanJSON(output[1])) } // Thes get duplicate pids in same second and have no completed record @@ -272,10 +311,10 @@ Perforce server info: ` output := parseLogLines(testInput) assert.Equal(t, 2, len(output)) - assert.JSONEq(t, `{"processKey":"bea947227d9ec7f4300a0ea889886934","cmd":"rmt-FileFetch","pid":113249,"lineNo":2,"user":"serviceUser","workspace":"unknown","computeLapse":0,"completedLapse":0,"ip":"10.62.185.99","app":"p4d/2016.2/LINUX26X86_64/1468155","args":"","startTime":"2017/03/06 11:53:50","endTime":"2017/03/06 11:53:50","running":0,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":2,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":318788,"rpcHimarkRev":318788,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"user","pagesIn":2,"pagesOut":0,"pagesCached":2,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":1,"writeLocks":0,"getRows":1,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[0]) - assert.JSONEq(t, `{"processKey":"bea947227d9ec7f4300a0ea889886934.9","cmd":"rmt-FileFetch","pid":113249,"lineNo":9,"user":"serviceUser","workspace":"unknown","computeLapse":0,"completedLapse":0,"ip":"10.62.185.99","app":"p4d/2016.2/LINUX26X86_64/1468155","args":"","startTime":"2017/03/06 11:53:50","endTime":"2017/03/06 11:53:50","running":0,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":2,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":318788,"rpcHimarkRev":318788,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"user","pagesIn":1,"pagesOut":0,"pagesCached":2,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":1,"writeLocks":0,"getRows":1,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[1]) + assert.JSONEq(t, cleanJSON(`{"processKey":"bea947227d9ec7f4300a0ea889886934","cmd":"rmt-FileFetch","pid":113249,"lineNo":2,"user":"serviceUser","workspace":"unknown","ip":"10.62.185.99","app":"p4d/2016.2/LINUX26X86_64/1468155","args":"","startTime":"2017/03/06 11:53:50","endTime":"2017/03/06 11:53:50","rpcMsgsOut":2,"rpcHimarkFwd":318788,"rpcHimarkRev":318788,"cmdError":false,"tables":[{"tableName":"user","pagesIn":2,"pagesCached":2,"readLocks":1,"getRows":1}]}`), + cleanJSON(output[0])) + assert.JSONEq(t, cleanJSON(`{"processKey":"bea947227d9ec7f4300a0ea889886934.9","cmd":"rmt-FileFetch","pid":113249,"lineNo":9,"user":"serviceUser","workspace":"unknown","ip":"10.62.185.99","app":"p4d/2016.2/LINUX26X86_64/1468155","args":"","startTime":"2017/03/06 11:53:50","endTime":"2017/03/06 11:53:50","rpcMsgsOut":2,"rpcHimarkFwd":318788,"rpcHimarkRev":318788,"cmdError":false,"tables":[{"tableName":"user","pagesIn":1,"pagesCached":2,"readLocks":1,"getRows":1}]}`), + cleanJSON(output[1])) } // These test values used in 2 tests @@ -292,16 +331,16 @@ Perforce server info: 2015/09/02 15:23:09 pid 1616 completed .031s Perforce server info: 2015/09/02 15:23:09 pid 1534 completed .041s` -var multiExp1 = `{"processKey":"f9a64670da4d77a44225be236974bc8b","cmd":"user-sync","pid":1616,"lineNo":2,"user":"robert","workspace":"robert-test","computeLapse":0.031,"completedLapse":0.031,"ip":"127.0.0.1","app":"p4/2016.2/LINUX26X86_64/1598668","args":"//...","startTime":"2015/09/02 15:23:09","endTime":"2015/09/02 15:23:09","running":1,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}` -var multiExp2 = `{"processKey":"2908cdb35e4b82dae3d0b403ef0c3bbf","cmd":"user-sync","pid":1534,"lineNo":6,"user":"fred","workspace":"fred-test","computeLapse":0.021,"completedLapse":0.041,"ip":"127.0.0.1","app":"p4/2016.2/LINUX26X86_64/1598668","args":"//...","startTime":"2015/09/02 15:23:09","endTime":"2015/09/02 15:23:09","running":2,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}` +var multiExp1 = `{"processKey":"f9a64670da4d77a44225be236974bc8b","cmd":"user-sync","pid":1616,"lineNo":2,"user":"robert","workspace":"robert-test","computeLapse":0.031,"completedLapse":0.031,"ip":"127.0.0.1","app":"p4/2016.2/LINUX26X86_64/1598668","args":"//...","startTime":"2015/09/02 15:23:09","endTime":"2015/09/02 15:23:09","running":1,"cmdError":false,"tables":[]}` +var multiExp2 = `{"processKey":"2908cdb35e4b82dae3d0b403ef0c3bbf","cmd":"user-sync","pid":1534,"lineNo":6,"user":"fred","workspace":"fred-test","computeLapse":0.021,"completedLapse":0.041,"ip":"127.0.0.1","app":"p4/2016.2/LINUX26X86_64/1598668","args":"//...","startTime":"2015/09/02 15:23:09","endTime":"2015/09/02 15:23:09","running":2,"cmdError":false,"tables":[]}` func TestLogParseMulti(t *testing.T) { output := parseLogLines(multiInput) assert.Equal(t, 2, len(output)) sort.Strings(output) //assert.Equal(t, "", output[0]) - assert.JSONEq(t, multiExp1, output[1]) - assert.JSONEq(t, multiExp2, output[0]) + assert.JSONEq(t, cleanJSON(multiExp1), cleanJSON(output[1])) + assert.JSONEq(t, cleanJSON(multiExp2), cleanJSON(output[0])) } func TestLogParseSubmit(t *testing.T) { @@ -345,12 +384,12 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 3, len(output)) //assert.Equal(t, "", output[1]) - assert.JSONEq(t, `{"processKey":"128e10d7fe570c2d2f5f7f03e1186827","cmd":"dm-CommitSubmit","pid":25568,"lineNo":15,"user":"fred","workspace":"lon_ws","computeLapse":0,"completedLapse":1.38,"ip":"10.1.2.3","app":"p4/2016.2/LINUX26X86_64/1598668","args":"","startTime":"2018/06/10 23:30:08","endTime":"2018/06/10 23:30:09","running":1,"uCpu":34,"sCpu":61,"diskIn":59680,"diskOut":59904,"ipcIn":0,"ipcOut":0,"maxRss":127728,"pageFaults":1,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"archmap","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":780,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"integed","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":795,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[0]) - assert.JSONEq(t, `{"processKey":"465f0a630b021d3c695e90924a757b75","cmd":"user-submit","pid":25568,"lineNo":2,"user":"fred","workspace":"lon_ws","computeLapse":0,"completedLapse":0.178,"ip":"10.1.2.3","app":"p4/2016.2/LINUX26X86_64/1598668","args":"-i","startTime":"2018/06/10 23:30:06","endTime":"2018/06/10 23:30:07","running":1,"uCpu":96,"sCpu":17,"diskIn":0,"diskOut":208,"ipcIn":0,"ipcOut":0,"maxRss":15668,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[1]) - assert.JSONEq(t, `{"processKey":"78dbd54644e624a9c6f5c338a0864d2a","cmd":"dm-SubmitChange","pid":25568,"lineNo":7,"user":"fred","workspace":"lon_ws","computeLapse":0.252,"completedLapse":1.38,"ip":"10.1.2.3","app":"p4/2016.2/LINUX26X86_64/1598668","args":"","startTime":"2018/06/10 23:30:07","endTime":"2018/06/10 23:30:08","running":1,"uCpu":490,"sCpu":165,"diskIn":0,"diskOut":178824,"ipcIn":0,"ipcOut":0,"maxRss":127728,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[2]) + assert.JSONEq(t, cleanJSON(`{"processKey":"128e10d7fe570c2d2f5f7f03e1186827","cmd":"dm-CommitSubmit","pid":25568,"lineNo":15,"user":"fred","workspace":"lon_ws","completedLapse":1.38,"ip":"10.1.2.3","app":"p4/2016.2/LINUX26X86_64/1598668","args":"","startTime":"2018/06/10 23:30:08","endTime":"2018/06/10 23:30:09","running":1,"uCpu":34,"sCpu":61,"diskIn":59680,"diskOut":59904,"maxRss":127728,"pageFaults":1,"cmdError":false,"tables":[{"tableName":"archmap","totalWriteHeld":780},{"tableName":"integed","totalWriteHeld":795}]}`), + cleanJSON(output[0])) + assert.JSONEq(t, cleanJSON(`{"processKey":"465f0a630b021d3c695e90924a757b75","cmd":"user-submit","pid":25568,"lineNo":2,"user":"fred","workspace":"lon_ws","completedLapse":0.178,"ip":"10.1.2.3","app":"p4/2016.2/LINUX26X86_64/1598668","args":"-i","startTime":"2018/06/10 23:30:06","endTime":"2018/06/10 23:30:07","running":1,"uCpu":96,"sCpu":17,"diskOut":208,"maxRss":15668,"cmdError":false,"tables":[]}`), + cleanJSON(output[1])) + assert.JSONEq(t, cleanJSON(`{"processKey":"78dbd54644e624a9c6f5c338a0864d2a","cmd":"dm-SubmitChange","pid":25568,"lineNo":7,"user":"fred","workspace":"lon_ws","computeLapse":0.252,"completedLapse":1.38,"ip":"10.1.2.3","app":"p4/2016.2/LINUX26X86_64/1598668","args":"","startTime":"2018/06/10 23:30:07","endTime":"2018/06/10 23:30:08","running":1,"uCpu":490,"sCpu":165,"diskOut":178824,"maxRss":127728,"cmdError":false,"tables":[]}`), + cleanJSON(output[2])) } @@ -398,12 +437,12 @@ Perforce server info: ` output := parseLogLines(testInput) assert.Equal(t, 3, len(output)) - assert.JSONEq(t, `{"processKey":"128e10d7fe570c2d2f5f7f03e1186827","cmd":"dm-CommitSubmit","pid":25568,"lineNo":18,"user":"fred","workspace":"lon_ws","computeLapse":0,"completedLapse":1.38,"ip":"10.1.2.3","app":"p4/2016.2/LINUX26X86_64/1598668","args":"","startTime":"2018/06/10 23:30:08","endTime":"2018/06/10 23:30:09","running":1,"uCpu":34,"sCpu":61,"diskIn":59680,"diskOut":59904,"ipcIn":0,"ipcOut":0,"maxRss":127728,"pageFaults":1,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"archmap","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":780,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"integed","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":795,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[0]) - assert.JSONEq(t, `{"processKey":"78dbd54644e624a9c6f5c338a0864d2a","cmd":"dm-SubmitChange","pid":25568,"lineNo":10,"user":"fred","workspace":"lon_ws","computeLapse":0.252,"completedLapse":1.38,"ip":"10.1.2.3","app":"p4/2016.2/LINUX26X86_64/1598668","args":"","startTime":"2018/06/10 23:30:07","endTime":"2018/06/10 23:30:08","running":1,"uCpu":490,"sCpu":165,"diskIn":0,"diskOut":178824,"ipcIn":0,"ipcOut":0,"maxRss":127728,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[1]) - assert.JSONEq(t, `{"processKey":"954a5899d56e015d5080e4f8ef7f9e39","cmd":"user-submit","pid":25568,"lineNo":2,"user":"fred","workspace":"lon_ws","computeLapse":0,"completedLapse":0.178,"ip":"10.1.2.3","app":"p4/2016.2/LINUX26X86_64/1598668","args":" -d First line","startTime":"2018/06/10 23:30:06","endTime":"2018/06/10 23:30:07","running":1,"uCpu":96,"sCpu":17,"diskIn":0,"diskOut":208,"ipcIn":0,"ipcOut":0,"maxRss":15668,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[2]) + assert.JSONEq(t, cleanJSON(`{"processKey":"128e10d7fe570c2d2f5f7f03e1186827","cmd":"dm-CommitSubmit","pid":25568,"lineNo":18,"user":"fred","workspace":"lon_ws","completedLapse":1.38,"ip":"10.1.2.3","app":"p4/2016.2/LINUX26X86_64/1598668","args":"","startTime":"2018/06/10 23:30:08","endTime":"2018/06/10 23:30:09","running":1,"uCpu":34,"sCpu":61,"diskIn":59680,"diskOut":59904,"maxRss":127728,"pageFaults":1,"cmdError":false,"tables":[{"tableName":"archmap","totalWriteHeld":780},{"tableName":"integed","totalWriteHeld":795}]}`), + cleanJSON(output[0])) + assert.JSONEq(t, cleanJSON(`{"processKey":"78dbd54644e624a9c6f5c338a0864d2a","cmd":"dm-SubmitChange","pid":25568,"lineNo":10,"user":"fred","workspace":"lon_ws","computeLapse":0.252,"completedLapse":1.38,"ip":"10.1.2.3","app":"p4/2016.2/LINUX26X86_64/1598668","args":"","startTime":"2018/06/10 23:30:07","endTime":"2018/06/10 23:30:08","running":1,"uCpu":490,"sCpu":165,"diskOut":178824,"maxRss":127728,"cmdError":false,"tables":[]}`), + cleanJSON(output[1])) + assert.JSONEq(t, cleanJSON(`{"processKey":"954a5899d56e015d5080e4f8ef7f9e39","cmd":"user-submit","pid":25568,"lineNo":2,"user":"fred","workspace":"lon_ws","completedLapse":0.178,"ip":"10.1.2.3","app":"p4/2016.2/LINUX26X86_64/1598668","args":" -d First line","startTime":"2018/06/10 23:30:06","endTime":"2018/06/10 23:30:07","running":1,"uCpu":96,"sCpu":17,"diskOut":208,"maxRss":15668,"cmdError":false,"tables":[]}`), + cleanJSON(output[2])) // assert.Equal(t, `asdf`, // output[3]) } @@ -453,8 +492,8 @@ Perforce server info: ` output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) - assert.JSONEq(t, `{"processKey":"c3ddb95f03f30b508e0e96dd8754b419","cmd":"user-populate","pid":36276,"lineNo":2,"user":"fred","workspace":"fred-dvcs-1671638968","computeLapse":0,"completedLapse":0.02,"ip":"unknown","app":"p4/2021.1/MACOSX1015X86_64/2156517","args":" -d First line","startTime":"2022/12/21 18:10:48","endTime":"2022/12/21 18:10:48","running":1,"uCpu":0,"sCpu":3,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":8577024,"pageFaults":9,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":1,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":2000,"rpcHimarkRev":2000,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":14,"pagesOut":6,"pagesCached":2,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":4,"writeLocks":4,"getRows":7,"posRows":0,"scanRows":0,"putRows":2,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":4,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":4,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"logger","pagesIn":3,"pagesOut":0,"pagesCached":1,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":1,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"storagemasterup_R","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":15,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"stream","pagesIn":8,"pagesOut":3,"pagesCached":2,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":4,"writeLocks":1,"getRows":3,"posRows":6,"scanRows":6,"putRows":1,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"c3ddb95f03f30b508e0e96dd8754b419","cmd":"user-populate","pid":36276,"lineNo":2,"user":"fred","workspace":"fred-dvcs-1671638968","completedLapse":0.02,"ip":"unknown","app":"p4/2021.1/MACOSX1015X86_64/2156517","args":" -d First line","startTime":"2022/12/21 18:10:48","endTime":"2022/12/21 18:10:48","running":1,"sCpu":3,"maxRss":8577024,"pageFaults":9,"rpcMsgsOut":1,"rpcHimarkFwd":2000,"rpcHimarkRev":2000,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":14,"pagesOut":6,"pagesCached":2,"readLocks":4,"writeLocks":4,"getRows":7,"putRows":2,"totalWriteHeld":4,"maxWriteHeld":4},{"tableName":"logger","pagesIn":3,"pagesCached":1,"writeLocks":1,"getRows":0},{"tableName":"storagemasterup_R","totalReadHeld":15},{"tableName":"stream","pagesIn":8,"pagesOut":3,"pagesCached":2,"readLocks":4,"writeLocks":1,"getRows":3,"posRows":6,"scanRows":6,"putRows":1}]}`), + cleanJSON(output[0])) } func TestLogDuplicatePids(t *testing.T) { @@ -493,10 +532,10 @@ Perforce server info: ` output := parseLogLines(testInput) assert.Equal(t, 2, len(output)) - assert.JSONEq(t, `{"processKey":"9b2bf87ce1b8e88d0d89cf44cffc4a8c","cmd":"user-change","pid":4496,"lineNo":2,"user":"lcheng","workspace":"lcheng","computeLapse":0,"completedLapse":0.015,"ip":"10.100.72.195","app":"P4V/NTX64/2014.1/888424/v76","args":"-o","startTime":"2016/10/19 14:53:48","endTime":"2016/10/19 14:53:48","running":1,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":1,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":523588,"rpcHimarkRev":64836,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"group","pagesIn":1,"pagesOut":0,"pagesCached":7,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":1,"writeLocks":0,"getRows":0,"posRows":6,"scanRows":11,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"user","pagesIn":1,"pagesOut":0,"pagesCached":3,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":1,"writeLocks":0,"getRows":1,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[0]) - assert.JSONEq(t, `{"processKey":"9b2bf87ce1b8e88d0d89cf44cffc4a8c.18","cmd":"user-change","pid":4496,"lineNo":18,"user":"lcheng","workspace":"lcheng","computeLapse":0,"completedLapse":0.016,"ip":"10.100.72.195","app":"P4V/NTX64/2014.1/888424/v76","args":"-o","startTime":"2016/10/19 14:53:48","endTime":"2016/10/19 14:53:48","running":1,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":1,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":523588,"rpcHimarkRev":64836,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"group","pagesIn":1,"pagesOut":0,"pagesCached":7,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":1,"writeLocks":0,"getRows":0,"posRows":6,"scanRows":11,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"user","pagesIn":1,"pagesOut":0,"pagesCached":3,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":1,"writeLocks":0,"getRows":1,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[1]) + assert.JSONEq(t, cleanJSON(`{"processKey":"9b2bf87ce1b8e88d0d89cf44cffc4a8c","cmd":"user-change","pid":4496,"lineNo":2,"user":"lcheng","workspace":"lcheng","completedLapse":0.015,"ip":"10.100.72.195","app":"P4V/NTX64/2014.1/888424/v76","args":"-o","startTime":"2016/10/19 14:53:48","endTime":"2016/10/19 14:53:48","running":1,"rpcMsgsOut":1,"rpcHimarkFwd":523588,"rpcHimarkRev":64836,"cmdError":false,"tables":[{"tableName":"group","pagesIn":1,"pagesCached":7,"readLocks":1,"posRows":6,"scanRows":11},{"tableName":"user","pagesIn":1,"pagesCached":3,"readLocks":1,"getRows":1}]}`), + cleanJSON(output[0])) + assert.JSONEq(t, cleanJSON(`{"processKey":"9b2bf87ce1b8e88d0d89cf44cffc4a8c.18","cmd":"user-change","pid":4496,"lineNo":18,"user":"lcheng","workspace":"lcheng","completedLapse":0.016,"ip":"10.100.72.195","app":"P4V/NTX64/2014.1/888424/v76","args":"-o","startTime":"2016/10/19 14:53:48","endTime":"2016/10/19 14:53:48","running":1,"rpcMsgsOut":1,"rpcHimarkFwd":523588,"rpcHimarkRev":64836,"cmdError":false,"tables":[{"tableName":"group","pagesIn":1,"pagesCached":7,"readLocks":1,"posRows":6,"scanRows":11},{"tableName":"user","pagesIn":1,"pagesCached":3,"readLocks":1,"getRows":1}]}`), + cleanJSON(output[1])) } func TestLogTriggerEntries(t *testing.T) { @@ -519,8 +558,8 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) //assert.Equal(t, "", output[0]) - assert.JSONEq(t, `{"processKey":"25aeba7a5658170fea61117076fa00d5","cmd":"user-change","pid":148469,"lineNo":2,"user":"Fred","workspace":"LONWS","computeLapse":0,"completedLapse":0.413,"ip":"10.40.16.14/10.40.48.29","app":"3DSMax/1.0.0.0","args":"-i","startTime":"2017/12/07 15:00:21","endTime":"2017/12/07 15:00:21","running":1,"uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":22,"memMB":0,"memPeakMB":0,"rpcMsgsIn":20,"rpcMsgsOut":21,"rpcSizeIn":22,"rpcSizeOut":23,"rpcHimarkFwd":318788,"rpcHimarkRev":318789,"rpcSnd":0.001,"rpcRcv":0.002,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":6,"pagesOut":3,"pagesCached":2,"pagesSplitInternal":41,"pagesSplitLeaf":42,"readLocks":0,"writeLocks":2,"getRows":2,"posRows":0,"scanRows":0,"putRows":1,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"trigger_swarm.changesave","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0.044}]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"25aeba7a5658170fea61117076fa00d5","cmd":"user-change","pid":148469,"lineNo":2,"user":"Fred","workspace":"LONWS","completedLapse":0.413,"ip":"10.40.16.14/10.40.48.29","app":"3DSMax/1.0.0.0","args":"-i","startTime":"2017/12/07 15:00:21","endTime":"2017/12/07 15:00:21","running":1,"uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":22,"rpcMsgsIn":20,"rpcMsgsOut":21,"rpcSizeIn":22,"rpcSizeOut":23,"rpcHimarkFwd":318788,"rpcHimarkRev":318789,"rpcSnd":0.001,"rpcRcv":0.002,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":6,"pagesOut":3,"pagesCached":2,"pagesSplitInternal":41,"pagesSplitLeaf":42,"writeLocks":2,"getRows":2,"putRows":1},{"tableName":"trigger_swarm.changesave","triggerLapse":0.044}]}`), + cleanJSON(output[0])) } func TestLogChangeI(t *testing.T) { @@ -564,10 +603,10 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 2, len(output)) //assert.Equal(t, "", output[1]) - assert.JSONEq(t, `{"processKey":"128e10d7fe570c2d2f5f7f03e1186827","cmd":"dm-CommitSubmit","pid":25568,"lineNo":16,"user":"fred","workspace":"lon_ws","computeLapse":0,"completedLapse":1.38,"ip":"10.1.2.3","app":"p4/2016.2/LINUX26X86_64/1598668","args":"","startTime":"2018/06/10 23:30:08","endTime":"2018/06/10 23:30:09","running":1,"uCpu":34,"sCpu":61,"diskIn":59680,"diskOut":59904,"ipcIn":0,"ipcOut":0,"maxRss":127728,"pageFaults":1,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"archmap","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":780,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"integed","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":795,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[0]) - assert.JSONEq(t, `{"processKey":"441371d8e17558bfb8e6cf7c1ca7b3ac","cmd":"user-change","pid":148469,"lineNo":2,"user":"fred","workspace":"LONWS","computeLapse":0,"completedLapse":0.413,"ip":"10.40.16.14/10.40.48.29","app":"3DSMax/1.0.0.0","args":"-i","startTime":"2017/12/07 15:00:21","endTime":"2017/12/07 15:00:21","running":1,"uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":22,"memMB":0,"memPeakMB":0,"rpcMsgsIn":20,"rpcMsgsOut":21,"rpcSizeIn":22,"rpcSizeOut":23,"rpcHimarkFwd":318788,"rpcHimarkRev":318789,"rpcSnd":0.001,"rpcRcv":0.002,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":6,"pagesOut":3,"pagesCached":2,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":2,"getRows":2,"posRows":0,"scanRows":0,"putRows":1,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"trigger_swarm.changesave","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0.044}]}`, - output[1]) + assert.JSONEq(t, cleanJSON(`{"processKey":"128e10d7fe570c2d2f5f7f03e1186827","cmd":"dm-CommitSubmit","pid":25568,"lineNo":16,"user":"fred","workspace":"lon_ws","completedLapse":1.38,"ip":"10.1.2.3","app":"p4/2016.2/LINUX26X86_64/1598668","args":"","startTime":"2018/06/10 23:30:08","endTime":"2018/06/10 23:30:09","running":1,"uCpu":34,"sCpu":61,"diskIn":59680,"diskOut":59904,"maxRss":127728,"pageFaults":1,"cmdError":false,"tables":[{"tableName":"archmap","totalWriteHeld":780},{"tableName":"integed","totalWriteHeld":795}]}`), + cleanJSON(output[0])) + assert.JSONEq(t, cleanJSON(`{"processKey":"441371d8e17558bfb8e6cf7c1ca7b3ac","cmd":"user-change","pid":148469,"lineNo":2,"user":"fred","workspace":"LONWS","completedLapse":0.413,"ip":"10.40.16.14/10.40.48.29","app":"3DSMax/1.0.0.0","args":"-i","startTime":"2017/12/07 15:00:21","endTime":"2017/12/07 15:00:21","running":1,"uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":22,"rpcMsgsIn":20,"rpcMsgsOut":21,"rpcSizeIn":22,"rpcSizeOut":23,"rpcHimarkFwd":318788,"rpcHimarkRev":318789,"rpcSnd":0.001,"rpcRcv":0.002,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":6,"pagesOut":3,"pagesCached":2,"writeLocks":2,"getRows":2,"putRows":1},{"tableName":"trigger_swarm.changesave","triggerLapse":0.044}]}`), + cleanJSON(output[1])) } func TestLongLapse(t *testing.T) { @@ -585,8 +624,8 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) //assert.Equal(t, "", output[0]) - assert.JSONEq(t, `{"processKey":"f00da0667f738b28e706360f6997741e","cmd":"user-files","pid":148469,"lineNo":2,"user":"fred","workspace":"LONWS","computeLapse":0,"completedLapse":2.02,"ip":"10.40.16.14","app":"3DSMax/1.0.0.0","args":"//depot/....3ds","startTime":"2017/12/07 15:00:21","endTime":"2017/12/07 15:00:23","running":1,"uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":22,"memMB":1,"memPeakMB":2,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"f00da0667f738b28e706360f6997741e","cmd":"user-files","pid":148469,"lineNo":2,"user":"fred","workspace":"LONWS","completedLapse":2.02,"ip":"10.40.16.14","app":"3DSMax/1.0.0.0","args":"//depot/....3ds","startTime":"2017/12/07 15:00:21","endTime":"2017/12/07 15:00:23","running":1,"uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":22,"memMB":1,"memPeakMB":2,"cmdError":false,"tables":[]}`), + cleanJSON(output[0])) } func TestNoStartRecord(t *testing.T) { @@ -611,10 +650,10 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 2, len(output)) //assert.Equal(t, "", output[1]) - assert.JSONEq(t, `{"processKey":"7c437167b3eef0a81ba6ecb710ad7572","cmd":"user-serverid","pid":25396,"lineNo":2,"user":"p4sdp","workspace":"chi","computeLapse":0,"completedLapse":0.002,"ip":"127.0.0.1","app":"p4/2019.2/LINUX26X86_64/1891638","args":"","startTime":"2020/01/11 02:00:02","endTime":"2020/01/11 02:00:02","running":1,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":8,"ipcIn":0,"ipcOut":0,"maxRss":8036,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":2,"rpcMsgsOut":3,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":795800,"rpcHimarkRev":795656,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[0]) - assert.JSONEq(t, `{"processKey":"9bbbb204208b1af212c38a906294708c","cmd":"user-login","pid":25390,"lineNo":4,"user":"bot-integ","workspace":"_____CLIENT_UNSET_____","computeLapse":0,"completedLapse":0.008,"ip":"127.0.0.1/10.5.40.103","app":"jenkins.p4-plugin/1.10.3-SNAPSHOT/Linux (brokered)","args":"-s","startTime":"2020/01/11 02:00:02","endTime":"2020/01/11 02:00:02","running":1,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":8,"ipcIn":0,"ipcOut":0,"maxRss":7632,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":2,"rpcMsgsOut":3,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":795800,"rpcHimarkRev":185540,"rpcSnd":0,"rpcRcv":0.007,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[1]) + assert.JSONEq(t, cleanJSON(`{"processKey":"7c437167b3eef0a81ba6ecb710ad7572","cmd":"user-serverid","pid":25396,"lineNo":2,"user":"p4sdp","workspace":"chi","completedLapse":0.002,"ip":"127.0.0.1","app":"p4/2019.2/LINUX26X86_64/1891638","args":"","startTime":"2020/01/11 02:00:02","endTime":"2020/01/11 02:00:02","running":1,"diskOut":8,"maxRss":8036,"rpcMsgsIn":2,"rpcMsgsOut":3,"rpcHimarkFwd":795800,"rpcHimarkRev":795656,"cmdError":false,"tables":[]}`), + cleanJSON(output[0])) + assert.JSONEq(t, cleanJSON(`{"processKey":"9bbbb204208b1af212c38a906294708c","cmd":"user-login","pid":25390,"lineNo":4,"user":"bot-integ","workspace":"_____CLIENT_UNSET_____","completedLapse":0.008,"ip":"127.0.0.1/10.5.40.103","app":"jenkins.p4-plugin/1.10.3-SNAPSHOT/Linux (brokered)","args":"-s","startTime":"2020/01/11 02:00:02","endTime":"2020/01/11 02:00:02","running":1,"diskOut":8,"maxRss":7632,"rpcMsgsIn":2,"rpcMsgsOut":3,"rpcHimarkFwd":795800,"rpcHimarkRev":185540,"rpcRcv":0.007,"cmdError":false,"tables":[]}`), + cleanJSON(output[1])) } func TestLogErrors(t *testing.T) { @@ -631,8 +670,8 @@ Perforce server error: output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) //assert.Equal(t, "", output[0]) - assert.JSONEq(t, `{"processKey":"227e3b54b1283b1fef89bc5843eb87d5","cmd":"user-resolved","pid":25883,"lineNo":2,"user":"user1","workspace":"ws1","computeLapse":0,"completedLapse":0,"ip":"10.1.3.158","app":"IntelliJ_IDEA_resolved/2018.1/LINUX26X86_64/1637071","args":"/home/user1/perforce_ws/ws1/.idea/... /home/user1/perforce_ws/ws1/...","startTime":"2019/12/20 09:42:15","endTime":"0001/01/01 00:00:00","running":1,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":true,"tables":[]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"227e3b54b1283b1fef89bc5843eb87d5","cmd":"user-resolved","pid":25883,"lineNo":2,"user":"user1","workspace":"ws1","ip":"10.1.3.158","app":"IntelliJ_IDEA_resolved/2018.1/LINUX26X86_64/1637071","args":"/home/user1/perforce_ws/ws1/.idea/... /home/user1/perforce_ws/ws1/...","startTime":"2019/12/20 09:42:15","endTime":"0001/01/01 00:00:00","running":1,"cmdError":true,"tables":[]}`), + cleanJSON(output[0])) } func TestIDLEErrors(t *testing.T) { @@ -663,10 +702,10 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 2, len(output)) //assert.Equal(t, "", output[1]) - assert.JSONEq(t, `{"processKey":"33ac9675a65f8c437998987e55c11f9f","cmd":"pull","pid":6170,"lineNo":7,"user":"svc_wok","workspace":"unknown","computeLapse":0,"completedLapse":0,"ip":"background","app":"p4d/2019.2/LINUX26X86_64/1891638","args":"-i 1","startTime":"2020/01/11 02:00:06","endTime":"2020/01/11 02:00:06","running":148,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"view","pagesIn":2,"pagesOut":3,"pagesCached":96,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":4,"writeLocks":5,"getRows":6,"posRows":7,"scanRows":8,"putRows":9,"delRows":10,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[0]) - assert.JSONEq(t, `{"processKey":"7c437167b3eef0a81ba6ecb710ad7572","cmd":"user-serverid","pid":25396,"lineNo":2,"user":"p4sdp","workspace":"chi","computeLapse":0,"completedLapse":0.008,"ip":"127.0.0.1","app":"p4/2019.2/LINUX26X86_64/1891638","args":"","startTime":"2020/01/11 02:00:02","endTime":"2020/01/11 02:00:02","running":1,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":8,"ipcIn":0,"ipcOut":0,"maxRss":7632,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[1]) + assert.JSONEq(t, cleanJSON(`{"processKey":"33ac9675a65f8c437998987e55c11f9f","cmd":"pull","pid":6170,"lineNo":7,"user":"svc_wok","workspace":"unknown","ip":"background","app":"p4d/2019.2/LINUX26X86_64/1891638","args":"-i 1","startTime":"2020/01/11 02:00:06","endTime":"2020/01/11 02:00:06","running":148,"cmdError":false,"tables":[{"tableName":"view","pagesIn":2,"pagesOut":3,"pagesCached":96,"readLocks":4,"writeLocks":5,"getRows":6,"posRows":7,"scanRows":8,"putRows":9,"delRows":10}]}`), + cleanJSON(output[0])) + assert.JSONEq(t, cleanJSON(`{"processKey":"7c437167b3eef0a81ba6ecb710ad7572","cmd":"user-serverid","pid":25396,"lineNo":2,"user":"p4sdp","workspace":"chi","completedLapse":0.008,"ip":"127.0.0.1","app":"p4/2019.2/LINUX26X86_64/1891638","args":"","startTime":"2020/01/11 02:00:02","endTime":"2020/01/11 02:00:02","running":1,"diskOut":8,"maxRss":7632,"cmdError":false,"tables":[]}`), + cleanJSON(output[1])) } func TestDuplicatePulls(t *testing.T) { @@ -701,12 +740,12 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 3, len(output)) //assert.Equal(t, "", output[2]) - assert.JSONEq(t, `{"processKey":"642f3b3976afda703fb97524581913b7","cmd":"pull","pid":6170,"lineNo":2,"user":"svc_wok","workspace":"unknown","computeLapse":0,"completedLapse":0,"ip":"background","app":"p4d/2019.2/LINUX26X86_64/1891638","args":"-i 1","startTime":"2019/12/20 08:00:03","endTime":"2019/12/20 08:00:03","running":0,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"view","pagesIn":2,"pagesOut":3,"pagesCached":96,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":4,"writeLocks":5,"getRows":6,"posRows":7,"scanRows":8,"putRows":9,"delRows":10,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[0]) - assert.JSONEq(t, `{"processKey":"642f3b3976afda703fb97524581913b7.10","cmd":"pull","pid":6170,"lineNo":10,"user":"svc_wok","workspace":"unknown","computeLapse":0,"completedLapse":0,"ip":"background","app":"p4d/2019.2/LINUX26X86_64/1891638","args":"-i 1","startTime":"2019/12/20 08:00:03","endTime":"2019/12/20 08:00:03","running":0,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"domain","pagesIn":2,"pagesOut":3,"pagesCached":96,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":1,"getRows":0,"posRows":0,"scanRows":0,"putRows":1,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[1]) - assert.JSONEq(t, `{"processKey":"642f3b3976afda703fb97524581913b7.18","cmd":"pull","pid":6170,"lineNo":18,"user":"svc_wok","workspace":"unknown","computeLapse":0,"completedLapse":0,"ip":"background","app":"p4d/2019.2/LINUX26X86_64/1891638","args":"-i 1","startTime":"2019/12/20 08:00:03","endTime":"2019/12/20 08:00:03","running":0,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"domain","pagesIn":2,"pagesOut":3,"pagesCached":96,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":1,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":1,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"view","pagesIn":2,"pagesOut":3,"pagesCached":96,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":1,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":1,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[2]) + assert.JSONEq(t, cleanJSON(`{"processKey":"642f3b3976afda703fb97524581913b7","cmd":"pull","pid":6170,"lineNo":2,"user":"svc_wok","workspace":"unknown","ip":"background","app":"p4d/2019.2/LINUX26X86_64/1891638","args":"-i 1","startTime":"2019/12/20 08:00:03","endTime":"2019/12/20 08:00:03","cmdError":false,"tables":[{"tableName":"view","pagesIn":2,"pagesOut":3,"pagesCached":96,"readLocks":4,"writeLocks":5,"getRows":6,"posRows":7,"scanRows":8,"putRows":9,"delRows":10}]}`), + cleanJSON(output[0])) + assert.JSONEq(t, cleanJSON(`{"processKey":"642f3b3976afda703fb97524581913b7.10","cmd":"pull","pid":6170,"lineNo":10,"user":"svc_wok","workspace":"unknown","ip":"background","app":"p4d/2019.2/LINUX26X86_64/1891638","args":"-i 1","startTime":"2019/12/20 08:00:03","endTime":"2019/12/20 08:00:03","cmdError":false,"tables":[{"tableName":"domain","pagesIn":2,"pagesOut":3,"pagesCached":96,"writeLocks":1,"putRows":1}]}`), + cleanJSON(output[1])) + assert.JSONEq(t, cleanJSON(`{"processKey":"642f3b3976afda703fb97524581913b7.18","cmd":"pull","pid":6170,"lineNo":18,"user":"svc_wok","workspace":"unknown","ip":"background","app":"p4d/2019.2/LINUX26X86_64/1891638","args":"-i 1","startTime":"2019/12/20 08:00:03","endTime":"2019/12/20 08:00:03","cmdError":false,"tables":[{"tableName":"domain","pagesIn":2,"pagesOut":3,"pagesCached":96,"writeLocks":1,"delRows":1},{"tableName":"view","pagesIn":2,"pagesOut":3,"pagesCached":96,"writeLocks":1,"delRows":1}]}`), + cleanJSON(output[2])) } // Process multiple meta/db entries and intermediate @@ -770,8 +809,8 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) //assert.Equal(t, "", output[0]) - assert.JSONEq(t, `{"processKey":"026c2d4135085764d23fd21f41d30f77","cmd":"user-sync","pid":145941,"lineNo":2,"user":"builder","workspace":"LON","computeLapse":0.11,"completedLapse":0.111,"ip":"10.10.16.171/10.10.20.195","app":"AutoWorker/1.0.0.0","args":"//assets/level/instances.xml","startTime":"2017/12/07 15:00:01","endTime":"2017/12/07 15:00:01","running":1,"uCpu":77,"sCpu":25,"diskIn":112,"diskOut":3136,"ipcIn":0,"ipcOut":0,"maxRss":4964,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"026c2d4135085764d23fd21f41d30f77","cmd":"user-sync","pid":145941,"lineNo":2,"user":"builder","workspace":"LON","computeLapse":0.11,"completedLapse":0.111,"ip":"10.10.16.171/10.10.20.195","app":"AutoWorker/1.0.0.0","args":"//assets/level/instances.xml","startTime":"2017/12/07 15:00:01","endTime":"2017/12/07 15:00:01","running":1,"uCpu":77,"sCpu":25,"diskIn":112,"diskOut":3136,"maxRss":4964,"cmdError":false,"tables":[]}`), + cleanJSON(output[0])) } func TestEdgeLog(t *testing.T) { @@ -821,14 +860,14 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 4, len(output)) //assert.Equal(t, "", output[3]) - assert.JSONEq(t, `{"processKey":"44c92f3be809fd15dfc26cc8fb359216","cmd":"pull","pid":55998,"lineNo":38,"user":"svc0","workspace":"unknown","computeLapse":0,"completedLapse":0,"ip":"background","app":"p4d/2018.1/DARWIN90X86_64/1660568","args":"-u -i 1 -b 1","startTime":"2018/06/01 04:29:44","endTime":"2018/06/01 04:29:44","running":0,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"rdb.lbr","pagesIn":7,"pagesOut":4,"pagesCached":2,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":3,"getRows":1,"posRows":1,"scanRows":4,"putRows":1,"delRows":1,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[0]) - assert.JSONEq(t, `{"processKey":"9e39beedee815db46bb4c870c11a0b8d","cmd":"pull","pid":55997,"lineNo":2,"user":"svc0","workspace":"unknown","computeLapse":0,"completedLapse":0,"ip":"background","app":"p4d/2018.1/DARWIN90X86_64/1660568","args":"-I 100 -b 1","startTime":"2018/06/01 04:29:43","endTime":"2018/06/01 04:29:43","running":0,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":2,"pagesOut":0,"pagesCached":2,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":1,"getRows":1,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[1]) - assert.JSONEq(t, `{"processKey":"9e39beedee815db46bb4c870c11a0b8d.10","cmd":"pull","pid":55997,"lineNo":10,"user":"svc0","workspace":"unknown","computeLapse":0,"completedLapse":0,"ip":"background","app":"p4d/2018.1/DARWIN90X86_64/1660568","args":"-I 100 -b 1","startTime":"2018/06/01 04:29:43","endTime":"2018/06/01 04:29:43","running":0,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":4,"pagesOut":3,"pagesCached":2,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":2,"getRows":0,"posRows":0,"scanRows":0,"putRows":1,"delRows":1,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[2]) - assert.JSONEq(t, `{"processKey":"9e39beedee815db46bb4c870c11a0b8d.18","cmd":"pull","pid":55997,"lineNo":18,"user":"svc0","workspace":"unknown","computeLapse":0,"completedLapse":0.001,"ip":"background","app":"p4d/2018.1/DARWIN90X86_64/1660568","args":"-I 100 -b 1","startTime":"2018/06/01 04:29:43","endTime":"2018/06/01 04:29:43","running":0,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"change","pagesIn":4,"pagesOut":3,"pagesCached":2,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":1,"getRows":0,"posRows":0,"scanRows":0,"putRows":1,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"changex","pagesIn":4,"pagesOut":3,"pagesCached":2,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":1,"getRows":0,"posRows":0,"scanRows":0,"putRows":1,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"counters","pagesIn":2,"pagesOut":3,"pagesCached":2,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":1,"getRows":1,"posRows":0,"scanRows":0,"putRows":1,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"desc","pagesIn":4,"pagesOut":3,"pagesCached":2,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":1,"getRows":0,"posRows":0,"scanRows":0,"putRows":1,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[3]) + assert.JSONEq(t, cleanJSON(`{"processKey":"44c92f3be809fd15dfc26cc8fb359216","cmd":"pull","pid":55998,"lineNo":38,"user":"svc0","workspace":"unknown","ip":"background","app":"p4d/2018.1/DARWIN90X86_64/1660568","args":"-u -i 1 -b 1","startTime":"2018/06/01 04:29:44","endTime":"2018/06/01 04:29:44","cmdError":false,"tables":[{"tableName":"rdb.lbr","pagesIn":7,"pagesOut":4,"pagesCached":2,"writeLocks":3,"getRows":1,"posRows":1,"scanRows":4,"putRows":1,"delRows":1}]}`), + cleanJSON(output[0])) + assert.JSONEq(t, cleanJSON(`{"processKey":"9e39beedee815db46bb4c870c11a0b8d","cmd":"pull","pid":55997,"lineNo":2,"user":"svc0","workspace":"unknown","ip":"background","app":"p4d/2018.1/DARWIN90X86_64/1660568","args":"-I 100 -b 1","startTime":"2018/06/01 04:29:43","endTime":"2018/06/01 04:29:43","cmdError":false,"tables":[{"tableName":"counters","pagesIn":2,"pagesCached":2,"writeLocks":1,"getRows":1}]}`), + cleanJSON(output[1])) + assert.JSONEq(t, cleanJSON(`{"processKey":"9e39beedee815db46bb4c870c11a0b8d.10","cmd":"pull","pid":55997,"lineNo":10,"user":"svc0","workspace":"unknown","ip":"background","app":"p4d/2018.1/DARWIN90X86_64/1660568","args":"-I 100 -b 1","startTime":"2018/06/01 04:29:43","endTime":"2018/06/01 04:29:43","cmdError":false,"tables":[{"tableName":"counters","pagesIn":4,"pagesOut":3,"pagesCached":2,"writeLocks":2,"putRows":1,"delRows":1}]}`), + cleanJSON(output[2])) + assert.JSONEq(t, cleanJSON(`{"processKey":"9e39beedee815db46bb4c870c11a0b8d.18","cmd":"pull","pid":55997,"lineNo":18,"user":"svc0","workspace":"unknown","completedLapse":0.001,"ip":"background","app":"p4d/2018.1/DARWIN90X86_64/1660568","args":"-I 100 -b 1","startTime":"2018/06/01 04:29:43","endTime":"2018/06/01 04:29:43","cmdError":false,"tables":[{"tableName":"change","pagesIn":4,"pagesOut":3,"pagesCached":2,"writeLocks":1,"putRows":1},{"tableName":"changex","pagesIn":4,"pagesOut":3,"pagesCached":2,"writeLocks":1,"putRows":1},{"tableName":"counters","pagesIn":2,"pagesOut":3,"pagesCached":2,"writeLocks":1,"getRows":1,"putRows":1},{"tableName":"desc","pagesIn":4,"pagesOut":3,"pagesCached":2,"writeLocks":1,"putRows":1}]}`), + cleanJSON(output[3])) } func TestBlockWithLocksAcquired(t *testing.T) { @@ -853,10 +892,10 @@ locks acquired by blocking after 3 non-blocking attempts output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) //assert.Equal(t, "", output[0]) - assert.JSONEq(t, `{"processKey":"f7d483631e94d16adde6c5306be15fbe","cmd":"user-revert","pid":22245,"lineNo":2,"user":"auto","workspace":"archive_auto","computeLapse":0,"completedLapse":6.92,"ip":"127.0.0.1","app":"archive/v60","args":"/usr/local/arch/datastore/...","startTime":"2018/09/06 06:00:02","endTime":"2018/09/06 06:00:02","running":1,"uCpu":6901,"sCpu":4,"diskIn":32,"diskOut":8,"ipcIn":0,"ipcOut":0,"maxRss":19996,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"protect","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":4,"totalReadHeld":6875,"totalWriteWait":5,"totalWriteHeld":6,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"resolve","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":23792,"totalReadHeld":3,"totalWriteWait":2,"totalWriteHeld":1,"maxReadWait":23792,"maxReadHeld":3,"maxWriteWait":2,"maxWriteHeld":1,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[0]) - assert.JSONEq(t, `{"processKey":"f7d483631e94d16adde6c5306be15fbe","cmd":"user-revert","pid":22245,"lineNo":2,"user":"auto","workspace":"archive_auto","computeLapse":0,"completedLapse":6.92,"ip":"127.0.0.1","app":"archive/v60","args":"/usr/local/arch/datastore/...","startTime":"2018/09/06 06:00:02","endTime":"2018/09/06 06:00:02","running":1,"uCpu":6901,"sCpu":4,"diskIn":32,"diskOut":8,"ipcIn":0,"ipcOut":0,"maxRss":19996,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"protect","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":4,"totalReadHeld":6875,"totalWriteWait":5,"totalWriteHeld":6,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"resolve","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":23792,"totalReadHeld":3,"totalWriteWait":2,"totalWriteHeld":1,"maxReadWait":23792,"maxReadHeld":3,"maxWriteWait":2,"maxWriteHeld":1,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"f7d483631e94d16adde6c5306be15fbe","cmd":"user-revert","pid":22245,"lineNo":2,"user":"auto","workspace":"archive_auto","completedLapse":6.92,"ip":"127.0.0.1","app":"archive/v60","args":"/usr/local/arch/datastore/...","startTime":"2018/09/06 06:00:02","endTime":"2018/09/06 06:00:02","running":1,"uCpu":6901,"sCpu":4,"diskIn":32,"diskOut":8,"maxRss":19996,"cmdError":false,"tables":[{"tableName":"protect","totalReadWait":4,"totalReadHeld":6875,"totalWriteWait":5,"totalWriteHeld":6},{"tableName":"resolve","totalReadWait":23792,"totalReadHeld":3,"totalWriteWait":2,"totalWriteHeld":1,"maxReadWait":23792,"maxReadHeld":3,"maxWriteWait":2,"maxWriteHeld":1}]}`), + cleanJSON(output[0])) + assert.JSONEq(t, cleanJSON(`{"processKey":"f7d483631e94d16adde6c5306be15fbe","cmd":"user-revert","pid":22245,"lineNo":2,"user":"auto","workspace":"archive_auto","completedLapse":6.92,"ip":"127.0.0.1","app":"archive/v60","args":"/usr/local/arch/datastore/...","startTime":"2018/09/06 06:00:02","endTime":"2018/09/06 06:00:02","running":1,"uCpu":6901,"sCpu":4,"diskIn":32,"diskOut":8,"maxRss":19996,"cmdError":false,"tables":[{"tableName":"protect","totalReadWait":4,"totalReadHeld":6875,"totalWriteWait":5,"totalWriteHeld":6},{"tableName":"resolve","totalReadWait":23792,"totalReadHeld":3,"totalWriteWait":2,"totalWriteHeld":1,"maxReadWait":23792,"maxReadHeld":3,"maxWriteWait":2,"maxWriteHeld":1}]}`), + cleanJSON(output[0])) } func TestTriggers(t *testing.T) { @@ -915,12 +954,12 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 3, len(output)) //assert.Equal(t, "", output[2]) - assert.JSONEq(t, `{"processKey":"b9ec8da8ea642419a06f8ac4060f261c","cmd":"rmt-Journal","pid":17916,"lineNo":4,"user":"svc_p4d_ha_chi","workspace":"unknown","computeLapse":0,"completedLapse":0.202,"ip":"10.5.70.41","app":"p4d/2019.2/LINUX26X86_64/1908095","args":"","startTime":"2020/03/11 06:08:16","endTime":"2020/03/11 06:08:16","running":1,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":1,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":280100,"rpcHimarkRev":278660,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":6,"pagesOut":0,"pagesCached":2,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":6,"writeLocks":0,"getRows":6,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[0]) - assert.JSONEq(t, `{"processKey":"b9ec8da8ea642419a06f8ac4060f261c.12","cmd":"rmt-Journal","pid":17916,"lineNo":12,"user":"svc_p4d_ha_chi","workspace":"unknown","computeLapse":0,"completedLapse":0.001,"ip":"10.5.70.41","app":"p4d/2019.2/LINUX26X86_64/1908095","args":"","startTime":"2020/03/11 06:08:16","endTime":"2020/03/11 06:08:16","running":1,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":1,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":280100,"rpcHimarkRev":278660,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":1,"pagesOut":0,"pagesCached":2,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":1,"writeLocks":0,"getRows":1,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[1]) - assert.JSONEq(t, `{"processKey":"b9f9aee10027df004a0e35a3c9931e27","cmd":"user-change","pid":15855,"lineNo":2,"user":"fred","workspace":"fred_ws","computeLapse":0,"completedLapse":0.276,"ip":"10.1.4.213/10.1.3.243","app":"Helix P4V/NTX64/2019.2/1904275/v86","args":"-i","startTime":"2020/03/11 06:08:16","endTime":"2020/03/11 06:08:17","running":1,"uCpu":4,"sCpu":4,"diskIn":256,"diskOut":240,"ipcIn":0,"ipcOut":0,"maxRss":9212,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":3,"rpcMsgsOut":5,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":280100,"rpcHimarkRev":280100,"rpcSnd":0,"rpcRcv":0.19,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":7,"pagesOut":6,"pagesCached":2,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":1,"writeLocks":2,"getRows":3,"posRows":0,"scanRows":0,"putRows":2,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"monitor","pagesIn":2,"pagesOut":4,"pagesCached":256,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":2,"getRows":0,"posRows":0,"scanRows":0,"putRows":2,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"protect","pagesIn":9,"pagesOut":0,"pagesCached":7,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":1,"writeLocks":0,"getRows":0,"posRows":1,"scanRows":345,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":1,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"storagemasterup_R","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":1,"totalReadHeld":2,"totalWriteWait":3,"totalWriteHeld":4,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"storageup_R","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":1,"totalReadHeld":2,"totalWriteWait":3,"totalWriteHeld":4,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"trigger_swarm.changesave","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0.076}]}`, - output[2]) + assert.JSONEq(t, cleanJSON(`{"processKey":"b9ec8da8ea642419a06f8ac4060f261c","cmd":"rmt-Journal","pid":17916,"lineNo":4,"user":"svc_p4d_ha_chi","workspace":"unknown","completedLapse":0.202,"ip":"10.5.70.41","app":"p4d/2019.2/LINUX26X86_64/1908095","args":"","startTime":"2020/03/11 06:08:16","endTime":"2020/03/11 06:08:16","running":1,"rpcMsgsOut":1,"rpcHimarkFwd":280100,"rpcHimarkRev":278660,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":6,"pagesCached":2,"readLocks":6,"getRows":6}]}`), + cleanJSON(output[0])) + assert.JSONEq(t, cleanJSON(`{"processKey":"b9ec8da8ea642419a06f8ac4060f261c.12","cmd":"rmt-Journal","pid":17916,"lineNo":12,"user":"svc_p4d_ha_chi","workspace":"unknown","completedLapse":0.001,"ip":"10.5.70.41","app":"p4d/2019.2/LINUX26X86_64/1908095","args":"","startTime":"2020/03/11 06:08:16","endTime":"2020/03/11 06:08:16","running":1,"rpcMsgsOut":1,"rpcHimarkFwd":280100,"rpcHimarkRev":278660,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":1,"pagesCached":2,"readLocks":1,"getRows":1}]}`), + cleanJSON(output[1])) + assert.JSONEq(t, cleanJSON(`{"processKey":"b9f9aee10027df004a0e35a3c9931e27","cmd":"user-change","pid":15855,"lineNo":2,"user":"fred","workspace":"fred_ws","completedLapse":0.276,"ip":"10.1.4.213/10.1.3.243","app":"Helix P4V/NTX64/2019.2/1904275/v86","args":"-i","startTime":"2020/03/11 06:08:16","endTime":"2020/03/11 06:08:17","running":1,"uCpu":4,"sCpu":4,"diskIn":256,"diskOut":240,"maxRss":9212,"rpcMsgsIn":3,"rpcMsgsOut":5,"rpcHimarkFwd":280100,"rpcHimarkRev":280100,"rpcRcv":0.19,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":7,"pagesOut":6,"pagesCached":2,"readLocks":1,"writeLocks":2,"getRows":3,"putRows":2},{"tableName":"monitor","pagesIn":2,"pagesOut":4,"pagesCached":256,"writeLocks":2,"putRows":2},{"tableName":"protect","pagesIn":9,"pagesCached":7,"readLocks":1,"posRows":1,"scanRows":345,"peekCount":1},{"tableName":"storagemasterup_R","totalReadWait":1,"totalReadHeld":2,"totalWriteWait":3,"totalWriteHeld":4},{"tableName":"storageup_R","totalReadWait":1,"totalReadHeld":2,"totalWriteWait":3,"totalWriteHeld":4},{"tableName":"trigger_swarm.changesave","triggerLapse":0.076}]}`), + cleanJSON(output[2])) } func TestTriggersCommit(t *testing.T) { @@ -932,8 +971,8 @@ lapse .079s output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) //assert.Equal(t, "", output[0]) - assert.JSONEq(t, `{"processKey":"940a4da8bf0e516fdd8685452d489537","cmd":"dm-CommitSubmit","pid":59469,"lineNo":2,"user":"robomerge","workspace":"ROBOMERGE_EOSSDK_EOSSDK_Dev_EAC","computeLapse":0,"completedLapse":0,"ip":"10.1.20.80","app":"robomerge/v717","args":"","startTime":"2020/07/20 15:00:13","endTime":"0001/01/01 00:00:00","running":1,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"trigger_swarm.commit","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0.079}]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"940a4da8bf0e516fdd8685452d489537","cmd":"dm-CommitSubmit","pid":59469,"lineNo":2,"user":"robomerge","workspace":"ROBOMERGE_EOSSDK_EOSSDK_Dev_EAC","ip":"10.1.20.80","app":"robomerge/v717","args":"","startTime":"2020/07/20 15:00:13","endTime":"0001/01/01 00:00:00","running":1,"cmdError":false,"tables":[{"tableName":"trigger_swarm.commit","triggerLapse":0.079}]}`), + cleanJSON(output[0])) } func TestTriggersStrict(t *testing.T) { @@ -945,8 +984,8 @@ lapse 1.39s output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) //assert.Equal(t, "", output[0]) - assert.JSONEq(t, `{"processKey":"940a4da8bf0e516fdd8685452d489537","cmd":"dm-CommitSubmit","pid":59469,"lineNo":2,"user":"robomerge","workspace":"ROBOMERGE_EOSSDK_EOSSDK_Dev_EAC","computeLapse":0,"completedLapse":0,"ip":"10.1.20.80","app":"robomerge/v717","args":"","startTime":"2020/07/20 15:00:13","endTime":"0001/01/01 00:00:00","running":1,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"trigger_swarm.strict","pagesIn":0,"pagesOut":0,"pagesCached":0,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":0,"scanRows":0,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":1.39}]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"940a4da8bf0e516fdd8685452d489537","cmd":"dm-CommitSubmit","pid":59469,"lineNo":2,"user":"robomerge","workspace":"ROBOMERGE_EOSSDK_EOSSDK_Dev_EAC","ip":"10.1.20.80","app":"robomerge/v717","args":"","startTime":"2020/07/20 15:00:13","endTime":"0001/01/01 00:00:00","running":1,"cmdError":false,"tables":[{"tableName":"trigger_swarm.strict","triggerLapse":1.39}]}`), + cleanJSON(output[0])) } func TestForLbrRcs(t *testing.T) { @@ -966,8 +1005,8 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) //assert.Equal(t, "", output[0]) - assert.JSONEq(t, `{"processKey":"f00da0667f738b28e706360f6997741e","cmd":"user-files","pid":148469,"lineNo":2,"user":"fred","workspace":"LONWS","computeLapse":0,"completedLapse":2.02,"ip":"10.40.16.14","app":"3DSMax/1.0.0.0","args":"//depot/....3ds","startTime":"2017/12/07 15:00:21","endTime":"2017/12/07 15:00:23","running":1,"uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":22,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":1,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":4,"lbrRcsReads":6,"lbrRcsReadBytes":12390,"lbrRcsWrites":0,"lbrRcsWriteBytes":3379,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"f00da0667f738b28e706360f6997741e","cmd":"user-files","pid":148469,"lineNo":2,"user":"fred","workspace":"LONWS","completedLapse":2.02,"ip":"10.40.16.14","app":"3DSMax/1.0.0.0","args":"//depot/....3ds","startTime":"2017/12/07 15:00:21","endTime":"2017/12/07 15:00:23","running":1,"uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":22,"lbrRcsOpens":1,"lbrRcsExists":4,"lbrRcsReads":6,"lbrRcsReadBytes":12390,"lbrRcsWriteBytes":3379,"cmdError":false,"tables":[]}`), + cleanJSON(output[0])) } func TestForCompress(t *testing.T) { @@ -987,8 +1026,8 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) //assert.Equal(t, "", output[0]) - assert.JSONEq(t, `{"processKey":"f00da0667f738b28e706360f6997741e","cmd":"user-files","pid":148469,"lineNo":2,"user":"fred","workspace":"LONWS","computeLapse":0,"completedLapse":2.02,"ip":"10.40.16.14","app":"3DSMax/1.0.0.0","args":"//depot/....3ds","startTime":"2017/12/07 15:00:21","endTime":"2017/12/07 15:00:23","running":1,"uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":22,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":6,"lbrCompressCloses":4,"lbrCompressCheckins":2,"lbrCompressExists":5,"lbrCompressReads":3,"lbrCompressReadBytes":13623389302292480,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"f00da0667f738b28e706360f6997741e","cmd":"user-files","pid":148469,"lineNo":2,"user":"fred","workspace":"LONWS","completedLapse":2.02,"ip":"10.40.16.14","app":"3DSMax/1.0.0.0","args":"//depot/....3ds","startTime":"2017/12/07 15:00:21","endTime":"2017/12/07 15:00:23","running":1,"uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":22,"lbrCompressOpens":6,"lbrCompressCloses":4,"lbrCompressCheckins":2,"lbrCompressExists":5,"lbrCompressReads":3,"lbrCompressReadBytes":13623389302292480,"cmdError":false,"tables":[]}`), + cleanJSON(output[0])) } func TestForUnCompress(t *testing.T) { @@ -1008,8 +1047,8 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) //assert.Equal(t, "", output[0]) - assert.JSONEq(t, `{"processKey":"f00da0667f738b28e706360f6997741e","cmd":"user-files","pid":148469,"lineNo":2,"user":"fred","workspace":"LONWS","computeLapse":0,"completedLapse":2.02,"ip":"10.40.16.14","app":"3DSMax/1.0.0.0","args":"//depot/....3ds","startTime":"2017/12/07 15:00:21","endTime":"2017/12/07 15:00:23","running":1,"uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":22,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":1,"lbrUncompressCloses":2,"lbrUncompressCheckins":3,"lbrUncompressExists":4,"lbrUncompressReads":6,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":4198,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"f00da0667f738b28e706360f6997741e","cmd":"user-files","pid":148469,"lineNo":2,"user":"fred","workspace":"LONWS","completedLapse":2.02,"ip":"10.40.16.14","app":"3DSMax/1.0.0.0","args":"//depot/....3ds","startTime":"2017/12/07 15:00:21","endTime":"2017/12/07 15:00:23","running":1,"uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":22,"lbrUncompressOpens":1,"lbrUncompressCloses":2,"lbrUncompressCheckins":3,"lbrUncompressExists":4,"lbrUncompressReads":6,"lbrUncompressWriteBytes":4198,"cmdError":false,"tables":[]}`), + cleanJSON(output[0])) } func TestForLbrAndTable(t *testing.T) { @@ -1045,8 +1084,8 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) //assert.Equal(t, "", output[0]) - assert.JSONEq(t, `{"processKey":"c64b38c5e71582bd477ffcaab5b3514d","cmd":"user-transmit","pid":1871637,"lineNo":2,"user":"build","workspace":"cmdr-tools-change-155476395","computeLapse":0,"completedLapse":0.011,"ip":"127.0.0.1/10.5.64.108","app":"p4/2018.1/LINUX26X86_64/1957529 (brokered)","args":"-t1871630 -b8 -s524288 -p","startTime":"2023/07/01 02:00:02","endTime":"2023/07/01 02:00:02","running":1,"uCpu":5,"sCpu":4,"diskIn":0,"diskOut":8,"ipcIn":0,"ipcOut":0,"maxRss":10364,"pageFaults":0,"memMB":25,"memPeakMB":26,"rpcMsgsIn":2,"rpcMsgsOut":74,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":97604,"rpcHimarkRev":318788,"rpcSnd":0,"rpcRcv":0.001,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":8,"lbrRcsCloses":8,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":16,"lbrRcsReadBytes":202547,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":1,"lbrRcsFileSizes":2,"lbrRcsModTimes":3,"lbrRcsCopies":4,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":16,"lbrCompressCloses":16,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":32,"lbrCompressReadBytes":142028,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"monitor","pagesIn":2,"pagesOut":4,"pagesCached":4096,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":2,"getRows":0,"posRows":0,"scanRows":0,"putRows":2,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":1,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":1,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0},{"tableName":"topology","pagesIn":5,"pagesOut":0,"pagesCached":4,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":1,"writeLocks":0,"getRows":0,"posRows":1,"scanRows":1,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":0,"totalPeekWait":0,"totalPeekHeld":0,"maxPeekWait":0,"maxPeekHeld":0,"triggerLapse":0}]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"c64b38c5e71582bd477ffcaab5b3514d","cmd":"user-transmit","pid":1871637,"lineNo":2,"user":"build","workspace":"cmdr-tools-change-155476395","completedLapse":0.011,"ip":"127.0.0.1/10.5.64.108","app":"p4/2018.1/LINUX26X86_64/1957529 (brokered)","args":"-t1871630 -b8 -s524288 -p","startTime":"2023/07/01 02:00:02","endTime":"2023/07/01 02:00:02","running":1,"uCpu":5,"sCpu":4,"diskOut":8,"maxRss":10364,"memMB":25,"memPeakMB":26,"rpcMsgsIn":2,"rpcMsgsOut":74,"rpcHimarkFwd":97604,"rpcHimarkRev":318788,"rpcRcv":0.001,"lbrRcsOpens":8,"lbrRcsCloses":8,"lbrRcsReads":16,"lbrRcsReadBytes":202547,"lbrRcsDigests":1,"lbrRcsFileSizes":2,"lbrRcsModTimes":3,"lbrRcsCopies":4,"lbrCompressOpens":16,"lbrCompressCloses":16,"lbrCompressReads":32,"lbrCompressReadBytes":142028,"cmdError":false,"tables":[{"tableName":"monitor","pagesIn":2,"pagesOut":4,"pagesCached":4096,"writeLocks":2,"putRows":2,"totalWriteWait":1,"maxWriteWait":1},{"tableName":"topology","pagesIn":5,"pagesCached":4,"readLocks":1,"posRows":1,"scanRows":1}]}`), + cleanJSON(output[0])) } func TestForLbrUncompressDigestsFilesize(t *testing.T) { @@ -1067,8 +1106,8 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) //assert.Equal(t, "", output[0]) - assert.JSONEq(t, `{"processKey":"f00da0667f738b28e706360f6997741e","cmd":"user-files","pid":148469,"lineNo":4,"user":"fred","workspace":"LONWS","computeLapse":0,"completedLapse":2.02,"ip":"10.40.16.14","app":"3DSMax/1.0.0.0","args":"//depot/....3ds","startTime":"2017/12/07 15:00:21","endTime":"2017/12/07 15:00:23","running":0,"uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":22,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":1,"lbrUncompressCloses":2,"lbrUncompressCheckins":3,"lbrUncompressExists":4,"lbrUncompressReads":6,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":4198,"lbrUncompressDigests":3,"lbrUncompressFileSizes":4,"lbrUncompressModTimes":5,"lbrUncompressCopies":6,"cmdError":false,"tables":[]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"f00da0667f738b28e706360f6997741e","cmd":"user-files","pid":148469,"lineNo":4,"user":"fred","workspace":"LONWS","completedLapse":2.02,"ip":"10.40.16.14","app":"3DSMax/1.0.0.0","args":"//depot/....3ds","startTime":"2017/12/07 15:00:21","endTime":"2017/12/07 15:00:23","uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":22,"lbrUncompressOpens":1,"lbrUncompressCloses":2,"lbrUncompressCheckins":3,"lbrUncompressExists":4,"lbrUncompressReads":6,"lbrUncompressWriteBytes":4198,"lbrUncompressDigests":3,"lbrUncompressFileSizes":4,"lbrUncompressModTimes":5,"lbrUncompressCopies":6,"cmdError":false,"tables":[]}`), + cleanJSON(output[0])) } func TestForLbrCompressDigestsFilesize(t *testing.T) { @@ -1089,8 +1128,8 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) //assert.Equal(t, "", output[0]) - assert.JSONEq(t, `{"processKey":"f00da0667f738b28e706360f6997741e","cmd":"user-files","pid":148469,"lineNo":4,"user":"fred","workspace":"LONWS","computeLapse":0,"completedLapse":2.02,"ip":"10.40.16.14","app":"3DSMax/1.0.0.0","args":"//depot/....3ds","startTime":"2017/12/07 15:00:21","endTime":"2017/12/07 15:00:23","running":0,"uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":22,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":4,"lbrCompressCloses":5,"lbrCompressCheckins":6,"lbrCompressExists":7,"lbrCompressReads":6,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":4198,"lbrCompressDigests":21,"lbrCompressFileSizes":22,"lbrCompressModTimes":23,"lbrCompressCopies":24,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"f00da0667f738b28e706360f6997741e","cmd":"user-files","pid":148469,"lineNo":4,"user":"fred","workspace":"LONWS","completedLapse":2.02,"ip":"10.40.16.14","app":"3DSMax/1.0.0.0","args":"//depot/....3ds","startTime":"2017/12/07 15:00:21","endTime":"2017/12/07 15:00:23","uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":22,"lbrCompressOpens":4,"lbrCompressCloses":5,"lbrCompressCheckins":6,"lbrCompressExists":7,"lbrCompressReads":6,"lbrCompressWriteBytes":4198,"lbrCompressDigests":21,"lbrCompressFileSizes":22,"lbrCompressModTimes":23,"lbrCompressCopies":24,"cmdError":false,"tables":[]}`), + cleanJSON(output[0])) } func TestForLbrDigestsFilesize(t *testing.T) { @@ -1109,8 +1148,8 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) //assert.Equal(t, "", output[0]) - assert.JSONEq(t, `{"processKey":"f00da0667f738b28e706360f6997741e","cmd":"user-files","pid":148469,"lineNo":4,"user":"fred","workspace":"LONWS","computeLapse":0,"completedLapse":2.02,"ip":"10.40.16.14","app":"3DSMax/1.0.0.0","args":"//depot/....3ds","startTime":"2017/12/07 15:00:21","endTime":"2017/12/07 15:00:23","running":0,"uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":22,"memMB":0,"memPeakMB":0,"rpcMsgsIn":0,"rpcMsgsOut":0,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":0,"rpcHimarkRev":0,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":1,"lbrCompressFileSizes":2,"lbrCompressModTimes":3,"lbrCompressCopies":4,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"f00da0667f738b28e706360f6997741e","cmd":"user-files","pid":148469,"lineNo":4,"user":"fred","workspace":"LONWS","completedLapse":2.02,"ip":"10.40.16.14","app":"3DSMax/1.0.0.0","args":"//depot/....3ds","startTime":"2017/12/07 15:00:21","endTime":"2017/12/07 15:00:23","uCpu":10,"sCpu":11,"diskIn":12,"diskOut":13,"ipcIn":14,"ipcOut":15,"maxRss":4088,"pageFaults":22,"lbrCompressDigests":1,"lbrCompressFileSizes":2,"lbrCompressModTimes":3,"lbrCompressCopies":4,"cmdError":false,"tables":[]}`), + cleanJSON(output[0])) } func TestLbrRegex(t *testing.T) { @@ -1176,6 +1215,6 @@ Perforce server info: output := parseLogLines(testInput) assert.Equal(t, 1, len(output)) // assert.Equal(t, "", output[0]) - assert.JSONEq(t, `{"processKey":"adb2b3c890b15d59f748c064e2c181b6","cmd":"user-changes","pid":5032,"lineNo":2,"user":"fred","workspace":"fred-Dinner-dev","computeLapse":60.9,"completedLapse":60.9,"ip":"10.1.2.212","app":"UnrealGameSync/v84","args":"-m1 -ssubmitted //fred-Dinner-dev/*.cs@\u003c=764311 //fred-Dinner-dev/Engine/....cs@\u003c=764311 //fred-Dinner-dev/Dinner/....cs@\u003c=764311","startTime":"2024/04/03 12:20:14","endTime":"2024/04/03 12:21:15","running":1,"uCpu":0,"sCpu":0,"diskIn":0,"diskOut":0,"ipcIn":0,"ipcOut":0,"maxRss":0,"pageFaults":0,"memMB":8,"memPeakMB":442,"rpcMsgsIn":0,"rpcMsgsOut":12,"rpcSizeIn":0,"rpcSizeOut":0,"rpcHimarkFwd":64836,"rpcHimarkRev":523588,"rpcSnd":0,"rpcRcv":0,"netFilesAdded":0,"netFilesUpdated":0,"netFilesDeleted":0,"netBytesAdded":0,"netBytesUpdated":0,"lbrRcsOpens":0,"lbrRcsCloses":0,"lbrRcsCheckins":0,"lbrRcsExists":0,"lbrRcsReads":0,"lbrRcsReadBytes":0,"lbrRcsWrites":0,"lbrRcsWriteBytes":0,"lbrRcsDigests":0,"lbrRcsFileSizes":0,"lbrRcsModTimes":0,"lbrRcsCopies":0,"lbrBinaryOpens":0,"lbrBinaryCloses":0,"lbrBinaryCheckins":0,"lbrBinaryExists":0,"lbrBinaryReads":0,"lbrBinaryReadBytes":0,"lbrBinaryWrites":0,"lbrBinaryWriteBytes":0,"lbrBinaryDigests":0,"lbrBinaryFileSizes":0,"lbrBinaryModTimes":0,"lbrBinaryCopies":0,"lbrCompressOpens":0,"lbrCompressCloses":0,"lbrCompressCheckins":0,"lbrCompressExists":0,"lbrCompressReads":0,"lbrCompressReadBytes":0,"lbrCompressWrites":0,"lbrCompressWriteBytes":0,"lbrCompressDigests":0,"lbrCompressFileSizes":0,"lbrCompressModTimes":0,"lbrCompressCopies":0,"lbrUncompressOpens":0,"lbrUncompressCloses":0,"lbrUncompressCheckins":0,"lbrUncompressExists":0,"lbrUncompressReads":0,"lbrUncompressReadBytes":0,"lbrUncompressWrites":0,"lbrUncompressWriteBytes":0,"lbrUncompressDigests":0,"lbrUncompressFileSizes":0,"lbrUncompressModTimes":0,"lbrUncompressCopies":0,"cmdError":false,"tables":[{"tableName":"change","pagesIn":35,"pagesOut":0,"pagesCached":10,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":12,"scanRows":12,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":21,"totalPeekWait":0,"totalPeekHeld":60953,"maxPeekWait":0,"maxPeekHeld":34390,"triggerLapse":0},{"tableName":"rev","pagesIn":1558725,"pagesOut":0,"pagesCached":96,"pagesSplitInternal":0,"pagesSplitLeaf":0,"readLocks":0,"writeLocks":0,"getRows":0,"posRows":56,"scanRows":22442266,"putRows":0,"delRows":0,"totalReadWait":0,"totalReadHeld":0,"totalWriteWait":0,"totalWriteHeld":0,"maxReadWait":0,"maxReadHeld":0,"maxWriteWait":0,"maxWriteHeld":0,"peekCount":21,"totalPeekWait":0,"totalPeekHeld":60953,"maxPeekWait":0,"maxPeekHeld":34390,"triggerLapse":0}]}`, - output[0]) + assert.JSONEq(t, cleanJSON(`{"processKey":"adb2b3c890b15d59f748c064e2c181b6","cmd":"user-changes","pid":5032,"lineNo":2,"user":"fred","workspace":"fred-Dinner-dev","computeLapse":60.9,"completedLapse":60.9,"ip":"10.1.2.212","app":"UnrealGameSync/v84","args":"-m1 -ssubmitted //fred-Dinner-dev/*.cs@\u003c=764311 //fred-Dinner-dev/Engine/....cs@\u003c=764311 //fred-Dinner-dev/Dinner/....cs@\u003c=764311","startTime":"2024/04/03 12:20:14","endTime":"2024/04/03 12:21:15","running":1,"memMB":8,"memPeakMB":442,"rpcMsgsOut":12,"rpcHimarkFwd":64836,"rpcHimarkRev":523588,"cmdError":false,"tables":[{"tableName":"change","pagesIn":35,"pagesCached":10,"posRows":12,"scanRows":12,"peekCount":21,"totalPeekHeld":60953,"maxPeekHeld":34390},{"tableName":"rev","pagesIn":1558725,"pagesCached":96,"posRows":56,"scanRows":22442266,"peekCount":21,"totalPeekHeld":60953,"maxPeekHeld":34390}]}`), + cleanJSON(output[0])) }