Example #1
0
        public async Task CancelQueryOnPremTest()
        {
            TestServerType serverType = TestServerType.OnPrem;

            using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile())
                using (TestServiceDriverProvider testService = new TestServiceDriverProvider())
                {
                    await testService.ConnectForQuery(serverType, Scripts.DelayQuery, queryTempFile.FilePath, Common.PerfTestDatabaseName);

                    var queryParams = new ExecuteDocumentSelectionParams
                    {
                        OwnerUri       = queryTempFile.FilePath,
                        QuerySelection = null
                    };

                    var result = await testService.Driver.SendRequest(ExecuteDocumentSelectionRequest.Type, queryParams);

                    if (result != null)
                    {
                        TestTimer timer = new TestTimer()
                        {
                            PrintResult = true
                        };
                        await testService.ExecuteWithTimeout(timer, 100000, async() =>
                        {
                            var cancelQueryResult = await testService.CancelQuery(queryTempFile.FilePath);
                            return(true);
                        }, TimeSpan.FromMilliseconds(10));
                    }
                    else
                    {
                        Assert.True(false, "Failed to run the query");
                    }

                    await testService.Disconnect(queryTempFile.FilePath);
                }
        }