@@ -15,6 +15,7 @@ import (
1515 "os"
1616 "path"
1717 "reflect"
18+ "strings"
1819 "sync"
1920 "testing"
2021 "time"
@@ -157,14 +158,12 @@ type operationError struct {
157158 ErrorLabelsOmit []string `bson:"errorLabelsOmit"`
158159}
159160
160- const dataPath string = "../../testdata/"
161-
162161var directories = []string {
163- "transactions/legacy" ,
164- "convenient-transactions" ,
165- "retryable-reads/legacy" ,
166- "read-write-concern/operation" ,
167- "atlas-data-lake-testing" ,
162+ "../../testdata/ transactions/legacy" ,
163+ "../../testdata/ convenient-transactions" ,
164+ "../../testdata/ retryable-reads/legacy" ,
165+ "../../testdata/ read-write-concern/operation" ,
166+ "../../testdata/ atlas-data-lake-testing" ,
168167}
169168
170169var checkOutcomeOpts = options .Collection ().SetReadPreference (readpref .Primary ()).SetReadConcern (readconcern .Local ())
@@ -177,8 +176,10 @@ var specTestRegistry = func() *bson.Registry {
177176
178177func TestUnifiedSpecs (t * testing.T ) {
179178 for _ , specDir := range directories {
180- t .Run (specDir , func (t * testing.T ) {
181- for _ , fileName := range jsonFilesInDir (t , path .Join (dataPath , specDir )) {
179+ index := strings .Index (specDir , "testdata/" )
180+ dirTestName := specDir [index + len ("testdata/" ):]
181+ t .Run (dirTestName , func (t * testing.T ) {
182+ for _ , fileName := range jsonFilesInDir (t , specDir ) {
182183 t .Run (fileName , func (t * testing.T ) {
183184 runSpecTestFile (t , specDir , fileName )
184185 })
@@ -190,7 +191,8 @@ func TestUnifiedSpecs(t *testing.T) {
190191// specDir: name of directory for a spec in the data/ folder
191192// fileName: name of test file in specDir
192193func runSpecTestFile (t * testing.T , specDir , fileName string ) {
193- filePath := path .Join (dataPath , specDir , fileName )
194+ filePath := path .Join (specDir , fileName )
195+
194196 content , err := ioutil .ReadFile (filePath )
195197 assert .Nil (t , err , "unable to read spec test file %v: %v" , filePath , err )
196198
@@ -206,7 +208,7 @@ func runSpecTestFile(t *testing.T, specDir, fileName string) {
206208 mtOpts := mtest .NewOptions ().
207209 RunOn (testFile .RunOn ... ).
208210 CreateClient (false )
209- if specDir == "atlas-data-lake-testing" {
211+ if strings . Contains ( specDir , "atlas-data-lake-testing" ) {
210212 mtOpts .AtlasDataLake (true )
211213 }
212214 mt := mtest .New (t , mtOpts )
0 commit comments