Commit Graph

129 Commits

Author SHA1 Message Date
Anthony Dresser
d950b751d8 Coveralls + AppVeyor + Travis CI (#171)
* added build files

* changed build script

* revert dotnet version to older one

* added osx building

* added appveyor build

* added ruby upload code coverage

* added gulp cli to downloads

* added gulp util to deps

* added through2 to deps

* added cask install for dotnet

* added coveralls gem install to appveyor

* fixed ruby script

* change upload to be gulp

* updated call

* added test for nin

* testing

* testing

* testing

* added coveralls nuget

* echoed path

* added code coverage badge

* updated cmd

* fixed syntax error

* added dotnet to path

* added manual call to dotnet

* iterate

* change directory

* commit

* added start to dotnet core version

* changed appveyor

* updated dotnet versions

* updated readme

* removed unnec de

* customize for microsoft

* specified encrypted key in appveyor

* updated readme; added newlines

* added branches to ymls

* updated ymls
2016-12-13 11:30:30 -08:00
Karl Burtram
df9e207e5f Bump SMO to 140.1.12 to pickup Azure DB fixes (#183) 2016-12-12 22:55:26 -08:00
Connor Quagliana
40c1434745 Fixed null ref exception in GetSignatureHelp (#175)
- Fixed a few places where ScriptParseInfo was being used before it was verified to be non-null
- Added 1 basic test for GetSignatureHelp scenario
2016-12-09 15:18:08 -08:00
Benjamin Russell
431dfa4156 Adding Milliseconds to DateTime fields (#173)
This is a slightly larger change than anticipated due the difference between `DATETIME`, `DATETIME2`, and `DateTime`. The `DATETIME` type always uses 3 decimal points of a second, while the `DATETIME2` type has 7 (although since `DATETIME2(7)` is default in SSMS suggesting that it is a variable precision type). Regardless of the db type, the engine returns `DateTime` C# type. The db types are only made visible via the column info, via the numeric precision and numeric scale. My findings were as such:
`DATETIME `: Precision = 23, Scale = 3
`DATETIME2`: Precision = 255, Scale = 7

The scale corresponds neatly with the number of second decimal points to show. The buffer file writer was modified to store both the scale and the number of ticks. Then the buffer file reader was modified to read in the precision and the number of ticks and generate the ToString version of the DateTime to add "f" as many times as there is scale, which corresponds to milliseconds.

* Code for writing milliseconds of datetime/datetime2 columns

* Adding unit tests

* Fixing potential bug with datetime2(0)
2016-12-09 12:46:17 -08:00
Leila Lali
0b295e78c2 adding a new event for when definition is requested (#167)
* sending telemetry events for intellisense usage
2016-12-08 14:05:42 -08:00
Benjamin Russell
54f30887cc Batch Start Notification (#169)
This change is part of the progressive results code. It will submit a notification from the service layer to indicate when execution of a batch has completed. This notification will contain the selection for batch, execution start time, and its ID. This will enable the extension to produce a header for the batch before the batch completes, in order to make it more clear to the user that execution is going on.

* Adding new event for batch start

* Unit tests

* Fixing comments as per @kevcunnane
2016-12-08 11:23:08 -08:00
Sharon Ravindran
ab97948005 Fix/peek def mac (#170)
* Fix Integrated auth error and Uri for *nix/Mac

* Format code

* Add Logging and unit tests

* Modify tests for Windows:

* Workaround missing default schema on *nix and Mac

* Add unit tests

* Correct comments

* Change loop length

* Fix Log message
2016-12-07 16:52:35 -08:00
Leila Lali
379c6170b3 Intellisense for when the text starts with bracket (#164)
* Intellisense for when the text starts with bracket
2016-12-06 10:09:50 -08:00
Sharon Ravindran
82a7a01304 Peek definition support for tables, views and stored procedures (#160)
* Add support for peek/go to definition
Add unit tests for definition

Microsoft/vscode-mssql#253 and Microsoft/vscode-mssql#268

* Format Strings

* Add integration tests

* Refactor variable names

* Remove test file

* Remove LIVE_CONNECTION definition

* Change method name

* Write files to a separate directory

* Refactor GetDefinition

* Remove unnecessary whitespace and modify variable name

* Check intellisense settings

* Refactor code to be scalable and modify tests

* Refactor to facilitate CodeGen

* Reorder methods

* Modify method to strip bracket syntax

* Add one_second constant

* Add comments

* Modify null check

* Modify GetSchema code to account for spaces

* Alter variable names and modify null checks

* Remove timeout callback and refactor null check

* remove LIVE_CONNECTION_TEST definition
2016-12-02 12:16:21 -08:00
Benjamin Russell
7de742bfab Fixing race condition in unit test (#161) 2016-11-23 13:34:48 -08:00
Benjamin Russell
d9efb95386 Progressive Results Part 2: Result Completion Event (#134)
The main change in this pull request is to add a new event that will be fired upon completion of a resultset but before the completion of a batch. This event will only fire if a resultset is available and generated.

Changes:
* ConnectionService - Slight changes to enable mocking, cleanup 
* Batch - Moving summary generation into ResultSet class, adding generation of ordinals for resultset and locking of result set list (which needs further refinement, but would be outside scope of this change)
* Adding new event and associated parameters for completion of a resultset. Params return the resultset summary
* Adding logic for assigning the event a handler in the query execution service
* Adding unit tests for testing the new event /making sure the existing tests work
* Refactoring some private properties into member variables

* Refactor to remove SectionData class in favor of BufferRange

* Adding callback for batch completion that will let the extension know that a batch has completed execution

* Refactoring to make progressive results work as per async query execution

* Allowing retrieval of batch results while query is in progress

* reverting global.json, whoops

* Adding a few missing comments, and fixing a couple code style bugs

* Using SelectionData everywhere again

* One more missing comment

* Adding new notification type for result set completion

* Plumbing event for result set completion

* Unit tests for result set events

This includes a fairly substantial change to create a mock of the
ConnectionService and to create separate memorystream storage arrays. It
preserves more correct behavior with a integration test, fixes an issue
where the test db reader will return n-1 rows because the Reliable
Connection Helper steals a record.

* Adding locking to ResultSets for thread safety

* Adding/fixing unit tests

* Adding batch ID to result set summary
2016-11-22 17:37:27 -08:00
Benjamin Russell
0841ad7cf4 Removing the FileStreamWrapper as it is unecessary (#156) 2016-11-22 17:21:41 -08:00
Mitchell Sternke
2e3bd3ae27 Feature/more tests (#154)
* First batch of new tests for increasing code coverage

* Fix for merge

* Added comments to tests
2016-11-22 09:55:15 -08:00
Benjamin Russell
db1e4ae351 Fix Code Coverage (#151)
This is another large code review. I want to make a few more changes, but since these changes will stand on their own, I'll hold back on making this change set any larger than it already is.
Changes in this request:
To address Microsoft/vscode-mssql#326, instead of doing taskkill on the service layer when WaitForExit is executed, we now make an educated guess at which service layer was spawned when the test starts and do a Process.Kill on it when we shut down the test.
All the perf tests have been moved into a new project. This was done to keep them easily separated from code coverage test runs. At the same time the perf tests were separated into separate classes for logical categorization. This process will likely be repeated on the stress tests. The tests can still easily be ran from Visual Studio Test Explorer
To address Microsoft/vscode-mssql#349, a new SelfCleaningFile class was created to allow for easy cleanup of temporary files generated for integration tests via using blocks.
Due to some of the refactoring done while moving the perf tests to a new project, the TestBase class had to be switched to more of a helper class style. As such, all tests that use inherit from TestBase now create a TestBase object on start via a using block. This also simplifies the cleanup at the end of the test.

* Solution for hanging code coverage runs

Code coverage runs would hang in certain scenarios if a test failed before
the service process could be spawned. The taskkill command would fail to
find the service process. The test would then wait for opencover to exit,
but it would not since the service process it had spawned would still be
running, causing the test run to hang indefinitely.

Solution was to capture the service process after it launched and
explicitly kill it when shutting down the test driver.

* Setting the test name in the propery in the class and removign the parameter from each method

* New project for perf tests

* Reworking integration tests to cleanup temp files

* Changes as per @llali review comments

* Adding copyright notices
* Renaming TestBase => TestHelper
* Renaming SelfCleaningFile => SelfCleaningTempFile
* Removing code that sets TestName property

* Fixing compilation error due to removed code
2016-11-18 17:46:56 -08:00
Mitchell Sternke
5a5f197276 Removed unneeded broken test (#150) 2016-11-15 17:57:03 -08:00
Benjamin Russell
ec94d986a8 Unit Test Cleanup (#141)
This is a fairly large set of changes to the unit tests that help isolate the effectiveness of the unit tests.

* Unit tests for query execution have been split into separate files for different classes.
* Unit tests have been added for the ResultSet class which previously did not have tests
* The InMemoryStreamWrapper has been improved to share memory, creating a simulated filesystem
* Creating a mock ConnectionService to decrease noisy exceptions and prevent "row stealing". Unfortunately this lowers code coverage. However, since the tests that touched the connection service were not really testing it, this helps keep us honest. But it will require adding more unit tests for connection service.
* Standardizing the await mechanism for query execution
* Cleaning up the mechanism for getting WorkspaceService mocks and mock FileStreamFactories

* Refactor the query execution tests into their own files

* Removing tests from ExecuteTests.cs that were moved to separate files

* Adding tests for ResultSet class

* Adding test for the FOR XML/JSON component of the resultset class

* Setting up shared storage between file stream readers/writers

* Standardizing on Workspace mocking, awaiting execution completion

* Adding comment for ResultSet class
2016-11-10 11:42:31 -08:00
Benjamin Russell
9ff9a02932 Fixing derived exception issue in workspace test 2016-11-10 11:09:35 -08:00
Benjamin Russell
ffe17e85fc Fixing bad data issue w/closing/opening untitled doc (#142)
* Adding useful unit tests for this functionality
* Adding callback functionality for when a file is closed

* Fixing bad data issue w/closing/opening untitled doc

* Adding useful unit tests for this functionality
* Adding callback functionality for when a file is closed

* Moving from public to internal
2016-11-09 15:36:42 -08:00
llali
3d8eefa685 Fixed a failed test 2016-11-07 13:19:28 -08:00
Karl Burtram
54b5488ce2 Bump SMO to 140.1.11 (#137)
Version bump only
2016-11-05 16:56:37 -07:00
Benjamin Russell
d5fbebc287 Progressive Results Part 1: Batch Completion Notification (#95)
The main feature of this pull request is a new callback that's added to the query class that is called when a batch has completed execution and retrieval of results. This callback will send an event to the extension with the batch summary information. After that, the extension can submit subset requests for the resultsets of the batch.
Other smaller changes in this pull request:
Refactor to assign a batch a id when its created instead of when returning the list of batch summaries
Passing the SelectionData around instead of extracting the values for it
Moving creation of BatchSummary into the Batch class
Retrieval of results is now permitted even if the entire query has not completed, as long as the batch requested has completed.
Also note, this does not break the protocol. It adds a new event that a queryRunner can listen to, but it doesn't require it to be listened to.

* Refactor to remove SectionData class in favor of BufferRange

* Adding callback for batch completion that will let the extension know that a batch has completed execution

* Refactoring to make progressive results work as per async query execution

* Allowing retrieval of batch results while query is in progress

* reverting global.json, whoops

* Adding a few missing comments, and fixing a couple code style bugs

* Using SelectionData everywhere again

* One more missing comment
2016-11-02 17:43:38 -07:00
Karl Burtram
eafe2973be Update nuget.config to pull private nuget packages from within the repro. (#132) 2016-11-01 11:09:55 -07:00
Karl Burtram
69bbb652da Add more code coverage tests. (#129) 2016-10-29 19:59:58 -07:00
Karl Burtram
ab1316b1fb Next batch of code coverage tests. (#128)
Auto-merging test-only changes.  Please review the commit and I'll make changes in next iteration.

* Add more tests to boast code coverage

* Add more reliable connection tests.
2016-10-29 15:34:51 -07:00
Karl Burtram
6cdaa6e808 Add more test cases for code coverage (#127)
Next round of code coverage test cases.  Please review the commit for next iteration.

* Add connection retry tests

* More test coverage

* Update diagnostics end-to-end test
2016-10-29 12:10:02 -07:00
Karl Burtram
f46fc0c787 Add additional test cases (#125)
Test-only changes for code coverage.  Please review the comment and I'll include the changes in the next iteration.

* Add more tests

* Add some more additional test cases
2016-10-28 20:33:32 -07:00
Sharon Ravindran
931235c604 Refactor error messages (#122) 2016-10-28 12:26:31 -07:00
Karl Burtram
9bd5839812 Add end-to-end language service tests. (#123)
Test-only code coverage changes.  Please review the commit and I'll follow-up on next iteration.
2016-10-28 01:04:48 -07:00
Karl Burtram
da84ae9f3b Code coverage improvements (#121)
These are test-only changes to improve code coverage so I'll merge directly.  Please review the commit and I'll pickup those changes in the next iteration.

* Add integration test batch file

* Exclude Linux and MacOS from Windows code coverage builds

* Enable code coverage for test driver e2e tests

* Use the windows only build for code coverage runs
2016-10-27 18:18:31 -07:00
Karl Burtram
d42a92dd94 Test fixes to enable integration suites 2016-10-26 22:44:21 -07:00
Karl Burtram
b0f7ba4084 Turn on disabled tests in integration suite (#120)
No real code changes, just reenabling disabled tests in integration test runs.
2016-10-27 05:00:14 +00:00
Leila Lali
cac3ae5eeb changing the setting namespace (#116) 2016-10-25 17:09:42 -07:00
Sharon Ravindran
2a688cb87f Make save result async (#107)
* Make save results asynchronous

* Prevent write share of file

* Lock objects in stages

* Create Save result objects

* refactor and write rows in batches

* CHange batchSize from test value

* Remove await in handler

* Removing the file reader as a member of the resultset

* Change Dispose to wait for save

* Change concurrentBag

* PascalCase variables

* Modify function signature and tests

* Safe file methods

* refactor ResultSets to Ilist and remove ToList

* Change dictionary key and prevent add to saveTasks during dispose

* Simplify row concatenation

* Fix prevent add

* Fix prevent add

* Add methods to expose saveTasks and isBeingDisposed
2016-10-21 20:07:21 -07:00
Karl Burtram
854a6a0eca Switch back to event from locks to fix blocking issues. (#111) 2016-10-21 15:46:33 -07:00
Mitchell Sternke
f35b9fda27 Added option --enable-logging to enable diagnostic logging (#106)
* Added option --enable-logging to enable diagnostic logging

* Addressing feedback

* Addressing feedback, round 2
2016-10-20 17:56:33 -07:00
Karl Burtram
fd7a2a5748 Bump SMO to 140.1.9 (#108)
version bump only
2016-10-20 14:57:40 -07:00
Benjamin Russell
2721de1de7 Fixing a broken unit test (#98) 2016-10-19 14:52:05 -07:00
Benjamin Russell
11ca99f419 Handling NOCOUNT being set (#96)
After much thinking, this change brings the message behavior into line with SSMS, including if the NOCOUNT is set. This is a somewhat non-obvious solution, but the StatementCompleted event handler will only be fired if there is a record count to return. We'll add the message for number of records if the StatementCompleted event is fired, otherwise we won't add any messages while processing the resultsets of the batch. If any messages are returned from the server, we'll capture those. Then, if at the end of the batch, we haven't collected any messages from StatementCompleted events or server messages, then we'll add the "completed successfully" message.
This matches behavior of SSMS that will only emit a "completed successfully" message if there were no other messages for the batch.

* Solution to issue, some unit tests needed to be tweaked

* Comments for the event handler
2016-10-19 11:10:13 -07:00
Mitchell Sternke
a3335708c6 Feature/reliable connection tests (#102)
* Ported ReliableConnectionTests from DacFx and added a few more tests

* Fix style

* Created integration tests configuration and fixed minor test issue
2016-10-18 12:19:16 -07:00
Karl Burtram
c05dcbbc75 Use private SqlClient to fix UDT issue (#99)
This is only a version bump so I'm going to merge now to try and make Monday's build.
2016-10-15 22:35:34 -07:00
Karl Burtram
2f876714ed Disable test causing failures in lab builds (#93) 2016-10-12 19:58:04 -07:00
Karl Burtram
c5f44ccee1 Switch from events to locks during parsing (#87)
* Switch from event to locks in binding.

* Remove unneeded null check.
2016-10-12 15:09:24 -07:00
Mitchell Sternke
9f39ac6014 Feature/sql exception bug check (#90)
* Added test for OSX/Linux to check for the SqlException error code bug in .NET core

* fix style

* closed summary
2016-10-12 14:00:33 -07:00
Benjamin Russell
60edcc3057 Make query execution truly asynchronous (#83)
The two main changes in this pull request:
Launching query execution as an asynchronous task that performs a callback upon completion or failure of a query. (Which also sets us up for callbacks progressive results)
Moving away from using the Result of a query execution to return an error. Instead we'll use an error event to return an error
Additionally, some nice refactoring and cleaning up of the unit tests to take advantage of the cool RequestContext mock tooling by @kevcunnane

* Initial commit of refactor to run execution truely asynchronously

* Moving the storage of the task into Query class

Callbacks for completion of a query and failure of a query are setup as
events in the Query class. This actually sets us up for a very nice
framework for adding batch and resultset completion callbacks.

However, this also exposes a problem with cancelling queries and returning
errors -- we don't properly handle errors during execution of a query
(aside from DB errors).

* Wrapping things up in order to submit for code review

* Adding fixes as per comments
2016-10-11 10:51:52 -07:00
Karl Burtram
f32b0290bb Remove extra level of tasks in binding queue (#79)
* Remove extra layer of tasks in binding queue

* Change order of assigning result to avoid race condition

* Add timeout log for the metadata lock event

* Fix test cases
2016-10-08 00:06:35 +00:00
Karl Burtram
c6a2568075 Fix an issue with queue deadlocks causing test failures (#77) 2016-10-05 20:35:57 -04:00
Mitchell Sternke
8408bc6dff Feature/connect cancel (#74)
* Implemented connection cancellation

* Made connect requests return immediately and created a separate connection complete notification

* Fix spelling

* Fix sorting

* Add separate lock for cancellation source map
2016-10-04 15:45:52 -07:00
Karl Burtram
62525b9c98 Add IntelliSense binding queue (#73)
* Initial code for binding queue

* Fix-up some of the timeout wait code

* Add some initial test code

* Add missing test file

* Update the binding queue tests

* Add more test coverage and refactor a bit.  Disable reliabile connection until we can fix it..it's holding an open data reader connection.

* A few more test updates

* Initial integrate queue with language service.

* Hook up the connected binding queue into al binding calls.

* Cleanup comments and remove dead code

* More missing comments

* Fix build break.  Reenable ReliabileConnection.

* Revert all changes to SqlConnectionFactory

* Resolve merge conflicts

* Cleanup some more of the timeouts and sync code

* Address code review feedback

* Address more code review feedback
2016-10-04 14:55:59 -07:00
Benjamin Russell
1b8e9c1e86 Lingering File Handles (#71)
Fixing a bug where in various situations, the files used for temporary storage of query results would be leftover. In particular, the following changes were made:
* When the dispose query request is submitted, the corresponding query is now disposed in addition from being removed from the list of active queries
* When a query is cancelled, it is disposed after it is cancelled
* If a query already exists for a given ownerURI, the existing query is disposed before creating a new query
* All queries are disposed when the query execution service is disposed (ie, at shutdown of the service)

A unit test to verify the action of the dispose method for a ResultSet was added.

* Ensuring queries are disposed

Adding logic to dispose any queries when:
* URI that already has a query executes another query
* A request to dispose a query is submitted
* A request to cancel a query is submitted

* Small tweaks for cleanup of query execution service
2016-10-03 11:35:58 -07:00
Karl Burtram
f16d0104d0 Bump SMO to 14.0.7 to pick Batchparser updates (#72)
...bumping versions.  No review needed.
2016-09-30 15:50:38 -07:00