Skip to content

Commit

Permalink
wip: test without integ
Browse files Browse the repository at this point in the history
Signed-off-by: gfanton <[email protected]>
  • Loading branch information
gfanton committed Dec 21, 2024
1 parent cafdbbf commit bfafba6
Showing 1 changed file with 46 additions and 60 deletions.
106 changes: 46 additions & 60 deletions gno.land/pkg/integration/cmd_test.go
Original file line number Diff line number Diff line change
@@ -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.

Check failure on line 46 in gno.land/pkg/integration/cmd_test.go

View workflow job for this annotation

GitHub Actions / Run gno.land suite / Go Lint / lint

`Retreive` is a misspelling of `Retrieve` (misspell)
// info, err := cli.ABCIInfo()
// require.NoError(t, err)
// assert.NotEmpty(t, info.Response.Data)
// }

0 comments on commit bfafba6

Please sign in to comment.