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

Rafilx/test ci #53

Closed
wants to merge 12 commits into from
Closed
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: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ test:
go test -race ./...

test-e2e:
cd $(TOOLS_DIR); go install -trimpath $(BABYLON_PKG);
go test -race -mod=readonly -timeout=25m -v $(PACKAGES_E2E) -count=1 --tags=e2e
go test -race -mod=readonly --failfast -timeout=25m -v $(PACKAGES_E2E) -count=1 --tags=e2e

build-docker:
$(DOCKER) build --tag babylonlabs-io/vigilante -f Dockerfile \
Expand Down
214 changes: 0 additions & 214 deletions e2etest/babylon_node_handler.go

This file was deleted.

16 changes: 10 additions & 6 deletions e2etest/bitcoind_node_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"github.com/babylonlabs-io/vigilante/e2etest/container"
"github.com/ory/dockertest/v3"
"github.com/stretchr/testify/require"
"os"
"strconv"
Expand Down Expand Up @@ -33,25 +34,22 @@ type BitcoindTestHandler struct {
m *container.Manager
}

func NewBitcoindHandler(t *testing.T) *BitcoindTestHandler {
manager, err := container.NewManager()
require.NoError(t, err)

func NewBitcoindHandler(t *testing.T, manager *container.Manager) *BitcoindTestHandler {
return &BitcoindTestHandler{
t: t,
m: manager,
}
}

func (h *BitcoindTestHandler) Start() {
func (h *BitcoindTestHandler) Start(t *testing.T) *dockertest.Resource {
tempPath, err := os.MkdirTemp("", "vigilante-test-*")
require.NoError(h.t, err)

h.t.Cleanup(func() {
_ = os.RemoveAll(tempPath)
})

_, err = h.m.RunBitcoindResource(tempPath)
bitcoinResource, err := h.m.RunBitcoindResource(t, tempPath)
require.NoError(h.t, err)

h.t.Cleanup(func() {
Expand All @@ -65,6 +63,8 @@ func (h *BitcoindTestHandler) Start() {
}
return err == nil
}, startTimeout, 500*time.Millisecond, "bitcoind did not start")

return bitcoinResource
}

// GetBlockCount retrieves the current number of blocks in the blockchain from the Bitcoind.
Expand Down Expand Up @@ -115,3 +115,7 @@ func (h *BitcoindTestHandler) ImportDescriptors(descriptor string) {
_, _, err := h.m.ExecBitcoindCliCmd(h.t, []string{"importdescriptors", descriptor})
require.NoError(h.t, err)
}

func (h *BitcoindTestHandler) Stop() {
_ = h.m.ClearResources()
}
9 changes: 7 additions & 2 deletions e2etest/container/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@ package container
type ImageConfig struct {
BitcoindRepository string
BitcoindVersion string
BabylonRepository string
BabylonVersion string
}

//nolint:deadcode
const (
dockerBitcoindRepository = "lncm/bitcoind"
dockerBitcoindVersionTag = "v27.0"
dockerBabylondRepository = "babylonlabs/babylond"
dockerBabylondVersionTag = "8e0222804ed19b18d74d599b80baa18f05e87d8a" // this is built from commit b1e255a
)

// NewImageConfig returns ImageConfig needed for running e2e test.
func NewImageConfig() ImageConfig {
config := ImageConfig{
return ImageConfig{
BitcoindRepository: dockerBitcoindRepository,
BitcoindVersion: dockerBitcoindVersionTag,
BabylonRepository: dockerBabylondRepository,
BabylonVersion: dockerBabylondVersionTag,
}
return config
}
Loading
Loading