Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Jedoku
Copy link
Contributor

@Jedoku Jedoku commented Oct 7, 2024

WIP

@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch 2 times, most recently from a94ca1f to 71d5c6c Compare October 8, 2024 22:29
@akihikodaki
Copy link
Contributor

I'm not a fan of this idea. It brings significant complexity similar to --dump, which adds an alternative way to run tests.
Its use case is also unclear; I often repeatedly run tests using the command line history and I'm satisfied with it.

@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from 71d5c6c to 7e1ff8a Compare October 18, 2024 15:48
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from 7e1ff8a to 8a79a7e Compare November 27, 2024 13:14
@Jedoku Jedoku requested a review from akihikodaki December 1, 2024 00:10
@Jedoku Jedoku changed the title RFC: Bring up previous session Bring up previous session Dec 2, 2024
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from 8a79a7e to 0ba68bc Compare December 19, 2024 08:54
@Jedoku Jedoku requested a review from akihikodaki December 19, 2024 09:06
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch 2 times, most recently from 72f53ca to dd5ec70 Compare January 22, 2025 09:01
@Jedoku Jedoku requested a review from akihikodaki January 22, 2025 11:17
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch 2 times, most recently from a63b74b to 0f480a0 Compare January 30, 2025 03:51
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from 0f480a0 to df1cc61 Compare January 31, 2025 00:09
Copy link
Contributor

@akihikodaki akihikodaki left a 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).

@Jedoku
Copy link
Contributor Author

Jedoku commented Jan 31, 2025

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

@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from df1cc61 to 1684f10 Compare January 31, 2025 10:02
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from db2afd6 to 155f725 Compare April 28, 2025 08:44
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from 155f725 to b6b7346 Compare April 28, 2025 11:09
@Jedoku Jedoku requested review from akihikodaki and Copilot April 28, 2025 16:57
Copy link

@Copilot Copilot AI left a 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.

@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from b6b7346 to 76061d7 Compare April 29, 2025 11:22
@Jedoku Jedoku requested a review from akihikodaki April 29, 2025 11:25
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from 76061d7 to ca47498 Compare May 25, 2025 17:48
@Jedoku Jedoku requested a review from akihikodaki May 25, 2025 18:58
Copy link
Contributor

@akihikodaki akihikodaki left a comment

Choose a reason for hiding this comment

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

@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch 2 times, most recently from 808104f to 7158cf5 Compare May 26, 2025 20:54
@Jedoku Jedoku requested a review from akihikodaki May 26, 2025 21:04
@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from 7158cf5 to af17bd2 Compare May 29, 2025 01:37
@Jedoku Jedoku requested a review from akihikodaki May 29, 2025 01:38
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)
Copy link
Contributor

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.

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 decided to rise error in session class cause we already have one for regular session in Project#create_workspace

Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Contributor Author

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

@@ -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?
Copy link
Contributor

Choose a reason for hiding this comment

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

What is it for?

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 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

Copy link
Contributor

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.

@Jedoku Jedoku force-pushed the Add-ability-to-bring-up-previous-session branch from af17bd2 to dd1caeb Compare May 29, 2025 05:03
@Jedoku Jedoku requested a review from akihikodaki May 29, 2025 05:04
Copy link
Contributor

@akihikodaki akihikodaki left a 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.

@Jedoku
Copy link
Contributor Author

Jedoku commented May 29, 2025

Two of the last comments are not addressed.

@Jedoku Jedoku closed this May 29, 2025
@Jedoku Jedoku reopened this May 29, 2025
@Jedoku Jedoku requested a review from akihikodaki May 29, 2025 05:27
Copy link
Contributor

@akihikodaki akihikodaki left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants