Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Commit

Permalink
lndsigner: add integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aakselrod committed Jan 26, 2023
1 parent 3db6b09 commit c8b2d67
Show file tree
Hide file tree
Showing 11 changed files with 1,469 additions and 2 deletions.
31 changes: 30 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,33 @@ jobs:
uses: actions/checkout@v3

- name: Run unit tests
run: go test -race -cover ./...
run: go test -v -race -cover ./...

integration-test:
runs-on: ubuntu-latest
container: golang:1.19

steps:
- name: Check out repository code
uses: actions/checkout@v3

- name: Install our binaries
run: go install ./cmd/...

- name: Install (un)zip
run: apt update && apt-get install -y zip

- name: Install dependencies
run: cd .. &&
wget https://bitcoincore.org/bin/bitcoin-core-24.0.1/bitcoin-24.0.1-x86_64-linux-gnu.tar.gz &&
tar xfz bitcoin-24.0.1-x86_64-linux-gnu.tar.gz &&
mv bitcoin-24.0.1/bin/* /usr/local/bin/ &&
wget https://github.com/lightningnetwork/lnd/releases/download/v0.15.5-beta/lnd-linux-amd64-v0.15.5-beta.tar.gz &&
tar xfz lnd-linux-amd64-v0.15.5-beta.tar.gz &&
mv lnd-linux-amd64-v0.15.5-beta/* /usr/local/bin/ &&
wget https://releases.hashicorp.com/vault/1.12.2/vault_1.12.2_linux_amd64.zip &&
unzip vault_1.12.2_linux_amd64.zip &&
mv vault /usr/local/bin/

- name: Run integration tests
run: go test -v -race -tags="itest" -cover .
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- [x] sign messages for network announcements
- [x] derive shared keys for peer connections
- [x] sign PSBTs for on-chain transactions, channel openings/closes, HTLC updates, etc.
- [ ] run itests
- [x] run itests
- [ ] do automated builds
- [ ] do reproducible builds
- [ ] perform musig2 ops
Expand Down Expand Up @@ -159,3 +159,16 @@ node 03c7926302ac72f51ef009dc169561734414b3c6bfd9fb0dc42cac93101c3c25bf
```

Now you can use the imported key as before.

## Testing
You can run the unit tests like so:

```
lndsigner$ go test -v -race -count=1 -cover ./...
```

To run the integration tests, first you need to build the binaries as above. Then use the command:

```
lndsigner$ go test -v -race -count=1 -cover -tags="itest" .
```
37 changes: 37 additions & 0 deletions itest/gen_protos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
#
# Copyright (C) 2015-2022 Lightning Labs and The Lightning Network Developers
# Copyright (C) 2022 Bottlepay and The Lightning Network Developers

set -e

# generate compiles the *.pb.go stubs from the *.proto files.
function generate() {
echo "Generating root gRPC server protos"

PROTOS="walletunlocker.proto"

# For each of the sub-servers, we then generate their protos, but a restricted
# set as they don't yet require REST proxies, or swagger docs.
for file in $PROTOS; do
DIRECTORY=$(dirname "${file}")
echo "Generating protos from ${file}, into ${DIRECTORY}"

# Generate the protos.
protoc -I/usr/local/include -I. \
--go_out . --go_opt paths=source_relative \
--go-grpc_out . --go-grpc_opt paths=source_relative \
"${file}"
done
}

# format formats the *.proto files with the clang-format utility.
function format() {
find . -name "*.proto" -print0 | xargs -0 clang-format --style=file -i
}

# Compile and format the itest package.
pushd itest
format
generate
popd
Loading

0 comments on commit c8b2d67

Please sign in to comment.