Skip to content

refactor: move bootstrap sequence into dedicated bootstrap.go#460

Open
Aditya-132 wants to merge 1 commit into
opiproject:mainfrom
Aditya-132:issue455
Open

refactor: move bootstrap sequence into dedicated bootstrap.go#460
Aditya-132 wants to merge 1 commit into
opiproject:mainfrom
Aditya-132:issue455

Conversation

@Aditya-132

Copy link
Copy Markdown

Proposed changes

Refactors the bootstrap logic in the secure agent into its own file for
better separation of concerns:

  • Extract performBootstrapSequence and its helper functions
    (discoverBootstrapURLs, doHandleBootstrapRedirect,
    doRequestBootstrapServerOnboardingInfo, etc.) out of daemon.go
    into a new bootstrap.go. daemon.go now only holds RunCommandDaemon.
  • Move the corresponding unit tests from daemon_test.go into a new
    bootstrap_test.go.
  • Fix the RunCommand and DaemonCommand tests by setting the status
    file paths (StatusFilePath, ResultFilePath, SymLinkDir) so
    prepareStatus can create its directory instead of failing on an
    empty path (mkdir "": no such file or directory).

Closes #455

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Bugfix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices applies)

Checklist

  • I have signed the comm
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if
    appropriate)
  • I have added necessary documentation (if appropriate)

Dependency

  • None.

Special notes for your re

This is primarily a code-organization refactor with no behavior change to
the bootstrap flow. The only functional change is in the test setup: the
existing RunCommand/Daemobecause prepareStatus(added with the status command) needs valid status paths; they now uset.TempDir()` so the suite runs green.

Extract performBootstrapSequence and its helper functions from daemon.go
into a new bootstrap.go file, with the matching tests moved to
bootstrap_test.go.

Set the status file paths in the RunCommand and DaemonCommand tests so
prepareStatus can create its directory instead of failing on an empty
path.

Signed-off-by: Aditya-132 <adityachincholkar11@gmail.com>
@Aditya-132 Aditya-132 requested a review from a team as a code owner June 25, 2026 13:00
@Aditya-132

Copy link
Copy Markdown
Author

@glimchb

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.

Refactor: move performBootstrapSequence from daemon.go to a seperate file bootstrap.go

1 participant