Skip to content

Commit

Permalink
skip mongodb test if no db is available
Browse files Browse the repository at this point in the history
  • Loading branch information
ynHuber committed Nov 22, 2024
1 parent 7d8d88b commit 2f61b06
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions segments/output/mongodb/mongo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ func TestSegment_Mongodb_passthrough(t *testing.T) {
// t.Error("Segment Mongodb is not passing through flows.")
// }
segment := Mongodb{}.New(map[string]string{"mongodb_uri": "mongodb://localhost:27017/", "database": "testing"})
if segment == nil {
t.Skip()
}

in, out := make(chan *pb.EnrichedFlow), make(chan *pb.EnrichedFlow)
segment.Rewire(in, out)
Expand All @@ -43,6 +46,9 @@ func BenchmarkMongodb_1000(b *testing.B) {
os.Stdout, _ = os.Open(os.DevNull)

segment := Mongodb{}.New(map[string]string{"mongodb_uri": "mongodb://localhost:27017/", "database": "testing"})
if segment == nil {
b.Skip()
}

in, out := make(chan *pb.EnrichedFlow), make(chan *pb.EnrichedFlow)
segment.Rewire(in, out)
Expand All @@ -64,6 +70,9 @@ func BenchmarkMongodb_10000(b *testing.B) {
os.Stdout, _ = os.Open(os.DevNull)

segment := Mongodb{}.New(map[string]string{"mongodb_uri": "mongodb://localhost:27017/", "database": "testing", "batchsize": "10000"})
if segment == nil {
b.Skip()
}

in, out := make(chan *pb.EnrichedFlow), make(chan *pb.EnrichedFlow)
segment.Rewire(in, out)
Expand All @@ -85,6 +94,9 @@ func BenchmarkMongodb_100000(b *testing.B) {
os.Stdout, _ = os.Open(os.DevNull)

segment := Mongodb{}.New(map[string]string{"mongodb_uri": "mongodb://localhost:27017/", "database": "testing", "batchsize": "100000"})
if segment == nil {
b.Skip()
}

in, out := make(chan *pb.EnrichedFlow), make(chan *pb.EnrichedFlow)
segment.Rewire(in, out)
Expand All @@ -106,6 +118,9 @@ func BenchmarkMongodb_100000_with_storage_limit(b *testing.B) {
os.Stdout, _ = os.Open(os.DevNull)

segment := Mongodb{}.New(map[string]string{"mongodb_uri": "mongodb://localhost:27017/", "database": "testing", "batchsize": "100000", "max_disk_usage": "100 MB"})
if segment == nil {
b.Skip()
}

in, out := make(chan *pb.EnrichedFlow), make(chan *pb.EnrichedFlow)
segment.Rewire(in, out)
Expand Down

0 comments on commit 2f61b06

Please sign in to comment.