-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat(deviceManagerEngine): free devices after engine deletion #382
Open
QuentinRousselet
wants to merge
13
commits into
2-dev
Choose a base branch
from
KZLPRD-511-free-devices-after-tenant-deletion
base: 2-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9437217
ci(doc): fix major version in CI doc step
fmauNeko 66ca578
Merge branch '2-dev' of https://github.com/kuzzleio/kuzzle-device-man…
QuentinRousselet beffd03
Merge branch '2-dev' of https://github.com/kuzzleio/kuzzle-device-man…
QuentinRousselet d3f055d
Merge branch '2-dev' of https://github.com/kuzzleio/kuzzle-device-man…
QuentinRousselet 53b18fc
Merge branch '2-dev' of https://github.com/kuzzleio/kuzzle-device-man…
QuentinRousselet 2614e28
Merge branch '2-dev' of https://github.com/kuzzleio/kuzzle-device-man…
QuentinRousselet e8c27f9
feat(deviceservice): add hook on tenant deletion to set its devices a…
QuentinRousselet ddb1e69
refactor(devicemanagerengine): implement the logic in the onDelete of…
QuentinRousselet bf16d95
reafactor(DeviceService) : remove logic from device service
QuentinRousselet e9d912a
fix(deviceservice): add missing '}'
QuentinRousselet a49487b
fix(lint): remove space for linter
QuentinRousselet 9d68644
Revert "fix(assetservice): allow metadata update if existing in asset…
QuentinRousselet 1aa6b54
chore(test): adds test for engine deletion
QuentinRousselet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { beforeAllCreateEngines } from "../../../hooks/engines"; | ||
import { beforeEachLoadFixtures } from "../../../hooks/fixtures"; | ||
|
||
import { useSdk } from "../../../helpers"; | ||
|
||
jest.setTimeout(10000); | ||
|
||
describe("Engine deletion", () => { | ||
const sdk = useSdk(); | ||
|
||
beforeAll(async () => { | ||
await sdk.connect(); | ||
await beforeAllCreateEngines(sdk); | ||
}); | ||
|
||
beforeEach(async () => { | ||
await beforeAllCreateEngines(sdk); | ||
await beforeEachLoadFixtures(sdk); | ||
}); | ||
|
||
afterAll(async () => { | ||
sdk.disconnect(); | ||
}); | ||
const adminIndex = "device-manager"; | ||
const engineId = "engine-ayse"; | ||
|
||
it("Deletes the engine from admin index", async () => { | ||
const engine = await sdk.document.get( | ||
adminIndex, | ||
"config", | ||
`engine-device-manager--${engineId}`, | ||
); | ||
|
||
expect(engine).toBeTruthy(); | ||
|
||
await sdk.query({ | ||
controller: "device-manager/engine", | ||
action: "delete", | ||
index: engineId, | ||
}); | ||
|
||
const promise = sdk.document.get( | ||
adminIndex, | ||
"config", | ||
`engine-device-manager--${engineId}`, | ||
); | ||
|
||
await expect(promise).rejects.toThrow(); | ||
}); | ||
it("Detach devices from engine in the admin index on engine deletion", async () => { | ||
const devices = await sdk.document.search(adminIndex, "devices", { | ||
_source: false, | ||
query: { bool: { must: { term: { engineId } } } }, | ||
}); | ||
expect(devices.total).toBeGreaterThan(0); | ||
|
||
await sdk.query({ | ||
controller: "device-manager/engine", | ||
action: "delete", | ||
index: engineId, | ||
}); | ||
|
||
const result = await sdk.document.search(adminIndex, "devices", { | ||
_source: false, | ||
query: { bool: { must: { term: { engineId } } } }, | ||
}); | ||
expect(result.total).toBe(0); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 feel like this method should be named
detachDevicesFromTenantIndex
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 think tenantIndex could lead to confusion as this functions is related only to the 'platform' index which is referred as adminIndex in KDM.