MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestMigrateMetadataInvalidSyncData

Function TestMigrateMetadataInvalidSyncData

db/import_test.go:1079–1102  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1077}
1078
1079func TestMigrateMetadataInvalidSyncData(t *testing.T) {
1080 base.SetUpTestLogging(t, base.LevelDebug, base.KeyCRUD, base.KeyImport, base.KeyMigrate)
1081 base.SkipImportTestsIfNotEnabled(t)
1082 bucket := base.GetTestBucket(t)
1083 defer bucket.Close(base.TestCtx(t))
1084
1085 db, ctx := setupTestDBWithOptionsAndImport(t, bucket, DatabaseContextOptions{})
1086 defer db.Close(ctx)
1087
1088 doc1ID := t.Name() + "_doc1"
1089 doc2ID := t.Name() + "_doc2"
1090
1091 collection, _ := GetSingleDatabaseCollectionWithUser(ctx, t, db)
1092
1093 // create a docs with invalid sync data
1094 _, err := collection.dataStore.Add(doc1ID, 0, []byte(`{"some": "data", "_sync": {}}`))
1095 require.NoError(t, err)
1096 _, err = collection.dataStore.Add(doc2ID, 0, []byte(`{"some": "data", "_sync": {"rev": "1-cd809becc169215072fd567eebd8b8de","sequence": 1,"recent_sequences": [1],"history": {},"cas": "","time_saved": "2017-11-29T12:46:13.456631-08:00"}}`))
1097 require.NoError(t, err)
1098
1099 base.RequireWaitForStat(t, func() int64 {
1100 return db.DbStats.SharedBucketImport().ImportErrorCount.Value()
1101 }, 2)
1102}
1103
1104func TestImportFeedNonJSONNewDoc(t *testing.T) {
1105 base.SetUpTestLogging(t, base.LevelDebug, base.KeyMigrate, base.KeyImport)

Callers

nothing calls this directly

Calls 12

SetUpTestLoggingFunction · 0.92
GetTestBucketFunction · 0.92
TestCtxFunction · 0.92
RequireWaitForStatFunction · 0.92
SharedBucketImportMethod · 0.80
CloseMethod · 0.65
NameMethod · 0.65
AddMethod · 0.45
ValueMethod · 0.45

Tested by

no test coverage detected