Skip to content

Commit

Permalink
PMM-11180 fix mongodb tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
BupycHuk committed Oct 16, 2024
1 parent c54769e commit 7157768
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
22 changes: 20 additions & 2 deletions agent/agents/mongodb/internal/profiler/profiler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ func testProfiler(t *testing.T, url string) {
Dsn: tests.GetTestMongoDBDSN(t),
Query: findBucket.Common.Example,
}
client := tests.OpenTestMongoDB(t, params.Dsn)

ex, err := actions.NewMongoDBExplainAction(id, 5*time.Second, params, os.TempDir())
require.NoError(t, err)
Expand All @@ -238,8 +239,25 @@ func testProfiler(t *testing.T, url string) {
"$eq": "value_00\ufffd",
},
},
"plannerVersion": map[string]interface{}{"$numberInt": "1"},
"rejectedPlans": []interface{}{},
"rejectedPlans": []interface{}{},
}
mongoDBVersion := tests.MongoDBVersion(t, client)

switch mongoDBVersion {
case "4.4":
want["plannerVersion"] = map[string]interface{}{"$numberInt": "1"}
case "5.0":
want["maxIndexedAndSolutionsReached"] = false
want["maxIndexedOrSolutionsReached"] = false
want["maxScansToExplodeReached"] = false
case "6.0":
want["maxIndexedAndSolutionsReached"] = false
want["maxIndexedOrSolutionsReached"] = false
want["maxScansToExplodeReached"] = false
case "7.0":
want["maxIndexedAndSolutionsReached"] = false
want["maxIndexedOrSolutionsReached"] = false
want["maxScansToExplodeReached"] = false
}

explainM := make(map[string]interface{})
Expand Down
1 change: 1 addition & 0 deletions agent/runner/actions/mongodb_explain_action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ func TestMongoDBExplain(t *testing.T) {
"winningPlan": map[string]interface{}{"stage": "EOF"},
}
mongoDBVersion := tests.MongoDBVersion(t, client)
fmt.Printf("MongoDB version: %s\n", mongoDBVersion)

Check failure on line 289 in agent/runner/actions/mongodb_explain_action_test.go

View workflow job for this annotation

GitHub Actions / Checks

use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)

switch mongoDBVersion {
case "4.4":
Expand Down

0 comments on commit 7157768

Please sign in to comment.