Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ jobs:
if: env.GIT_DIFF
with:
go-version: 1.19
- name: Install Ignite CLI
if: env.GIT_DIFF
run: go install ./...
- name: Run Integration Tests
if: env.GIT_DIFF
run: go test -v -timeout 60m ./integration/${{ matrix.test-path }}
Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Changes

- Integration tests build their own ignite binary.
- Updated `pkg/cosmosanalysis` to discover the list of app modules when defined in variables.
- Switch to broadcast mode sync in `cosmosclient`
- Updated `nodetime`: `ts-proto` to `v1.123.0`, `protobufjs` to `v7.1.1`, `swagger-typescript-api` to `v9.2.0`
Expand Down
43 changes: 35 additions & 8 deletions integration/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import (
"flag"
"fmt"
"os"
"path"
"path/filepath"
"strconv"
"strings"
"sync"
"testing"
"time"

Expand All @@ -17,17 +19,25 @@ import (

"github.com/ignite/cli/ignite/chainconfig"
"github.com/ignite/cli/ignite/pkg/cosmosfaucet"
"github.com/ignite/cli/ignite/pkg/gocmd"
"github.com/ignite/cli/ignite/pkg/gomodulepath"
"github.com/ignite/cli/ignite/pkg/httpstatuschecker"
"github.com/ignite/cli/ignite/pkg/xexec"
"github.com/ignite/cli/ignite/pkg/xurl"
)

const (
IgniteApp = "ignite"
Stargate = "stargate"
ConfigYML = "config.yml"
)

var isCI, _ = strconv.ParseBool(os.Getenv("CI"))
var (
// IgniteApp hold the location of the ignite binary used in the integration
// tests. The binary is compiled the first time the env.New() function is
// invoked.
IgniteApp = path.Join(os.TempDir(), "ignite-tests", "ignite")

isCI, _ = strconv.ParseBool(os.Getenv("CI"))
compileBinaryOnce sync.Once
)

// Env provides an isolated testing environment and what's needed to
// make it possible.
Expand All @@ -44,12 +54,29 @@ func New(t *testing.T) Env {
ctx: ctx,
}
t.Cleanup(cancel)
compileBinaryOnce.Do(func() {
compileBinary(ctx)
})
return e
}

if !xexec.IsCommandAvailable(IgniteApp) {
t.Fatal("ignite needs to be installed")
func compileBinary(ctx context.Context) {
wd, err := os.Getwd()
if err != nil {
panic(fmt.Sprintf("unable to get working dir: %v", err))
}
_, appPath, err := gomodulepath.Find(wd)
if err != nil {
panic(fmt.Sprintf("unable to read go module path: %v", err))
}
var (
output, binary = filepath.Split(IgniteApp)
path = path.Join(appPath, "ignite", "cmd", "ignite")
)
err = gocmd.BuildPath(ctx, output, binary, path, nil)
if err != nil {
panic(fmt.Sprintf("error while building binary: %v", err))
}

return e
}

func (e Env) T() *testing.T {
Expand Down