BENCHMARKS
(b *testing.B)
| 3147 | // ////// BENCHMARKS |
| 3148 | |
| 3149 | func BenchmarkDatabase(b *testing.B) { |
| 3150 | base.DisableTestLogging(b) |
| 3151 | |
| 3152 | for i := 0; i < b.N; i++ { |
| 3153 | ctx := base.TestCtx(b) |
| 3154 | bucket, _ := ConnectToBucket(ctx, base.BucketSpec{ |
| 3155 | Server: base.UnitTestUrl(), |
| 3156 | BucketName: fmt.Sprintf("b-%d", i)}, |
| 3157 | true) |
| 3158 | dbCtx, _ := NewDatabaseContext(ctx, "db", bucket, false, DatabaseContextOptions{}) |
| 3159 | db, _ := CreateDatabase(dbCtx) |
| 3160 | collection, ctx := GetSingleDatabaseCollectionWithUser(ctx, b, db) |
| 3161 | |
| 3162 | body := Body{"key1": "value1", "key2": 1234} |
| 3163 | _, _, _ = collection.Put(ctx, fmt.Sprintf("doc%d", i), body) |
| 3164 | |
| 3165 | db.Close(ctx) |
| 3166 | } |
| 3167 | } |
| 3168 | |
| 3169 | func BenchmarkPut(b *testing.B) { |
| 3170 | base.DisableTestLogging(b) |
nothing calls this directly
no test coverage detected