From a5eaabf5485032cd0458fbcf89c1a66ceb38917e Mon Sep 17 00:00:00 2001 From: Chris Geihsler Date: Wed, 14 Dec 2022 11:54:47 +0200 Subject: [PATCH] multi: add sqlite option to itests and github job --- .github/workflows/main.yml | 5 +++++ .github/workflows/release.yaml | 2 +- .golangci.yml | 1 + lntemp/harness_setup.go | 3 +++ lntemp/node/config.go | 5 +++++ lntest/harness_node.go | 5 +++++ lntest/itest/lnd_test.go | 3 +++ lntest/itest/temp_lnd_test.go | 2 +- lntest/test_common.go | 1 + lntest/timeouts.go | 4 ++++ lntest/timeouts_darwin.go | 4 ++++ lntest/timeouts_remote_db.go | 4 ++++ 12 files changed, 37 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ad6e0d068..07d92f0d8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -158,6 +158,7 @@ jobs: - btcd unit-cover - unit tags="kvdb_etcd" - unit tags="kvdb_postgres" + - unit tags="kvdb_sqlite" - btcd unit-race steps: - name: git checkout @@ -204,6 +205,8 @@ jobs: args: backend=bitcoind dbbackend=etcd - name: bitcoind-postgres args: backend=bitcoind dbbackend=postgres + - name: bitcoind-sqlite + args: backend=bitcoind dbbackend=sqlite - name: neutrino args: backend=neutrino steps: @@ -287,6 +290,8 @@ jobs: args: backend=bitcoind dbbackend=etcd - name: bitcoind-postgres args: backend=bitcoind dbbackend=postgres + - name: bitcoind-sqlite + args: backend=bitcoind dbbackend=sqlite - name: neutrino args: backend=neutrino steps: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 92a8f074a..be7c7b6b4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -94,7 +94,7 @@ jobs: Our release binaries are fully reproducible. Third parties are able to verify that the release binaries were produced properly without having to trust the release manager(s). See our [reproducible builds guide](https://github.com/lightningnetwork/lnd/tree/master/build/release) for how this can be achieved. The release binaries are compiled with `go${{ env.GO_VERSION }}`, which is required by verifiers to arrive at the same ones. - They include the following build tags: `autopilotrpc`, `signrpc`, `walletrpc`, `chainrpc`, `invoicesrpc`, `neutrinorpc`, `routerrpc`, `watchtowerrpc`, `monitoring`, `peersrpc`, `kvdb_postrgres`, and `kvdb_etcd`. Note that these are already included in the release script, so they do not need to be provided. + They include the following build tags: `autopilotrpc`, `signrpc`, `walletrpc`, `chainrpc`, `invoicesrpc`, `neutrinorpc`, `routerrpc`, `watchtowerrpc`, `monitoring`, `peersrpc`, `kvdb_postrgres`, `kvdb_etcd` and `kvdb_sqlite`. Note that these are already included in the release script, so they do not need to be provided. The `make release` command can be used to ensure one rebuilds with all the same flags used for the release. If one wishes to build for only a single platform, then `make release sys= tag=` can be used. diff --git a/.golangci.yml b/.golangci.yml index 40dca985e..5629e199e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -24,6 +24,7 @@ run: - watchtowerrpc - kvdb_etcd - kvdb_postgres + - kvdb_sqlite linters-settings: govet: diff --git a/lntemp/harness_setup.go b/lntemp/harness_setup.go index 4165fe182..8a08c03c3 100644 --- a/lntemp/harness_setup.go +++ b/lntemp/harness_setup.go @@ -109,6 +109,9 @@ func prepareDbBackend(t *testing.T, case "postgres": dbBackend = lntest.BackendPostgres + case "sqlite": + dbBackend = lntest.BackendSqlite + default: require.Fail(t, "unknown db backend") } diff --git a/lntemp/node/config.go b/lntemp/node/config.go index c0f12d70b..0c228fef8 100644 --- a/lntemp/node/config.go +++ b/lntemp/node/config.go @@ -220,6 +220,11 @@ func (cfg *BaseNodeConfig) GenArgs() []string { case lntest.BackendPostgres: args = append(args, "--db.backend=postgres") args = append(args, "--db.postgres.dsn="+cfg.PostgresDsn) + + case lntest.BackendSqlite: + args = append(args, "--db.backend=sqlite") + args = append(args, fmt.Sprintf("--db.sqlite.busytimeout=%v", + lntest.SqliteBusyTimeout)) } if cfg.FeeURL != "" { diff --git a/lntest/harness_node.go b/lntest/harness_node.go index 67cffe1bb..db9ad7fab 100644 --- a/lntest/harness_node.go +++ b/lntest/harness_node.go @@ -278,6 +278,11 @@ func (cfg *BaseNodeConfig) GenArgs() []string { case BackendPostgres: args = append(args, "--db.backend=postgres") args = append(args, "--db.postgres.dsn="+cfg.PostgresDsn) + + case BackendSqlite: + args = append(args, "--db.backend=sqlite") + args = append(args, fmt.Sprintf("--db.sqlite.busytimeout=%v", + SqliteBusyTimeout)) } if cfg.FeeURL != "" { diff --git a/lntest/itest/lnd_test.go b/lntest/itest/lnd_test.go index 00b3efc7a..1f0dbd4cb 100644 --- a/lntest/itest/lnd_test.go +++ b/lntest/itest/lnd_test.go @@ -131,6 +131,9 @@ func TestLightningNetworkDaemon(t *testing.T) { case "postgres": dbBackend = lntest.BackendPostgres + case "sqlite": + dbBackend = lntest.BackendSqlite + default: require.Fail(t, "unknown db backend") } diff --git a/lntest/itest/temp_lnd_test.go b/lntest/itest/temp_lnd_test.go index 40fa8e10a..4b816b93b 100644 --- a/lntest/itest/temp_lnd_test.go +++ b/lntest/itest/temp_lnd_test.go @@ -49,7 +49,7 @@ var ( // dbBackendFlag specifies the backend to use. dbBackendFlag = flag.String("dbbackend", "bbolt", "Database backend "+ - "(bbolt, etcd, postgres)") + "(bbolt, etcd, postgres, sqlite)") ) // TestLightningNetworkDaemonTemp performs a series of integration tests diff --git a/lntest/test_common.go b/lntest/test_common.go index 35adf6604..1cab0ad5c 100644 --- a/lntest/test_common.go +++ b/lntest/test_common.go @@ -33,6 +33,7 @@ const ( BackendBbolt DatabaseBackend = iota BackendEtcd BackendPostgres + BackendSqlite ) var ( diff --git a/lntest/timeouts.go b/lntest/timeouts.go index 4ad2d6653..34418d4b5 100644 --- a/lntest/timeouts.go +++ b/lntest/timeouts.go @@ -29,4 +29,8 @@ const ( // NodeStartTimeout is the timeout value when waiting for a node to // become fully started. NodeStartTimeout = time.Second * 120 + + // SqliteBusyTimeout is the maximum time that a call to the sqlite db + // will wait for the connection to become available. + SqliteBusyTimeout = time.Second * 10 ) diff --git a/lntest/timeouts_darwin.go b/lntest/timeouts_darwin.go index b07559b39..3d61e3b0a 100644 --- a/lntest/timeouts_darwin.go +++ b/lntest/timeouts_darwin.go @@ -30,4 +30,8 @@ const ( // NodeStartTimeout is the timeout value when waiting for a node to // become fully started. NodeStartTimeout = time.Second * 120 + + // SqliteBusyTimeout is the maximum time that a call to the sqlite db + // will wait for the connection to become available. + SqliteBusyTimeout = time.Second * 10 ) diff --git a/lntest/timeouts_remote_db.go b/lntest/timeouts_remote_db.go index 4e563c6f4..300a8cf1c 100644 --- a/lntest/timeouts_remote_db.go +++ b/lntest/timeouts_remote_db.go @@ -29,4 +29,8 @@ const ( // NodeStartTimeout is the timeout value when waiting for a node to // become fully started. NodeStartTimeout = time.Second * 120 + + // SqliteBusyTimeout is the maximum time that a call to the sqlite db + // will wait for the connection to become available. + SqliteBusyTimeout = time.Second * 10 )