Skip to content

Commit 3fc6555

Browse files
committed
itest: copy integration test framework from lnd
1 parent 2ca94d2 commit 3fc6555

File tree

12 files changed

+3558
-1
lines changed

12 files changed

+3558
-1
lines changed

.github/workflows/main.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,51 @@ jobs:
171171

172172
- name: compile rpc for golang
173173
run: make rpc
174+
175+
itest:
176+
name: integration test
177+
runs-on: ubuntu-latest
178+
steps:
179+
- name: set git config
180+
run: |
181+
git config --global core.eol lf
182+
git config --global core.autocrlf false
183+
184+
- name: git checkout
185+
uses: actions/checkout@v2
186+
187+
- name: setup nodejs v${{ matrix.node_version }}
188+
uses: actions/setup-node@v1
189+
with:
190+
node-version: 12.x
191+
192+
- name: download cache
193+
uses: actions/cache@v1
194+
with:
195+
path: /home/runner/work/download_cache
196+
key: lnd-${{ runner.os }}-download-${{ hashFiles('**/install_protoc.sh') }}
197+
restore-keys: |
198+
lnd-${{ runner.os }}-download-${{ hashFiles('**/install_protoc.sh') }}
199+
lnd-${{ runner.os }}-download-
200+
201+
- name: get yarn cache dir
202+
id: yarn-cache-dir
203+
run: echo "::set-output name=dir::$(yarn cache dir)"
204+
205+
- name: yarn cache
206+
uses: actions/cache@v2
207+
id: yarn-cache
208+
with:
209+
path: ${{ steps.yarn-cache-dir.outputs.dir }}
210+
key: ${{ runner.os }}-yarn-${{ matrix.node_version }}-${{ hashFiles('**/yarn.lock') }}
211+
restore-keys: |
212+
${{ runner.os }}-yarn-${{ matrix.node_version }}-${{ hashFiles('**/yarn.lock') }}
213+
${{ runner.os }}-yarn-${{ matrix.node_version }}-
214+
${{ runner.os }}-yarn-
215+
216+
- name: install dependencies
217+
working-directory: ./app
218+
run: yarn
219+
220+
- name: run check
221+
run: make itest

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,10 @@ litcli-debug
66
/lightning-terminal-*
77

88
# MacOS junk
9-
.DS_Store
9+
.DS_Store
10+
11+
itest/btcd-itest
12+
itest/litd-itest
13+
itest/itest.test
14+
itest/.logs
15+
itest/*.log

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ESCPKG := github.com\/lightninglabs\/lightning-terminal
33
LND_PKG := github.com/lightningnetwork/lnd
44
LOOP_PKG := github.com/lightninglabs/loop
55
POOL_PKG := github.com/lightninglabs/pool
6+
BTCD_PKG := github.com/btcsuite/btcd
67

78
LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint
89
GOVERALLS_PKG := github.com/mattn/goveralls
@@ -68,6 +69,9 @@ LDFLAGS := $(call make_ldflags, $(LND_RELEASE_TAGS))
6869
# and omit the DWARF symbol table (-w). Also we clear the build ID.
6970
RELEASE_LDFLAGS := $(call make_ldflags, $(LND_RELEASE_TAGS), -s -w -buildid=)
7071

72+
ITEST_TAGS := rpctest itest $(LND_RELEASE_TAGS)
73+
ITEST_LDFLAGS := $(call make_ldflags, $(ITEST_TAGS))
74+
7175
GREEN := "\\033[0;32m"
7276
NC := "\\033[0m"
7377
define print
@@ -160,6 +164,20 @@ travis-cover: lint unit-cover goveralls
160164

161165
travis-itest: lint
162166

167+
build-itest: app-build
168+
@$(call print, "Building itest btcd and litd.")
169+
CGO_ENABLED=0 $(GOBUILD) -tags="$(ITEST_TAGS)" -o itest/btcd-itest -ldflags "$(ITEST_LDFLAGS)" $(BTCD_PKG)
170+
171+
itest-only:
172+
@$(call print, "Building itest binary.")
173+
CGO_ENABLED=0 $(GOBUILD) -tags="$(ITEST_TAGS)" -o itest/litd-itest -ldflags "$(ITEST_LDFLAGS)" $(PKG)/cmd/litd
174+
CGO_ENABLED=0 $(GOTEST) -v ./itest -tags="$(DEV_TAGS) $(ITEST_TAGS)" -c -o itest/itest.test
175+
176+
@$(call print, "Running integration tests.")
177+
rm -rf itest/*.log itest/.logs*; date
178+
scripts/itest_part.sh $(ITEST_FLAGS)
179+
180+
itest: build-itest itest-only
163181

164182
# =============
165183
# FLAKE HUNTING

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ require (
55
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
66
github.com/btcsuite/btcutil v1.0.3-0.20210527170813-e2ba6805a890
77
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
8+
github.com/go-errors/errors v1.0.1
89
github.com/grpc-ecosystem/grpc-gateway/v2 v2.5.0
910
github.com/improbable-eng/grpc-web v0.12.0
1011
github.com/jessevdk/go-flags v1.4.0
@@ -23,6 +24,7 @@ require (
2324
github.com/urfave/cli v1.20.0
2425
go.etcd.io/bbolt v1.3.6
2526
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
27+
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
2628
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1
2729
google.golang.org/grpc v1.39.0
2830
google.golang.org/protobuf v1.27.1

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ github.com/jackc/pgx/v4 v4.13.0 h1:JCjhT5vmhMAf/YwBHLvrBn4OGdIQBiFG6ym8Zmdx570=
426426
github.com/jackc/pgx/v4 v4.13.0/go.mod h1:9P4X524sErlaxj0XSGZk7s+LD0eOyu1ZDUrrpznYDF0=
427427
github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
428428
github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
429+
github.com/jackc/puddle v1.1.3 h1:JnPg/5Q9xVJGfjsO5CPUOjnJps1JaRUm8I9FXVCFK94=
429430
github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
430431
github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc=
431432
github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA=

0 commit comments

Comments
 (0)