Skip to content
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

Remove AddEphemeralNode #2887

Merged
merged 3 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions tests/fixture/e2e/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ func Eventually(condition func() bool, waitFor time.Duration, tick time.Duration
func AddEphemeralNode(network *tmpnet.Network, flags tmpnet.FlagsMap) *tmpnet.Node {
require := require.New(ginkgo.GinkgoT())

node, err := network.AddEphemeralNode(DefaultContext(), ginkgo.GinkgoWriter, flags)
require.NoError(err)
node := tmpnet.NewEphemeralNode(flags)
require.NoError(network.StartNode(DefaultContext(), ginkgo.GinkgoWriter, node))

ginkgo.DeferCleanup(func() {
tests.Outf("shutting down ephemeral node %q\n", node.NodeID)
Expand Down Expand Up @@ -199,10 +199,10 @@ func CheckBootstrapIsPossible(network *tmpnet.Network) {
ctx, cancel := context.WithTimeout(context.Background(), DefaultTimeout)
defer cancel()

node, err := network.AddEphemeralNode(ctx, ginkgo.GinkgoWriter, tmpnet.FlagsMap{})
// AddEphemeralNode will initiate node stop if an error is encountered during start,
node := tmpnet.NewEphemeralNode(tmpnet.FlagsMap{})
require.NoError(network.StartNode(ctx, ginkgo.GinkgoWriter, node))
// StartNode will initiate node stop if an error is encountered during start,
// so no further cleanup effort is required if an error is seen here.
require.NoError(err)

// Ensure the node is always stopped at the end of the check
defer func() {
Expand Down
10 changes: 0 additions & 10 deletions tests/fixture/tmpnet/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,16 +334,6 @@ func (n *Network) Start(ctx context.Context, w io.Writer) error {
return nil
}

func (n *Network) AddEphemeralNode(ctx context.Context, w io.Writer, flags FlagsMap) (*Node, error) {
node := NewNode("")
node.Flags = flags
node.IsEphemeral = true
if err := n.StartNode(ctx, w, node); err != nil {
return nil, err
}
return node, nil
}

// Starts the provided node after configuring it for the network.
func (n *Network) StartNode(ctx context.Context, w io.Writer, node *Node) error {
if err := n.EnsureNodeConfig(node); err != nil {
Expand Down
9 changes: 9 additions & 0 deletions tests/fixture/tmpnet/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ func NewNode(dataDir string) *Node {
}
}

// Initializes an ephemeral node using the provided config flags
func NewEphemeralNode(flags FlagsMap) *Node {
node := NewNode("")
node.Flags = flags
node.IsEphemeral = true

return node
}

// Initializes the specified number of nodes.
func NewNodes(count int) []*Node {
nodes := make([]*Node, count)
Expand Down