fix(interop): use standaloneTransports as string instead of param (#219)
* fix(interop): use standaloneTransports as string instead of param When generating the test specification (docker-compose file) we enumerate all transport permutations. While some of our transports need to be upgraded (e.g. TCP and WS) some don't (e.g. QUIC or WebRTC). To differentiate the two we execute two SQL queries (`queryResults` and `standaloneTransportsQueryResults`), each with either a `AND _ NOT IN` or `AND _ IN`. The previous implementation would use `node-sqlite3` query parameters (see https://github.com/TryGhost/node-sqlite3/wiki/API#runsql--param---callback) to provide the list of transport protocols that don't need upgrading as an array. The problem is that `node-sqlite3` does not support arrays as query parameters, see https://github.com/TryGhost/node-sqlite3/issues/762. This commit uses string interpolation instead to inject the list of standalone transports into the SQL queries. * Nit --------- Co-authored-by: Marco Munizaga <git@marcopolo.io> Co-authored-by: Marco Munizaga <marco@marcopolo.io>
This commit is contained in:
parent
ec32d36cab
commit
465065cff8
|
@ -54,7 +54,7 @@ export async function buildTestSpecs(versions: Array<Version>, nameFilter: strin
|
|||
// Generate the testing combinations by SELECT'ing from both transports
|
||||
// and muxers tables the distinct combinations where the transport and the muxer
|
||||
// of the different libp2p implementations match.
|
||||
const standaloneTransports = ["quic", "quic-v1", "webtransport", "webrtc", "webrtc-direct"]
|
||||
const standaloneTransports = ["quic", "quic-v1", "webtransport", "webrtc", "webrtc-direct"].map(x => `"${x}"`).join(", ")
|
||||
const queryResults =
|
||||
await db.all(`SELECT DISTINCT a.id as id1, b.id as id2, a.transport, ma.muxer, sa.sec
|
||||
FROM transports a, transports b, muxers ma, muxers mb, secureChannels sa, secureChannels sb
|
||||
|
@ -67,14 +67,14 @@ export async function buildTestSpecs(versions: Array<Version>, nameFilter: strin
|
|||
AND sa.sec == sb.sec
|
||||
AND ma.muxer == mb.muxer
|
||||
-- These transports don't define muxers/securechannels
|
||||
AND a.transport NOT IN ($standaloneTransports);`, { $standaloneTransports: standaloneTransports });
|
||||
AND a.transport NOT IN (${standaloneTransports});`);
|
||||
const standaloneTransportsQueryResults =
|
||||
await db.all(`SELECT DISTINCT a.id as id1, b.id as id2, a.transport
|
||||
FROM transports a, transports b
|
||||
WHERE a.transport == b.transport
|
||||
AND NOT b.onlyDial
|
||||
-- These transports don't define muxers/securechannels
|
||||
AND a.transport IN ($standaloneTransports);`, { $standaloneTransports: standaloneTransports });
|
||||
AND a.transport IN (${standaloneTransports});`);
|
||||
await db.close();
|
||||
|
||||
const testSpecs = queryResults.map((test): ComposeSpecification => (
|
||||
|
|
Loading…
Reference in New Issue