...

Source file src/go.mongodb.org/mongo-driver/mongo/description/selector_spec_test.go

Documentation: go.mongodb.org/mongo-driver/mongo/description

     1  // Copyright (C) MongoDB, Inc. 2017-present.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License"); you may
     4  // not use this file except in compliance with the License. You may obtain
     5  // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
     6  
     7  package description
     8  
     9  import (
    10  	"path"
    11  	"testing"
    12  
    13  	"go.mongodb.org/mongo-driver/internal/spectest"
    14  )
    15  
    16  const selectorTestsDir = "../../testdata/server-selection/server_selection"
    17  
    18  // Test case for all SDAM spec tests.
    19  func TestServerSelectionSpec(t *testing.T) {
    20  	for _, topology := range [...]string{
    21  		"ReplicaSetNoPrimary",
    22  		"ReplicaSetWithPrimary",
    23  		"Sharded",
    24  		"Single",
    25  		"Unknown",
    26  		"LoadBalanced",
    27  	} {
    28  		for _, subdir := range [...]string{"read", "write"} {
    29  			subdirPath := path.Join(topology, subdir)
    30  
    31  			for _, file := range spectest.FindJSONFilesInDir(t,
    32  				path.Join(selectorTestsDir, subdirPath)) {
    33  
    34  				runTest(t, selectorTestsDir, subdirPath, file)
    35  			}
    36  		}
    37  	}
    38  }
    39  

View as plain text