fix: Fix deleting multiple experiments when specifying uid. #114
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.
Signed-off-by: Super-long 0x4f4f4f4f@gmail.com
Describe what this PR does / why we need it
Take the generated expblade create cpu fullload --cpu-count 1 as an example.
When we execute the blend destroy uid, chaosblade is actually chaos_os destroy cpu fullload --cpu-count=1 --uid=e39ebc941a451b15 sent to exec-os first
The behavior at this point is that chaosblade destroys all chaos-related experiences. The root of the problem comes from Destroy, which lacks a judgment on the suid when looking for the pid to be deleted.
So even if we specify the uid in destroy, all chaos-related experiments will actually be deleted.
Translated with www.DeepL.com/Translator (free version)
Does this pull request fix one issue?
chaosblade-io/chaosblade#46
Describe how you did it
Add suid support for Destroy function.
Special notes for reviews
One of the judgments in the added code is ”spec.UnknownUid“, which occurs when executing something like
blade destroy cpu fullload
, the uid will be set to "spec.UnknownUid" and we don't want to execute GetPidsByProcessName with "spec.UnknownUid".