Skip to content

Conversation

@Shiranuit
Copy link
Contributor

@Shiranuit Shiranuit commented Jul 4, 2019

⚠️ depends on #21

What does this PR do ?

Add an Admin Controller wit the following methods from the API reference:

  • dump
  • loadFixtures
  • loadMappings
  • loadSecurities
  • resetCache
  • resetDatabase
  • resetKuzzleData
  • resetSecurity
  • shutdown

Add unit tests for every methods enumerated above

How should this be manually tested?

Run the following command : dotnet test

ycombes added 4 commits July 3, 2019 10:44
@codecov
Copy link

codecov bot commented Jul 4, 2019

Codecov Report

Merging #22 into 0-dev will increase coverage by 1.19%.
The diff coverage is 94.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##            0-dev      #22      +/-   ##
==========================================
+ Coverage   81.59%   82.78%   +1.19%     
==========================================
  Files          18       20       +2     
  Lines         880      970      +90     
  Branches      107      118      +11     
==========================================
+ Hits          718      803      +85     
- Misses        155      160       +5     
  Partials        7        7
Impacted Files Coverage Δ
Kuzzle/API/Controllers/AdminController.cs 100% <100%> (ø)
Kuzzle/Utils/QueryUtils.cs 50% <50%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 105d0b9...973ce2c. Read the comment docs.

@codecov
Copy link

codecov bot commented Jul 4, 2019

Codecov Report

❗ No coverage uploaded for pull request base (0-dev@c30b01e). Click here to learn what that means.
The diff coverage is 94.56%.

Impacted file tree graph

@@           Coverage Diff            @@
##             0-dev      #22   +/-   ##
========================================
  Coverage         ?   82.81%           
========================================
  Files            ?       20           
  Lines            ?      972           
  Branches         ?      118           
========================================
  Hits             ?      805           
  Misses           ?      160           
  Partials         ?        7
Impacted Files Coverage Δ
Kuzzle/Kuzzle.cs 90.56% <100%> (ø)
Kuzzle/API/Controllers/AdminController.cs 100% <100%> (ø)
Kuzzle/Utils/QueryUtils.cs 50% <50%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c30b01e...b43acfa. Read the comment docs.

/// <summary>
/// Load roles, profiles and users into the storage layer.
/// </summary>
public async Task<bool> LoadSecuritiesAsync(JObject body, bool waitForRefresh = false) {
Copy link
Contributor

@scottinet scottinet Jul 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You couldn't know that obviously, but routes returning the following kind of results: {acknowledge: true} will never have a false value. What it says is that the query is correctly formed and is thus accepted.
If something's wrong, the result part of the response will be null and the error part will be filled with the appropriate information.

So all methods wrapping API routes returning that kind of response must return a Task instead of a Task<bool>, because that boolean can never be false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know that thanks.
This has been changed to return Task instead of Task<bool>.

[Theory]
[InlineData(false)]
[InlineData(true)]
public async void DumpAsyncTestSuccess(bool value) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useless acknowledge value theory: you forgot to change that when dropping the handling of the "acknowledge" response boolean value.
(this comment also applies to other tests below)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the forgotten variables that i've used.

@Shiranuit Shiranuit requested a review from scottinet July 15, 2019 14:09
@Aschen Aschen merged commit 4c5abfd into 0-dev Jul 15, 2019
@Aschen Aschen deleted the admin-controller branch July 15, 2019 16:38
@scottinet scottinet mentioned this pull request Jul 17, 2019
scottinet added a commit that referenced this pull request Jul 18, 2019
# [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))
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants