-
Notifications
You must be signed in to change notification settings - Fork 1
Add Index Controller #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* Implementation * Unit tests * Kuzzle integration
42c6fda to
cbd6f3d
Compare
Codecov Report
@@ Coverage Diff @@
## 0-dev #23 +/- ##
==========================================
+ Coverage 81.59% 83.01% +1.42%
==========================================
Files 18 19 +1
Lines 880 954 +74
Branches 107 116 +9
==========================================
+ Hits 718 792 +74
Misses 155 155
Partials 7 7
Continue to review full report at Codecov.
|
50bfef4 to
4655af0
Compare
* Optimize running and deployment conditions. * Build in release mode only when deploying.
| { "index", index }, | ||
| }); | ||
|
|
||
| return (JObject)response.Result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your files are (very) badly indented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot to install the VIM C# plugin 😞
|
|
||
| [Fact] | ||
| public async void ExistsAsyncTest() { | ||
| _api.SetResult(@"{result: true}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit tests should test all possible outcomes (use a theory instead of a fact). This should be fixed for all comparable tests.
| { "action", "refreshInternal" }, | ||
| }); | ||
|
|
||
| return (bool)response.Result["acknowledged"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API routes returning {acknowledge: true} can never return acknowledge: false. These kind of responses are just to inform that the query is well-formed and will be processed. In case of error, the result is null and the response contains an error object.
This method should thus return a Task instead of a Task<bool>
| } | ||
|
|
||
| /// <summary> | ||
| /// Delete an index from the Kuzzle persistence engine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// Delete an index from the Kuzzle persistence engine. | |
| /// Deletes an index from the Kuzzle persistence engine. |
| } | ||
|
|
||
| /// <summary> | ||
| /// Check if an index exists in the Kuzzle persistence engine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// Check if an index exists in the Kuzzle persistence engine. | |
| /// Checks if an index exists in the Kuzzle persistence engine. |
| } | ||
|
|
||
| /// <summary> | ||
| /// Get the autoRefresh flag value for the given index. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// Get the autoRefresh flag value for the given index. | |
| /// Gets the autoRefresh flag value for the given index. |
| } | ||
|
|
||
| /// <summary> | ||
| /// List indexes from the Kuzzle persistence engine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// List indexes from the Kuzzle persistence engine. | |
| /// Lists indexes from the Kuzzle persistence engine. |
14f5b4e to
d2f63ca
Compare
2862f33 to
c1c7301
Compare
| { "index", index }, | ||
| }); | ||
|
|
||
| return (JObject)response.Result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The result is not important here, you could return nothing (like DeleteAsync) instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the case in SDK JS https://docs-v2.kuzzle.io/sdk/js/6/controllers/index/create/#resolves 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then the js response should be modified in the next release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aschen : Fixed
|
|
||
| Response response = await api.QueryAsync(request); | ||
|
|
||
| return (bool)response.Result["response"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The result is not important here, you could return nothing (like DeleteAsync) instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JS SDK is not an example, we cannot change the return because of the breaking change but IMHO this return is not useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
| Auth = new AuthController(this); | ||
| Collection = new CollectionController(this); | ||
| Document = new DocumentController(this); | ||
| Index = new IndexController(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add the associated unit test
.travis.yml
Outdated
| - name: Unit Tests | ||
| - stage: "Tests" | ||
| name: "Unit Tests" | ||
| if: type = pull_request OR (type = push && branch =~ /^master|[0-9]+-(dev|stable)$/) OR type = cron |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpicking: unneeded parenthesis and mix of || / && with AND / OR
| if: type = pull_request OR (type = push && branch =~ /^master|[0-9]+-(dev|stable)$/) OR type = cron | |
| if: type = pull_request OR type = push AND branch =~ /^master|[0-9]+-(dev|stable)$/ OR type = cron |
Plus: we don't have any *-stable branch: why include this pattern?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I include this pattern to avoid forgetting it
| { "index", index }, | ||
| }); | ||
|
|
||
| return (JObject)response.Result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then the js response should be modified in the next release.
9fa66b7 to
b6b4b9d
Compare
b6b4b9d to
e9bf207
Compare
| "); | ||
|
|
||
| Assert.Equal( | ||
| new JObject { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nitpicking) wrong indentation
# [0.2.0](https://github.com/kuzzleio/sdk-csharp/releases/tag/0.2.0) (2019-07-17) #### New features - [ [#22](#22) ] Add Admin controller and unit tests ([Shiranuit](https://github.com/Shiranuit)) - [ [#23](#23) ] Add Index Controller ([alexandrebouthinon](https://github.com/alexandrebouthinon)) #### Enhancements - [ [#14](#14) ] Fix optional parameters design ([scottinet](https://github.com/scottinet)) - [ [#13](#13) ] Add unit tests for the collection controller ([scottinet](https://github.com/scottinet)) - [ [#12](#12) ] Add unit tests for the auth controller ([scottinet](https://github.com/scottinet)) - [ [#11](#11) ] Initialize unit tests project ([scottinet](https://github.com/scottinet)) #### Others - [ [#24](#24) ] Rewrite WebSocket class ([scottinet](https://github.com/scottinet), [alexandrebouthinon](https://github.com/alexandrebouthinon)) - [ [#20](#20) ] Add documentation runner ([Aschen](https://github.com/Aschen)) - [ [#18](#18) ] Add unit test for Realtime Controller ([ThomasF34](https://github.com/ThomasF34)) - [ [#17](#17) ] Unit tests kuzzle class ([Aschen](https://github.com/Aschen)) - [ [#16](#16) ] Add unit tests for the server controller ([ThomasF34](https://github.com/ThomasF34)) - [ [#15](#15) ] Add unit tests for the document controller ([scottinet](https://github.com/scottinet)) ---
What does this PR do ?
Add Index controller to the SDK C#:
How should this be manually tested?
Run this oneliner:
Other changes
Travis CI / CD improvments