[GODRIVER-2184] Use testing.Short to skip longer tests Created: 14/Oct/21  Updated: 19/Oct/22  Resolved: 02/Jun/22

Status: Closed
Project: Go Driver
Component/s: Testing
Affects Version/s: None
Fix Version/s: 1.10.0

Type: Task Priority: Minor - P4
Reporter: Benji Rewis (Inactive) Assignee: Matt Dale
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: Improve Testing Suite
Quarter: FY23Q4

 Description   

It's tough to test basic changes quickly as a patch can take up to 30 minutes. We should mark longer-running tests with testing.Short so we can skip them with the -short flag. 



 Comments   
Comment by Matt Dale [ 02/Jun/22 ]

Can now run all unit tests without a MongoDB server running in under 60s with:

go test -short ./...

or

make test-short

Comment by Githook User [ 02/Jun/22 ]

Author:

{'name': 'Matt Dale', 'email': '9760375+matthewdale@users.noreply.github.com', 'username': 'matthewdale'}

Message: GODRIVER-2184 Skip all integration tests when the -short flag is included. (#973)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/bbcf420da319e88caea68d22bf63d69d2f2d1897

Comment by Matt Dale [ 21/Oct/21 ]

Consider making mtest.New() skip the current test if -short is enabled.

Most (all?) tests that call mtest.New() are integration tests and require a running MongoDB instance to work. In that case, calling go test -short ./... would run only the unit tests (we'd still have to manually skip some tests by checking for testing.Short(), but doing it in mtest.New() should cover a lot of cases).

Generated at Thu Feb 08 08:38:00 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.