mirror of
https://github.com/luxfi/evm.git
synced 2026-09-24 00:27:44 +00:00
luxd serves chain routes under /v1/chain, and the node, cli and sdk releases already ship it. The deployed gateways still answer the old prefix, so remote reads break until they are redeployed; the estate moves together rather than sitting half converted. Lines that record an observation - a probe, a status code, a past release - keep the prefix they were written against, as do URLs on hosts that are not ours. Avalanche endpoints move to /ext/bc, which is the path that host serves. Co-authored-by: Hanzo Dev <[email protected]>
109 lines
2.7 KiB
Plaintext
109 lines
2.7 KiB
Plaintext
//go:build e2e
|
|
|
|
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package load
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"os/exec"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
|
|
ginkgo "github.com/onsi/ginkgo/v2"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/luxfi/log"
|
|
|
|
"github.com/luxfi/ids"
|
|
"github.com/luxfi/math/set"
|
|
"github.com/luxfi/vm/tests/fixture/e2e"
|
|
"github.com/luxfi/vm/tests/fixture/tmpnet"
|
|
|
|
"github.com/luxfi/evm/tests"
|
|
"github.com/luxfi/evm/tests/utils"
|
|
)
|
|
|
|
const (
|
|
// The load test requires 5 nodes
|
|
nodeCount = 5
|
|
|
|
subnetAName = "load-subnet-a"
|
|
)
|
|
|
|
var (
|
|
flagVars *e2e.FlagVars
|
|
repoRootPath = tests.GetRepoRootPath("tests/load")
|
|
)
|
|
|
|
func init() {
|
|
// Configures flags used to configure tmpnet
|
|
flagVars = e2e.RegisterFlags()
|
|
}
|
|
|
|
func TestE2E(t *testing.T) {
|
|
// Skip if LUXD_PATH is not set - this is an E2E test that requires
|
|
// a full node environment with the luxd binary available
|
|
if os.Getenv("LUXD_PATH") == "" && os.Getenv("E2E_TEST") == "" {
|
|
t.Skip("Skipping E2E test: LUXD_PATH environment variable not set")
|
|
}
|
|
ginkgo.RunSpecs(t, "evm small load simulator test suite")
|
|
}
|
|
|
|
var _ = ginkgo.Describe("[Load Simulator]", ginkgo.Ordered, func() {
|
|
require := require.New(ginkgo.GinkgoT())
|
|
|
|
var env *e2e.TestEnvironment
|
|
|
|
ginkgo.BeforeAll(func() {
|
|
tc := e2e.NewTestContext()
|
|
genesisPath := filepath.Join(repoRootPath, "tests/load/genesis/genesis.json")
|
|
|
|
nodes := utils.NewTmpnetNodes(nodeCount)
|
|
env = e2e.NewTestEnvironment(
|
|
tc,
|
|
flagVars,
|
|
utils.NewTmpnetNetwork(
|
|
"evm-small-load",
|
|
nodes,
|
|
tmpnet.FlagsMap{},
|
|
utils.NewTmpnetNet(subnetAName, genesisPath, utils.DefaultChainConfig, nodes...),
|
|
),
|
|
)
|
|
})
|
|
|
|
ginkgo.It("basic net load test", ginkgo.Label("load"), func() {
|
|
network := env.GetNetwork()
|
|
|
|
net := network.GetNet(subnetAName)
|
|
require.NotNil(net)
|
|
blockchainID := net.Chains[0].ChainID
|
|
|
|
nodeURIs := env.GetNodeURIs()
|
|
validatorIDs := set.NewSet[ids.NodeID](len(net.ValidatorIDs))
|
|
validatorIDs.Add(net.ValidatorIDs...)
|
|
rpcEndpoints := make([]string, 0, len(nodeURIs))
|
|
for _, nodeURI := range nodeURIs {
|
|
if !validatorIDs.Contains(nodeURI.NodeID) {
|
|
continue
|
|
}
|
|
rpcEndpoints = append(rpcEndpoints, fmt.Sprintf("%s/v1/chain/%s/rpc", nodeURI.URI, blockchainID))
|
|
}
|
|
commaSeparatedRPCEndpoints := strings.Join(rpcEndpoints, ",")
|
|
require.NoError(os.Setenv("RPC_ENDPOINTS", commaSeparatedRPCEndpoints))
|
|
|
|
log.Info("Running load simulator...", "rpcEndpoints", commaSeparatedRPCEndpoints)
|
|
cmd := exec.Command("./scripts/run_simulator.sh")
|
|
cmd.Dir = repoRootPath
|
|
log.Info("Running load simulator script", "cmd", cmd.String())
|
|
|
|
out, err := cmd.CombinedOutput()
|
|
fmt.Printf("\nCombined output:\n\n%s\n", string(out))
|
|
require.NoError(err)
|
|
})
|
|
})
|