From bfafba6ecb3b0c1d8d20a877597d0e4094ef6670 Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Sat, 21 Dec 2024 16:07:22 +0100 Subject: [PATCH] wip: test without integ Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com> --- gno.land/pkg/integration/cmd_test.go | 106 ++++++++++++--------------- 1 file changed, 46 insertions(+), 60 deletions(-) diff --git a/gno.land/pkg/integration/cmd_test.go b/gno.land/pkg/integration/cmd_test.go index fe6acf3a8f6..d3d572ca536 100644 --- a/gno.land/pkg/integration/cmd_test.go +++ b/gno.land/pkg/integration/cmd_test.go @@ -1,64 +1,50 @@ package integration -import ( - "context" - "os" - "path/filepath" - "testing" - "time" - - "github.com/gnolang/gno/gnovm/pkg/gnoenv" - "github.com/gnolang/gno/tm2/pkg/bft/rpc/client" - "github.com/gnolang/gno/tm2/pkg/crypto/ed25519" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - // TestGnolandIntegration tests the forking of a Gnoland node. // XXX: For now keep this test sequential (no parallel execution is allowed). -func TestGnolandIntegration(t *testing.T) { - // Set a timeout of 20 seconds for the test context. - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) - defer cancel() - - tmpdir := t.TempDir() // Create a temporary directory for the test. - - gnoRootDir := gnoenv.RootDir() // Get the root directory for Gnolang. - - // Define paths for the build directory and the gnoland binary. - gnolandBuildDir := filepath.Join(tmpdir, "build") - gnolandDBDir := filepath.Join(tmpdir, "db") - gnolandBin := filepath.Join(gnolandBuildDir, "gnoland") - - // Compile the gnoland binary. - err := buildGnoland(t, gnoRootDir, gnolandBin) - require.NoError(t, err) - - // Prepare a minimal node configuration for testing. - cfg := TestingMinimalNodeConfig(gnoRootDir) - remoteAddr, cmd, err := ExecuteNode(ctx, gnolandBin, &Config{ - Verbose: false, - ValidatorKey: ed25519.GenPrivKey(), - DBDir: gnolandDBDir, - RootDir: gnoRootDir, - TMConfig: cfg.TMConfig, - Genesis: NewMarshalableGenesisDoc(cfg.Genesis), - }, os.Stderr) - require.NoError(t, err) - - defer func() { - // Ensure the process is killed after the test to clean up resources. - if cmd.Process != nil { - cmd.Process.Kill() - } - }() - - // Create a new HTTP client to interact with the integration node. - cli, err := client.NewHTTPClient(remoteAddr) - require.NoError(t, err) - - // Retreive node info. - info, err := cli.ABCIInfo() - require.NoError(t, err) - assert.NotEmpty(t, info.Response.Data) -} +// func TestGnolandIntegration(t *testing.T) { +// // Set a timeout of 20 seconds for the test context. +// ctx, cancel := context.WithTimeout(context.Background(), time.Minute) +// defer cancel() + +// tmpdir := t.TempDir() // Create a temporary directory for the test. + +// gnoRootDir := gnoenv.RootDir() // Get the root directory for Gnolang. + +// // Define paths for the build directory and the gnoland binary. +// gnolandBuildDir := filepath.Join(tmpdir, "build") +// gnolandDBDir := filepath.Join(tmpdir, "db") +// gnolandBin := filepath.Join(gnolandBuildDir, "gnoland") + +// // Compile the gnoland binary. +// err := buildGnoland(t, gnoRootDir, gnolandBin) +// require.NoError(t, err) + +// // Prepare a minimal node configuration for testing. +// cfg := TestingMinimalNodeConfig(gnoRootDir) +// remoteAddr, cmd, err := ExecuteNode(ctx, gnolandBin, &Config{ +// Verbose: false, +// ValidatorKey: ed25519.GenPrivKey(), +// DBDir: gnolandDBDir, +// RootDir: gnoRootDir, +// TMConfig: cfg.TMConfig, +// Genesis: NewMarshalableGenesisDoc(cfg.Genesis), +// }, os.Stderr) +// require.NoError(t, err) + +// defer func() { +// // Ensure the process is killed after the test to clean up resources. +// if cmd.Process != nil { +// cmd.Process.Kill() +// } +// }() + +// // Create a new HTTP client to interact with the integration node. +// cli, err := client.NewHTTPClient(remoteAddr) +// require.NoError(t, err) + +// // Retreive node info. +// info, err := cli.ABCIInfo() +// require.NoError(t, err) +// assert.NotEmpty(t, info.Response.Data) +// }