mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-21 06:06:20 +02:00
sqldb+config: validate maximum batch size config value
Now that the SQL query config values are configurable, we add some validation to make sure that the user doesnt set a max batch size that is larger than the limits for sqlite/postgres that have been determined by the TestSQLSliceQueries test.
This commit is contained in:
@@ -281,11 +281,17 @@ func TestSQLSliceQueries(t *testing.T) {
|
||||
break
|
||||
}
|
||||
|
||||
x *= 10
|
||||
// If it succeeded, we expect it to be under the maximum that
|
||||
// we expect for this DB.
|
||||
if isSQLite {
|
||||
require.LessOrEqual(t, x, maxSQLiteBatchSize,
|
||||
"SQLite should not exceed 32766 parameters")
|
||||
} else {
|
||||
require.LessOrEqual(t, x, maxPostgresBatchSize,
|
||||
"Postgres should not exceed 65535 parameters")
|
||||
}
|
||||
|
||||
// Just to make sure that the test doesn't carry on too long,
|
||||
// we assert that we don't exceed a reasonable limit.
|
||||
require.LessOrEqual(t, x, 100000)
|
||||
x *= 10
|
||||
}
|
||||
|
||||
// Now that we have found the limit that the raw query can handle, we
|
||||
|
Reference in New Issue
Block a user