This commit is contained in:
Kamil Dziedzic
2017-10-15 04:40:34 +02:00
parent 8cf08fd882
commit fb86972f9a
3 changed files with 15 additions and 5 deletions

View File

@@ -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"
}
}

View File

@@ -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":

View File

@@ -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