示例#1
0
        public async Task RavenDB_14086()
        {
            using (var store = GetDocumentStore())
            {
                var indexes = new List <Task>();
                for (int i = 0; i < 100; i++)
                {
                    var index = new Index($"test{i}");
                    indexes.Add(index.ExecuteAsync(store));
                }

                await Task.WhenAll(indexes);

                var record = await store.Maintenance.Server.SendAsync(new GetDatabaseRecordOperation(store.Database));

                Assert.Equal(100, record.Indexes.Count);
            }
        }
示例#2
0
        public async Task CanResetEtl3()
        {
            using (var src = GetDocumentStore())
                using (var dest = GetDocumentStore())
                {
                    var configuration = new RavenEtlConfiguration()
                    {
                        ConnectionStringName = "test",
                        Name       = "myConfiguration",
                        Transforms = { new Transformation()
                                       {
                                           Name = "allUsers", Collections ={ "Users"                                      }
                                       } }
                    };

                    AddEtl(src, configuration, new RavenConnectionString {
                        Name = "test", TopologyDiscoveryUrls = dest.Urls, Database = dest.Database,
                    });

                    var t = Task.Run(async() =>
                    {
                        for (int i = 0; i < 100; i++)
                        {
                            await src.Maintenance.SendAsync(new ResetEtlOperation("myConfiguration", "allUsers"));
                            await Task.Delay(100);
                        }
                    });

                    var indexes = new List <Task>();
                    for (int i = 0; i < 100; i++)
                    {
                        var index = new Index($"test{i}");
                        indexes.Add(index.ExecuteAsync(src));
                    }

                    await Task.WhenAll(indexes);

                    await t;

                    var record = await src.Maintenance.Server.SendAsync(new GetDatabaseRecordOperation(src.Database));

                    Assert.Equal(100, record.Indexes.Count);
                }
        }