-
Notifications
You must be signed in to change notification settings - Fork 17
RHELMISC-4745: Add ability to bring up previous session #487
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
base: master
Are you sure you want to change the base?
Conversation
a94ca1f
to
71d5c6c
Compare
I'm not a fan of this idea. It brings significant complexity similar to |
71d5c6c
to
7e1ff8a
Compare
7e1ff8a
to
8a79a7e
Compare
8a79a7e
to
0ba68bc
Compare
72f53ca
to
dd5ec70
Compare
a63b74b
to
0f480a0
Compare
0f480a0
to
df1cc61
Compare
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 current implementation will leave an immature session if an error happens before clients get configured. Save the session after it is fully initialized (i.e., all clients are configured).
But this is one of features, you can bring up VM`s for checking what's goin on and where it's crash |
df1cc61
to
1684f10
Compare
db2afd6
to
155f725
Compare
155f725
to
b6b7346
Compare
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.
Pull Request Overview
This PR adds the ability to bring up a previous session by introducing session management and adjusting workspace and client configuration flows accordingly. Key changes include:
- Introducing a new Session model (lib/session.rb) with save/load functionality.
- Updating project initialization and workspace restoration logic (lib/project.rb and related files).
- Extending CLI options to support session-related arguments and refining client and test configurations based on session status.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
lib/setupmanagers/qemuhck/qemu_machine.rb | Added "configured" flag to the machine options hash and adjusted instance variable usage. |
lib/setupmanagers/hckstudio.rb | Early return added when project is restored to prevent redundant pool creation. |
lib/setupmanagers/hckclient.rb | Modified client configuration logic to account for a restored session condition. |
lib/session.rb | New Session model added, providing save and load methods for session management. |
lib/project.rb | Updated initialization to accept a session, introduced workspace restore and save. |
lib/engines/hcktest/tools.rb | Modified conditional expression for results handling (potential issue identified). |
lib/engines/hcktest/tests.rb | Removed an extraneous blank line. |
lib/engines/hcktest/hcktest.rb | Adjusted restored session handling, updated snapshot options, and refined test logic. |
lib/cli.rb | Refactored CLI options using T::Struct and added session parameters. |
lib/all.rb | Added autoload for the new Session module. |
b6b7346
to
76061d7
Compare
76061d7
to
ca47498
Compare
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.
808104f
to
7158cf5
Compare
7158cf5
to
af17bd2
Compare
lib/project.rb
Outdated
def restore_workspace | ||
@workspace_path = @options.test.session | ||
|
||
raise AutoHCKError, 'Workspace path does not exist could not load session' unless File.directory?(@workspace_path) |
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.
Rescue an error that will happen in @setup_manager_type&.enter @workspace_path
when the directory is missing 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.
I decided to rise error in session class cause we already have one for regular session in Project#create_workspace
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.
Rescue an error only when restored. Checking File.directory?(session_path)
results in a duplicate file operation and a "time-of-check to time-of-use" race condition, which is why I suggest rescuing one.
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.
It actually will be rised by OpenJsonError if it's does't exist, I dont want to rescue it's doesn't make sense for me we can have a little double operation or you can sugget another one
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.
Why do you think it doesn't make sense? It tells the session doesn't exist, so we can tell the fact to the user.
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.
Look, we cant catch Errno::ENOENT error here Cause its already catched by Json helper and our rescue will be ignored
So we can remove this rising of error and will see that session.JSON does not exist ant it will be unclear that workspace_path doesn't exist
lib/engines/hcktest/hcktest.rb
Outdated
@@ -249,12 +250,24 @@ def prepare_tests | |||
@project.logger.info('HLK test target is not defined, allow in manual mode') | |||
end | |||
|
|||
@tests.verify_target if @project.restored? |
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.
What is it for?
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 actually don't clearly remember it but, i think it was some error relatet to target creation back then
Anyway it's works without it now
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 new version removed the condition, but @tests.verify_target
is still there.
Signed-off-by: Vitalii Chulak <[email protected]>
af17bd2
to
dd1caeb
Compare
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.
Two of the last comments are not addressed.
|
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 replied to the comments so please check them out.
WIP