-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
limit # collections to 2022 when error marshaling
- Loading branch information
Showing
4 changed files
with
60 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2019 Kuei-chun Chen. All rights reserved. | ||
|
||
package mdb | ||
|
||
import ( | ||
"log" | ||
"os" | ||
"testing" | ||
|
||
"go.mongodb.org/mongo-driver/x/mongo/driver/connstring" | ||
) | ||
|
||
func TestOutputBSON(t *testing.T) { | ||
uri := "mongodb://admin:secret@localhost:30309/" | ||
if os.Getenv("DATABASE_URL") != "" { | ||
uri = os.Getenv("DATABASE_URL") | ||
} | ||
var connString connstring.ConnString | ||
connString, err := ParseURI(uri) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
client, err := NewMongoClient(uri) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
stats := NewClusterStats("simagix/keyhole test") | ||
if err = stats.GetClusterStats(client, connString); err != nil { | ||
log.Fatalf("error GetClusterStats: %v", err) | ||
} | ||
|
||
// test bson.Marshal() overflow | ||
// for index := range stats.Databases { | ||
// for i := 0; i < 12; i++ { | ||
// colls := stats.Databases[index].Collections | ||
// stats.Databases[index].Collections = append(stats.Databases[index].Collections, colls...) | ||
// } | ||
// } | ||
|
||
if _, _, err = stats.OutputBSON(); err != nil { | ||
log.Fatalf("failed to output bson file\n%v", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.2.6 | ||
1.2.7 |