Skip to content

Conversation

matthewdale
Copy link
Collaborator

Summary

  • Skip tests that call integtest.ConnString if running with -short.
  • Skip the TestServerHeartbeatTimeout test if running with -short because it's an integration test.

Background & Motivation

This should also fix the "Docker Runner Test" task.

@matthewdale matthewdale requested a review from a team as a code owner June 27, 2025 01:28
@matthewdale matthewdale requested a review from qingyang-hu June 27, 2025 01:28
@mongodb-drivers-pr-bot mongodb-drivers-pr-bot bot added the review-priority-low Low Priority PR for Review: within 3 business days label Jun 27, 2025
@mongodb-drivers-pr-bot
Copy link
Contributor

API Change Report

No changes found!

// ConnString gets the globally configured connection string.
func ConnString(t *testing.T) *connstring.ConnString {
if testing.Short() {
t.Skip("skipping integration test in short mode")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little strange to skip the tests from a helper function. Is it possible to skip from TestXXX()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal is to skip any tests that seem to be integration tests when using the -short test flag. We do something similar in mtest.New, which prevents us from having to add the if testing.Short() check in all the tests that use mtest.

We could add the if testing.Short() check to all tests individually, but that has been error-prone. Ideally all integration tests would use mtest, but tests in the mongo package can't import mtest, so integration tests are stuck using integtest.ConnString.

@matthewdale matthewdale merged commit ecd374a into mongodb:master Jun 27, 2025
29 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-priority-low Low Priority PR for Review: within 3 business days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants