Skip to content

[tmpnet] Delegate writing of the flag file to the runtime #3897

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

maru-ava
Copy link
Contributor

@maru-ava maru-ava commented Apr 18, 2025

Why this should be merged

This is intended to enable the process and kube runtimes to vary how they compose the flags that configure a given node.

How this was tested

CI

Need to be documented in RELEASES.md?

N/A

TODO

@maru-ava maru-ava added the tooling Build, test and development tooling label Apr 18, 2025
@maru-ava maru-ava self-assigned this Apr 18, 2025
@maru-ava maru-ava moved this from Backlog 🗄️ to In Review 👀 in Platform Engineering Group Apr 18, 2025
// Ensure a min stake duration compatible with testing staking logic
config.MinStakeDurationKey: "1s",
}
defaultFlags.SetDefaults(tmpnet.DefaultE2EFlags())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The e2e flags are now expected to be set on the network rather than applied automatically by tmpnet.

@@ -762,10 +763,11 @@ func (n *Network) GetNodeURIs() []NodeURI {
return GetNodeURIs(n.Nodes)
}

// Retrieves bootstrap IPs and IDs for all nodes except the skipped one (this supports
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This cleanup opportunity was discovered in the process of updating how flags were written.

@@ -323,6 +319,59 @@ func (n *Node) GetUniqueID() string {
return n.network.UUID + "-" + strings.ToLower(nodeIDString[startIndex:endIndex])
}

// composeFlags determines the set of flags that should be used to
// start the node.
func (n *Node) composeFlags() (FlagsMap, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These flags are common across runtimes

@@ -23,17 +23,6 @@ func (n *Node) GetFlagsPath() string {
return filepath.Join(n.DataDir, "flags.json")
}

func (n *Node) writeFlags(flags FlagsMap) error {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Another cleanup opportunity - this method was no longer used.

)

type ProcessRuntimeConfig struct {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure why this was previously defined in node.go, this seems like a preferable location.

@@ -144,6 +154,51 @@ func (p *ProcessRuntime) Start(ctx context.Context) error {
return p.writeMonitoringConfig()
}

func (p *ProcessRuntime) writeFlags() error {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Flags set in this method are process-specific

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 pull request refactors the way node flags are written by delegating that responsibility to the process runtime. Key changes include the introduction of a ProcessRuntimeConfig struct and associated methods (getRuntimeConfig and writeFlags), the removal of the node-level writeFlags function, and adjustments in related tests and defaults to support the new delegation model.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/fixture/tmpnet/process_runtime.go Introduces ProcessRuntimeConfig, getRuntimeConfig, and writeFlags to handle flag writing.
tests/fixture/tmpnet/node_config.go Removes the node.writeFlags function as flag writing is now delegated.
tests/fixture/tmpnet/node.go Updates the runtime configuration handling and removes the legacy node.writeFlags call in StartNode.
tests/fixture/tmpnet/defaults.go Renames and refactors default flag functions (DefaultTestFlags → DefaultTmpnetFlags, adds DefaultE2EFlags).
tests/e2e/e2e_test.go Updates default flags usage to align with the new DefaultE2EFlags.
tests/antithesis/compose.go Adjusts to use DefaultTmpnetFlags rather than the removed DefaultTestFlags.

@maru-ava maru-ava force-pushed the tmpnet-move-waitforhealthy branch from 9c8d963 to ce11d86 Compare April 18, 2025 21:39
Base automatically changed from tmpnet-move-waitforhealthy to master April 18, 2025 22:11
This is intended to enable the process and kube runtimes to vary how
they compose the flags that configure a given node.
@maru-ava maru-ava force-pushed the tmpnet-runtime-flag-writing branch from 2cf574c to a6d0977 Compare April 19, 2025 00:09
Copy link
Contributor

@felipemadero felipemadero left a comment

Choose a reason for hiding this comment

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

nice cleanup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tooling Build, test and development tooling
Projects
Status: In Review 👀
Development

Successfully merging this pull request may close these issues.

4 participants