Adding `--set ON_ERROR_STOP=1` to `pgsql_upgrade` made `pgsql_unused_subnet_id` fail while attempting to upgrade a 4.0 schema with some data to the latest schema.
```
Processing src/share/database/scripts/pgsql/upgrade_003.3_to_004.0.sh file...
Schema upgraded to 4.0
NOTICE: index "key_dhcp4_ipv4_address_subnet_id" does not exist, skipping
ERROR: insert or update on table "dhcp6_options" violates foreign key constraint "fk_dhcp6_options_subnet"
DETAIL: Key (dhcp6_subnet_id)=(6) is not present in table "dhcp6_subnet".
```
The test is not trying to cover a negative scenario as far as I can tell.
It seems that in the end, the schema ended up being upgraded to the target version of the last script that worked without errors, in this case 7.0. It tried to advance to other upgrade scripts, but skipped them because of versions mismatch.
```
Processing src/share/database/scripts/pgsql/upgrade_007_to_008.sh file...
Processing src/share/database/scripts/pgsql/upgrade_008_to_009.sh file...
This script upgrades 8.0 to 9.0. Reported version is 7.0. Skipping upgrade.
[...]
Processing src/share/database/scripts/pgsql/upgrade_023_to_024.sh file...
This script upgrades 23.0 to 24.0. Reported version is 7.0. Skipping upgrade.
Schema version reported after upgrade: 7.0
```
Previously, the error was not reported by the testing framework because it was also ignored by kea-admin.
Now, it is consistent with the MySQL behavior in kea-admin and it no longer ignores upgrade errors.
You can see the same upgrade done to a prior version done in the equivalent test `mysql_unused_subnet_id_test`.
- Remove unnecessary `SET PASSWORD` for mysql
- Remove redundant `sysrc postgresql_enable=yes`. It is done later when
enabling the service.
- Determine `/var/db/postgres/data*` using glob.
- Add `interactive=true` to onestart command.
/src/lib/dhcp/libdhcp++.cc
LibDHCP::unpackOptions4()
LibDHCP::unpackOptions6() - split out throw so we can emit
a more helpful log on parser errors
/src/lib/dhcp/option.h
Added OptionParseError exception
/src/lib/dhcp/option_custom.cc
OptionCustom::bufferLength()
- add throw of SkipThisOptionError if lenient parsing enabled
for OPT_FQDN_TYPE errors
/src/lib/dhcp/option_definition.cc
OptionDefinition::factoryFqdnList()
- add throw of SkipThisOptionError if lenient parsing enabled
/src/lib/dhcp/tests/libdhcp++_unittest.cc
TEST_F(LibDhcpTest, unpackOptions4LenientFqdn)
TEST_F(LibDhcpTest, unpackOptions6LenientFqdn) - new tests
/src/lib/dhcp/tests/option_custom_unittest.cc
TEST_F(OptionCustomTest, fqdnData) - check lenient parsing behavior