File: Do-not-require-running-mongodb.patch

package info (click to toggle)
golang-mongodb-mongo-driver 1.8.1%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 18,500 kB
  • sloc: perl: 533; ansic: 491; python: 432; makefile: 187; sh: 72
file content (153 lines) | stat: -rw-r--r-- 3,798 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
Author: Guillem Jover <gjover@sipwise.com>
Forwarded: no
Description: Do not require a running MongoDB server to run the test suite.

---
 examples/documentation_examples/examples_test.go |   20 ++++++++++++++++++++
 mongo/client_options_test.go                     |    5 +++++
 mongo/client_test.go                             |    5 +++++
 mongo/gridfs/gridfs_test.go                      |    5 +++++
 mongo/with_transactions_test.go                  |    5 +++++
 5 files changed, 40 insertions(+)

--- a/examples/documentation_examples/examples_test.go
+++ b/examples/documentation_examples/examples_test.go
@@ -27,6 +27,10 @@ import (
 )
 
 func TestDocumentationExamples(t *testing.T) {
+	if os.Getenv("TEST_MONGODB_SERVER") == "" {
+		t.Skip()
+	}
+
 	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
 	defer cancel()
 
@@ -63,6 +67,10 @@ func TestDocumentationExamples(t *testin
 }
 
 func TestAggregationExamples(t *testing.T) {
+	if os.Getenv("TEST_MONGODB_SERVER") == "" {
+		t.Skip()
+	}
+
 	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
 	defer cancel()
 
@@ -81,6 +89,10 @@ func TestAggregationExamples(t *testing.
 }
 
 func TestTransactionExamples(t *testing.T) {
+	if os.Getenv("TEST_MONGODB_SERVER") == "" {
+		t.Skip()
+	}
+
 	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
 	defer cancel()
 	topo := createTopology(t)
@@ -97,6 +109,10 @@ func TestTransactionExamples(t *testing.
 }
 
 func TestChangeStreamExamples(t *testing.T) {
+	if os.Getenv("TEST_MONGODB_SERVER") == "" {
+		t.Skip()
+	}
+
 	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
 	defer cancel()
 	topo := createTopology(t)
@@ -113,6 +129,10 @@ func TestChangeStreamExamples(t *testing
 }
 
 func TestCausalConsistencyExamples(t *testing.T) {
+	if os.Getenv("TEST_MONGODB_SERVER") == "" {
+		t.Skip()
+	}
+
 	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
 	defer cancel()
 	cs := testutil.ConnString(t)
--- a/mongo/client_options_test.go
+++ b/mongo/client_options_test.go
@@ -9,6 +9,7 @@ package mongo
 import (
 	"context"
 	"net"
+	"os"
 	"sync/atomic"
 	"testing"
 
@@ -19,6 +20,10 @@ import (
 )
 
 func TestClientOptions_CustomDialer(t *testing.T) {
+	if os.Getenv("TEST_MONGODB_SERVER") == "" {
+		t.Skip()
+	}
+
 	td := &testDialer{d: &net.Dialer{}}
 	cs := testutil.ConnString(t)
 	opts := options.Client().ApplyURI(cs.String()).SetDialer(td)
--- a/mongo/client_test.go
+++ b/mongo/client_test.go
@@ -10,6 +10,7 @@ import (
 	"context"
 	"errors"
 	"math"
+	"os"
 	"testing"
 	"time"
 
@@ -264,6 +265,10 @@ func TestClient(t *testing.T) {
 		})
 	})
 	t.Run("endSessions", func(t *testing.T) {
+		if os.Getenv("TEST_MONGODB_SERVER") == "" {
+			t.Skip()
+		}
+
 		cs := testutil.ConnString(t)
 		originalBatchSize := endSessionsBatchSize
 		endSessionsBatchSize = 2
--- a/mongo/gridfs/gridfs_test.go
+++ b/mongo/gridfs/gridfs_test.go
@@ -8,6 +8,7 @@ package gridfs
 
 import (
 	"context"
+	"os"
 	"testing"
 
 	"go.mongodb.org/mongo-driver/event"
@@ -24,6 +25,10 @@ var (
 )
 
 func TestGridFS(t *testing.T) {
+	if os.Getenv("TEST_MONGODB_SERVER") == "" {
+		t.Skip()
+	}
+
 	cs := testutil.ConnString(t)
 	poolMonitor := &event.PoolMonitor{
 		Event: func(evt *event.PoolEvent) {
--- a/mongo/with_transactions_test.go
+++ b/mongo/with_transactions_test.go
@@ -10,6 +10,7 @@ import (
 	"context"
 	"errors"
 	"math"
+	"os"
 	"strconv"
 	"strings"
 	"testing"
@@ -45,6 +46,10 @@ func (we wrappedError) Unwrap() error {
 }
 
 func TestConvenientTransactions(t *testing.T) {
+	if os.Getenv("TEST_MONGODB_SERVER") == "" {
+		t.Skip()
+	}
+
 	client := setupConvenientTransactions(t)
 	db := client.Database("TestConvenientTransactions")
 	dbAdmin := client.Database("admin")