コード例 #1
0
ファイル: RetryPolicyTests.cs プロジェクト: liyuj/ignite-3
        public async Task TestRetryReadPolicyDoesNotRetryWriteOperations()
        {
            var cfg = new IgniteClientConfiguration
            {
                RetryPolicy = new RetryReadPolicy()
            };

            using var server = new FakeServer(reqId => reqId % 2 == 0);
            using var client = await server.ConnectClientAsync(cfg);

            var table = await client.Tables.GetTableAsync(FakeServer.ExistingTableName);

            Assert.ThrowsAsync <IgniteClientException>(async() => await table !.RecordBinaryView.UpsertAsync(null, new IgniteTuple()));
        }
コード例 #2
0
ファイル: RetryPolicyTests.cs プロジェクト: liyuj/ignite-3
        public async Task TestTableOperationWithoutTxIsRetried()
        {
            var cfg = new IgniteClientConfiguration
            {
                RetryPolicy = new TestRetryPolicy {
                    RetryLimit = 1
                }
            };

            using var server = new FakeServer(reqId => reqId % 2 == 0);
            using var client = await server.ConnectClientAsync(cfg);

            for (int i = 0; i < IterCount; i++)
            {
                var table = await client.Tables.GetTableAsync(FakeServer.ExistingTableName);

                await table !.RecordBinaryView.UpsertAsync(null, new IgniteTuple());
            }
        }
コード例 #3
0
ファイル: RetryPolicyTests.cs プロジェクト: liyuj/ignite-3
        public async Task TestTableOperationWithTxIsNotRetried()
        {
            var cfg = new IgniteClientConfiguration
            {
                RetryPolicy = new TestRetryPolicy()
            };

            using var server = new FakeServer(reqId => reqId % 2 == 0);
            using var client = await server.ConnectClientAsync(cfg);

            var tx = await client.Transactions.BeginAsync();

            var table = await client.Tables.GetTableAsync(FakeServer.ExistingTableName);

            var ex = Assert.ThrowsAsync <IgniteClientException>(async() => await table !.RecordBinaryView.UpsertAsync(tx, new IgniteTuple()));

            StringAssert.StartsWith("Socket is closed due to an error", ex !.Message);
        }