mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-07 21:09:14 +00:00
fix bugs
This commit is contained in:
@@ -109,7 +109,7 @@ func TestExplain(t *testing.T) {
|
||||
for _, v := range versions {
|
||||
// For versions < 3.4 parsing "getmore" is not supported and returns error
|
||||
if ok, _ := Constraint("< 3.4", v); ok {
|
||||
expectError["getmore_"+v] = "Cannot explain cmd: getMore"
|
||||
expectError["getmore_"+v] = "Explain failed due to unknown command: getmore"
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -224,9 +224,20 @@ func (self ExampleQuery) ExplainCmd() bson.D {
|
||||
case "getmore":
|
||||
if self.OriginatingCommand.Len() > 0 {
|
||||
cmd = self.OriginatingCommand
|
||||
for i := range cmd {
|
||||
// drop $db param as it is not supported in MongoDB 3.0
|
||||
if cmd[i].Name == "$db" {
|
||||
if len(cmd)-1 == i {
|
||||
cmd = cmd[:i]
|
||||
} else {
|
||||
cmd = append(cmd[:i], cmd[i+1:]...)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cmd = BsonD{
|
||||
{Name: "getMore", Value: ""},
|
||||
{Name: "getmore", Value: ""},
|
||||
}
|
||||
}
|
||||
case "command":
|
||||
|
@@ -413,8 +413,7 @@ func testAllOperationsTemplate(t *testing.T, data Data) {
|
||||
},
|
||||
}
|
||||
|
||||
ndocs := "165"
|
||||
expected := `Profiler is disabled for the "test" database but there are ` + ndocs + ` documents in the system.profile collection.
|
||||
expected := `Profiler is disabled for the "test" database but there are \s*[0-9]+ documents in the system.profile collection.
|
||||
Using those documents for the stats
|
||||
pt-mongodb-query-digest .+
|
||||
Host: ` + data.url + `
|
||||
@@ -425,7 +424,7 @@ Skipping profiled queries on these collections: \[system\.profile\]
|
||||
# Ratio [0-9\.]+ \(docs scanned/returned\)
|
||||
# Attribute pct total min max avg 95% stddev median
|
||||
# ================== === ======== ======== ======== ======== ======== ======= ========
|
||||
# Count \(docs\) ` + ndocs + `\s
|
||||
# Count \(docs\) (\s*[0-9]+)\s
|
||||
# Exec Time ms (\s*[0-9]+){8}\s
|
||||
# Docs Scanned (\s*[0-9\.]+){8}\s
|
||||
# Docs Returned (\s*[0-9\.]+){8}\s
|
||||
|
Reference in New Issue
Block a user