Package: golang-mongodb-mongo-driver
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu kinetic ubuntu-patch

Dear Maintainer,

There was already a patch in this package to skip tests that require
a running mongodb instance. The latest upstream release added more
tests with this requirement, so I added logic to skip them to the
already existing patch

In Ubuntu, the attached patch was applied to achieve the following:

  * Resolve FTBFS by Skiping more tests that require a running mongodb instance


Thanks for considering the patch.


-- System Information:
Debian Release: bookworm/sid
  APT prefers kinetic
  APT policy: (500, 'kinetic')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.15.0-27-generic (SMP w/32 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru 
golang-mongodb-mongo-driver-1.8.4+ds1/debian/patches/Do-not-require-running-mongodb.patch
 
golang-mongodb-mongo-driver-1.8.4+ds1/debian/patches/Do-not-require-running-mongodb.patch
--- 
golang-mongodb-mongo-driver-1.8.4+ds1/debian/patches/Do-not-require-running-mongodb.patch
   2021-12-13 15:22:56.000000000 -0600
+++ 
golang-mongodb-mongo-driver-1.8.4+ds1/debian/patches/Do-not-require-running-mongodb.patch
   2022-06-30 13:14:25.000000000 -0500
@@ -10,9 +10,11 @@
  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 (
+Index: 
golang-mongodb-mongo-driver-1.8.4+ds1/examples/documentation_examples/examples_test.go
+===================================================================
+--- 
golang-mongodb-mongo-driver-1.8.4+ds1.orig/examples/documentation_examples/examples_test.go
++++ 
golang-mongodb-mongo-driver-1.8.4+ds1/examples/documentation_examples/examples_test.go
+@@ -27,6 +27,10 @@
  )
  
  func TestDocumentationExamples(t *testing.T) {
@@ -23,7 +25,7 @@
        ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
        defer cancel()
  
-@@ -63,6 +67,10 @@ func TestDocumentationExamples(t *testin
+@@ -63,6 +67,10 @@
  }
  
  func TestAggregationExamples(t *testing.T) {
@@ -34,7 +36,7 @@
        ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
        defer cancel()
  
-@@ -81,6 +89,10 @@ func TestAggregationExamples(t *testing.
+@@ -81,6 +89,10 @@
  }
  
  func TestTransactionExamples(t *testing.T) {
@@ -45,7 +47,7 @@
        ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
        defer cancel()
        topo := createTopology(t)
-@@ -97,6 +109,10 @@ func TestTransactionExamples(t *testing.
+@@ -97,6 +109,10 @@
  }
  
  func TestChangeStreamExamples(t *testing.T) {
@@ -56,7 +58,7 @@
        ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
        defer cancel()
        topo := createTopology(t)
-@@ -113,6 +129,10 @@ func TestChangeStreamExamples(t *testing
+@@ -113,6 +129,10 @@
  }
  
  func TestCausalConsistencyExamples(t *testing.T) {
@@ -67,9 +69,11 @@
        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
+Index: golang-mongodb-mongo-driver-1.8.4+ds1/mongo/client_options_test.go
+===================================================================
+--- golang-mongodb-mongo-driver-1.8.4+ds1.orig/mongo/client_options_test.go
++++ golang-mongodb-mongo-driver-1.8.4+ds1/mongo/client_options_test.go
+@@ -9,6 +9,7 @@
  import (
        "context"
        "net"
@@ -77,7 +81,7 @@
        "sync/atomic"
        "testing"
  
-@@ -19,6 +20,10 @@ import (
+@@ -19,6 +20,10 @@
  )
  
  func TestClientOptions_CustomDialer(t *testing.T) {
@@ -88,9 +92,11 @@
        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 (
+Index: golang-mongodb-mongo-driver-1.8.4+ds1/mongo/client_test.go
+===================================================================
+--- golang-mongodb-mongo-driver-1.8.4+ds1.orig/mongo/client_test.go
++++ golang-mongodb-mongo-driver-1.8.4+ds1/mongo/client_test.go
+@@ -10,6 +10,7 @@
        "context"
        "errors"
        "math"
@@ -98,7 +104,7 @@
        "testing"
        "time"
  
-@@ -264,6 +265,10 @@ func TestClient(t *testing.T) {
+@@ -264,6 +265,10 @@
                })
        })
        t.Run("endSessions", func(t *testing.T) {
@@ -109,9 +115,11 @@
                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
+Index: golang-mongodb-mongo-driver-1.8.4+ds1/mongo/gridfs/gridfs_test.go
+===================================================================
+--- golang-mongodb-mongo-driver-1.8.4+ds1.orig/mongo/gridfs/gridfs_test.go
++++ golang-mongodb-mongo-driver-1.8.4+ds1/mongo/gridfs/gridfs_test.go
+@@ -8,6 +8,7 @@
  
  import (
        "context"
@@ -119,7 +127,7 @@
        "testing"
  
        "go.mongodb.org/mongo-driver/event"
-@@ -24,6 +25,10 @@ var (
+@@ -24,6 +25,10 @@
  )
  
  func TestGridFS(t *testing.T) {
@@ -130,9 +138,11 @@
        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 (
+Index: golang-mongodb-mongo-driver-1.8.4+ds1/mongo/with_transactions_test.go
+===================================================================
+--- golang-mongodb-mongo-driver-1.8.4+ds1.orig/mongo/with_transactions_test.go
++++ golang-mongodb-mongo-driver-1.8.4+ds1/mongo/with_transactions_test.go
+@@ -10,6 +10,7 @@
        "context"
        "errors"
        "math"
@@ -140,7 +150,7 @@
        "strconv"
        "strings"
        "testing"
-@@ -45,6 +46,10 @@ func (we wrappedError) Unwrap() error {
+@@ -45,6 +46,10 @@
  }
  
  func TestConvenientTransactions(t *testing.T) {
@@ -151,3 +161,101 @@
        client := setupConvenientTransactions(t)
        db := client.Database("TestConvenientTransactions")
        dbAdmin := client.Database("admin")
+Index: 
golang-mongodb-mongo-driver-1.8.4+ds1/mongo/options/clientoptions_test.go
+===================================================================
+--- 
golang-mongodb-mongo-driver-1.8.4+ds1.orig/mongo/options/clientoptions_test.go
++++ golang-mongodb-mongo-driver-1.8.4+ds1/mongo/options/clientoptions_test.go
+@@ -188,6 +188,9 @@
+               })
+       })
+       t.Run("ApplyURI", func(t *testing.T) {
++              if os.Getenv("TEST_MONGODB_SERVER") == "" {
++                      t.Skip()
++              }
+               baseClient := func() *ClientOptions {
+                       return Client().SetHosts([]string{"localhost"})
+               }
+Index: 
golang-mongodb-mongo-driver-1.8.4+ds1/x/mongo/driver/connstring/connstring_spec_test.go
+===================================================================
+--- 
golang-mongodb-mongo-driver-1.8.4+ds1.orig/x/mongo/driver/connstring/connstring_spec_test.go
++++ 
golang-mongodb-mongo-driver-1.8.4+ds1/x/mongo/driver/connstring/connstring_spec_test.go
+@@ -9,6 +9,7 @@
+ import (
+       "encoding/json"
+       "io/ioutil"
++      "os"
+       "path"
+       "strings"
+       "testing"
+@@ -173,6 +174,9 @@
+ }
+ 
+ func TestURIOptionsSpec(t *testing.T) {
++      if os.Getenv("TEST_MONGODB_SERVER") == "" {
++              t.Skip()
++      }
+       for _, file := range testhelpers.FindJSONFilesInDir(t, 
urioptionsTestDir) {
+               runTestsInFile(t, urioptionsTestDir, file, true)
+       }
+Index: 
golang-mongodb-mongo-driver-1.8.4+ds1/x/mongo/driver/topology/polling_srv_records_test.go
+===================================================================
+--- 
golang-mongodb-mongo-driver-1.8.4+ds1.orig/x/mongo/driver/topology/polling_srv_records_test.go
++++ 
golang-mongodb-mongo-driver-1.8.4+ds1/x/mongo/driver/topology/polling_srv_records_test.go
+@@ -9,6 +9,7 @@
+ import (
+       "context"
+       "net"
++      "os"
+       "sort"
+       "strings"
+       "sync/atomic"
+@@ -125,6 +126,9 @@
+ }
+ 
+ func TestPollingSRVRecordsSpec(t *testing.T) {
++      if os.Getenv("TEST_MONGODB_SERVER") == "" {
++              t.Skip()
++      }
+       if testing.Short() {
+               t.Skip("skipping integration test in short mode")
+       }
+@@ -159,6 +163,9 @@
+ }
+ 
+ func TestPollSRVRecords(t *testing.T) {
++      if os.Getenv("TEST_MONGODB_SERVER") == "" {
++              t.Skip()
++      }
+       if testing.Short() {
+               t.Skip("skipping integration test in short mode")
+       }
+@@ -260,6 +267,9 @@
+ }
+ 
+ func TestPollingSRVRecordsLoadBalanced(t *testing.T) {
++      if os.Getenv("TEST_MONGODB_SERVER") == "" {
++              t.Skip()
++      }
+       createLBTopology := func(t *testing.T, uri string) *Topology {
+               t.Helper()
+ 
+@@ -309,6 +319,9 @@
+ }
+ 
+ func TestPollSRVRecordsMaxHosts(t *testing.T) {
++      if os.Getenv("TEST_MONGODB_SERVER") == "" {
++              t.Skip()
++      }
+       if testing.Short() {
+               t.Skip("skipping integration test in short mode")
+       }
+@@ -387,6 +400,9 @@
+ }
+ 
+ func TestPollSRVRecordsServiceName(t *testing.T) {
++      if os.Getenv("TEST_MONGODB_SERVER") == "" {
++              t.Skip()
++      }
+       if testing.Short() {
+               t.Skip("skipping integration test in short mode")
+       }

Reply via email to