added mongo-driver v2
Build Docker and Deploy / Run goext test-suite (push) Failing after 1m33s

This commit is contained in:
2026-04-21 18:41:32 +02:00
parent f62e7499ec
commit 26d542c9a2
33 changed files with 205 additions and 522 deletions
+16 -16
View File
@@ -3,12 +3,12 @@ package exerr
import (
"context"
"encoding/json"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"git.blackforestbytes.com/BlackForestBytes/goext/tst"
"testing"
"time"
"git.blackforestbytes.com/BlackForestBytes/goext/tst"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo"
)
func TestJSONMarshalErrorCategory(t *testing.T) {
@@ -57,7 +57,7 @@ func TestBSONMarshalErrorCategory(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 350*time.Millisecond)
defer cancel()
client, err := mongo.Connect(ctx)
client, err := mongo.Connect()
if err != nil {
t.Skip("Skip test - no local mongo found")
return
@@ -68,7 +68,7 @@ func TestBSONMarshalErrorCategory(t *testing.T) {
return
}
primimd := primitive.NewObjectID()
primimd := bson.NewObjectID()
_, err = client.Database("_test").Collection("goext-cicd").InsertOne(ctx, bson.M{"_id": primimd, "val": CatSystem})
tst.AssertNoErr(t, err)
@@ -76,8 +76,8 @@ func TestBSONMarshalErrorCategory(t *testing.T) {
cursor := client.Database("_test").Collection("goext-cicd").FindOne(ctx, bson.M{"_id": primimd, "val": bson.M{"$type": "string"}})
var c1 struct {
ID primitive.ObjectID `bson:"_id"`
Val ErrorCategory `bson:"val"`
ID bson.ObjectID `bson:"_id"`
Val ErrorCategory `bson:"val"`
}
err = cursor.Decode(&c1)
@@ -90,7 +90,7 @@ func TestBSONMarshalErrorSeverity(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 350*time.Millisecond)
defer cancel()
client, err := mongo.Connect(ctx)
client, err := mongo.Connect()
if err != nil {
t.Skip("Skip test - no local mongo found")
return
@@ -101,7 +101,7 @@ func TestBSONMarshalErrorSeverity(t *testing.T) {
return
}
primimd := primitive.NewObjectID()
primimd := bson.NewObjectID()
_, err = client.Database("_test").Collection("goext-cicd").InsertOne(ctx, bson.M{"_id": primimd, "val": SevErr})
tst.AssertNoErr(t, err)
@@ -109,8 +109,8 @@ func TestBSONMarshalErrorSeverity(t *testing.T) {
cursor := client.Database("_test").Collection("goext-cicd").FindOne(ctx, bson.M{"_id": primimd, "val": bson.M{"$type": "string"}})
var c1 struct {
ID primitive.ObjectID `bson:"_id"`
Val ErrorSeverity `bson:"val"`
ID bson.ObjectID `bson:"_id"`
Val ErrorSeverity `bson:"val"`
}
err = cursor.Decode(&c1)
@@ -123,7 +123,7 @@ func TestBSONMarshalErrorType(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 350*time.Millisecond)
defer cancel()
client, err := mongo.Connect(ctx)
client, err := mongo.Connect()
if err != nil {
t.Skip("Skip test - no local mongo found")
return
@@ -134,7 +134,7 @@ func TestBSONMarshalErrorType(t *testing.T) {
return
}
primimd := primitive.NewObjectID()
primimd := bson.NewObjectID()
_, err = client.Database("_test").Collection("goext-cicd").InsertOne(ctx, bson.M{"_id": primimd, "val": TypeNotImplemented})
tst.AssertNoErr(t, err)
@@ -142,8 +142,8 @@ func TestBSONMarshalErrorType(t *testing.T) {
cursor := client.Database("_test").Collection("goext-cicd").FindOne(ctx, bson.M{"_id": primimd, "val": bson.M{"$type": "string"}})
var c1 struct {
ID primitive.ObjectID `bson:"_id"`
Val ErrorType `bson:"val"`
ID bson.ObjectID `bson:"_id"`
Val ErrorType `bson:"val"`
}
err = cursor.Decode(&c1)