summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Pavel <andrei@isc.org>2024-07-17 09:28:51 +0200
committerThomas Markwalder <tmark@isc.org>2024-07-18 17:18:26 +0200
commite3f91d94f5cfd8430844c38352b8915119b9bea4 (patch)
treed24e007e2610ce55b459fb727f94ff960eea78e9
parent[#3476] Added ChangeLog entry (diff)
downloadkea-e3f91d94f5cfd8430844c38352b8915119b9bea4.tar.xz
kea-e3f91d94f5cfd8430844c38352b8915119b9bea4.zip
[#3476] minor changes
-rw-r--r--src/bin/admin/tests/mysql_tests.sh.in20
-rw-r--r--src/bin/admin/tests/pgsql_tests.sh.in20
-rw-r--r--src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc6
-rw-r--r--src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc6
-rw-r--r--src/share/database/scripts/mysql/dhcpdb_create.mysql4
-rw-r--r--src/share/database/scripts/mysql/upgrade_023_to_024.sh.in4
-rw-r--r--src/share/database/scripts/pgsql/dhcpdb_create.pgsql6
-rw-r--r--src/share/database/scripts/pgsql/upgrade_023_to_024.sh.in4
8 files changed, 36 insertions, 34 deletions
diff --git a/src/bin/admin/tests/mysql_tests.sh.in b/src/bin/admin/tests/mysql_tests.sh.in
index a578793749..304933bcde 100644
--- a/src/bin/admin/tests/mysql_tests.sh.in
+++ b/src/bin/admin/tests/mysql_tests.sh.in
@@ -822,7 +822,7 @@ mysql_upgrade_22_to_23_test() {
}
mysql_upgrade_23_to_24_test() {
- query="SELECT count(id) from option_def_data_type"
+ query="SELECT COUNT(id) FROM option_def_data_type"
run_command \
mysql_execute "${query}"
assert_eq 0 "${EXIT_CODE}" "${query}: expected %d, returned %d"
@@ -3349,7 +3349,7 @@ mysql_migrate_opt_record_type() {
insert into dhcp6_option_def (code,name,space,type,modification_ts,record_types, is_array, encapsulate)\
values ('224','bar2','dhcp6',18,current_timestamp,'10, 7, 2, 14', false, false);
"
- run_statement "insert otion definitions" "$sql"
+ run_statement "insert option definitions" "$sql"
# Verify the inserted record counts.
qry="select count(*) from dhcp4_option_def;"
@@ -3362,22 +3362,22 @@ mysql_migrate_opt_record_type() {
mysql_upgrade_schema_to_version 24.0
# Verify the migrated records.
- qry="select type from dhcp4_option_def where name = 'foo';"
+ qry="select type from dhcp4_option_def where name = 'foo';"
run_statement "#get 4_option_def_foo after update" "$qry" 17
- qry="select type from dhcp4_option_def where name = 'bar';"
- run_statement "#get 4_option_def_bar after update" "$qry" 254
+ qry="select type from dhcp4_option_def where name = 'bar';"
+ run_statement "#get 4_option_def_bar after update" "$qry" 254
- qry="select type from dhcp4_option_def where name = 'bar2';"
+ qry="select type from dhcp4_option_def where name = 'bar2';"
run_statement "#get 4_option_def_bar2 after update" "$qry" 254
- qry="select type from dhcp6_option_def where name = 'foo';"
+ qry="select type from dhcp6_option_def where name = 'foo';"
run_statement "#get 6_option_def_foo after update" "$qry" 17
- qry="select type from dhcp6_option_def where name = 'bar';"
- run_statement "#get 6_option_def_bar after update" "$qry" 254
+ qry="select type from dhcp6_option_def where name = 'bar';"
+ run_statement "#get 6_option_def_bar after update" "$qry" 254
- qry="select type from dhcp6_option_def where name = 'bar2';"
+ qry="select type from dhcp6_option_def where name = 'bar2';"
run_statement "#get 6_option_def_bar2 after update" "$qry" 254
# Let's wipe the whole database
diff --git a/src/bin/admin/tests/pgsql_tests.sh.in b/src/bin/admin/tests/pgsql_tests.sh.in
index d4f6cbfe9b..e5c0de51af 100644
--- a/src/bin/admin/tests/pgsql_tests.sh.in
+++ b/src/bin/admin/tests/pgsql_tests.sh.in
@@ -918,7 +918,7 @@ pgsql_upgrade_22_to_23_test() {
}
pgsql_upgrade_23_to_24_test() {
- query="SELECT count(id) from option_def_data_type"
+ query="SELECT COUNT(id) FROM option_def_data_type"
run_command \
pgsql_execute "${query}"
assert_eq 0 "${EXIT_CODE}" "${query}: expected %d, returned %d"
@@ -2610,7 +2610,7 @@ pgsql_migrate_opt_record_type() {
insert into dhcp6_option_def (code,name,space,type,modification_ts,record_types, is_array, encapsulate)\
values ('224','bar2','dhcp6',18,current_timestamp,'10, 7, 2, 14', false, false);
"
- run_statement "insert otion definitions" "$sql"
+ run_statement "insert option definitions" "$sql"
# Verify the inserted record counts.
qry="select count(*) from dhcp4_option_def;"
@@ -2623,22 +2623,22 @@ pgsql_migrate_opt_record_type() {
pgsql_upgrade_schema_to_version 24.0
# Verify the migrated records.
- qry="select type from dhcp4_option_def where name = 'foo';"
+ qry="select type from dhcp4_option_def where name = 'foo';"
run_statement "#get 4_option_def_foo after update" "$qry" 17
- qry="select type from dhcp4_option_def where name = 'bar';"
- run_statement "#get 4_option_def_bar after update" "$qry" 254
+ qry="select type from dhcp4_option_def where name = 'bar';"
+ run_statement "#get 4_option_def_bar after update" "$qry" 254
- qry="select type from dhcp4_option_def where name = 'bar2';"
+ qry="select type from dhcp4_option_def where name = 'bar2';"
run_statement "#get 4_option_def_bar2 after update" "$qry" 254
- qry="select type from dhcp6_option_def where name = 'foo';"
+ qry="select type from dhcp6_option_def where name = 'foo';"
run_statement "#get 6_option_def_foo after update" "$qry" 17
- qry="select type from dhcp6_option_def where name = 'bar';"
- run_statement "#get 6_option_def_bar after update" "$qry" 254
+ qry="select type from dhcp6_option_def where name = 'bar';"
+ run_statement "#get 6_option_def_bar after update" "$qry" 254
- qry="select type from dhcp6_option_def where name = 'bar2';"
+ qry="select type from dhcp6_option_def where name = 'bar2';"
run_statement "#get 6_option_def_bar2 after update" "$qry" 254
# Let's wipe the whole database
diff --git a/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc b/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc
index 51569d798c..c95b70f900 100644
--- a/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc
+++ b/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc
@@ -3068,9 +3068,9 @@ void
GenericConfigBackendDHCPv4Test::invalidOptionDefDataType4Test() {
OptionDefinitionPtr test_def;
ASSERT_NO_THROW_LOG(test_def.reset(new OptionDefinition("foobar", 234, DHCP4_OPTION_SPACE,
- "unknown", true)));
+ "unknown", true)));
ASSERT_TRUE(test_def);
- ASSERT_THROW(cbptr_->createUpdateOptionDef4(ServerSelector::ALL(), test_def),
+ ASSERT_THROW(cbptr_->createUpdateOptionDef4(ServerSelector::ALL(), test_def),
DbOperationError);
}
@@ -3160,7 +3160,7 @@ GenericConfigBackendDHCPv4Test::allOptionDefDataTypes4Test() {
ASSERT_NO_THROW_LOG(parser.parse(storage, defs_elem));
auto test_defs = storage->getAll("dhcp4");
- ASSERT_EQ(test_defs->size(), 18);
+ ASSERT_EQ(test_defs->size(), 18);
// Insert each option definition into the database.
for (auto const& test_def : *test_defs) {
diff --git a/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc b/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc
index cd18e8b1db..dd2dbfc36f 100644
--- a/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc
+++ b/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc
@@ -3094,9 +3094,9 @@ void
GenericConfigBackendDHCPv6Test::invalidOptionDefDataType6Test() {
OptionDefinitionPtr test_def;
ASSERT_NO_THROW_LOG(test_def.reset(new OptionDefinition("foobar", 234, DHCP6_OPTION_SPACE,
- "unknown", true)));
+ "unknown", true)));
ASSERT_TRUE(test_def);
- ASSERT_THROW(cbptr_->createUpdateOptionDef6(ServerSelector::ALL(), test_def),
+ ASSERT_THROW(cbptr_->createUpdateOptionDef6(ServerSelector::ALL(), test_def),
DbOperationError);
}
@@ -3186,7 +3186,7 @@ GenericConfigBackendDHCPv6Test::allOptionDefDataTypes6Test() {
ASSERT_NO_THROW_LOG(parser.parse(storage, defs_elem));
auto test_defs = storage->getAll("dhcp6");
- ASSERT_EQ(test_defs->size(), 18);
+ ASSERT_EQ(test_defs->size(), 18);
// Insert each option definition into the database.
for (auto const& test_def : *test_defs) {
diff --git a/src/share/database/scripts/mysql/dhcpdb_create.mysql b/src/share/database/scripts/mysql/dhcpdb_create.mysql
index 2070e0cce9..edc754074b 100644
--- a/src/share/database/scripts/mysql/dhcpdb_create.mysql
+++ b/src/share/database/scripts/mysql/dhcpdb_create.mysql
@@ -5939,7 +5939,7 @@ BEGIN
DECLARE skipper TINYINT;
SELECT COUNT(table_name) FROM information_schema.tables
- WHERE table_schema LIKE database() AND table_name = 'option_def_data_type' into skipper;
+ WHERE table_schema LIKE database() AND table_name = 'option_def_data_type' INTO skipper;
IF skipper = 0 THEN
-- First we migrate existing OPT_RECORD_TYPE values
@@ -5988,7 +5988,7 @@ BEGIN
END $$
DELIMITER ;
-call updateOptionDataDef();
+CALL updateOptionDataDef();
-- Get rid of the now obsolete function.
DROP PROCEDURE IF EXISTS updateOptionDataDef;
diff --git a/src/share/database/scripts/mysql/upgrade_023_to_024.sh.in b/src/share/database/scripts/mysql/upgrade_023_to_024.sh.in
index 37b34aa6ed..bdd0839d45 100644
--- a/src/share/database/scripts/mysql/upgrade_023_to_024.sh.in
+++ b/src/share/database/scripts/mysql/upgrade_023_to_024.sh.in
@@ -66,7 +66,7 @@ BEGIN
DECLARE skipper TINYINT;
SELECT COUNT(table_name) FROM information_schema.tables
- WHERE table_schema LIKE database() AND table_name = 'option_def_data_type' into skipper;
+ WHERE table_schema LIKE database() AND table_name = 'option_def_data_type' INTO skipper;
IF skipper = 0 THEN
-- First we migrate existing OPT_RECORD_TYPE values
@@ -115,7 +115,7 @@ BEGIN
END $$
DELIMITER ;
-call updateOptionDataDef();
+CALL updateOptionDataDef();
-- Get rid of the now obsolete function.
DROP PROCEDURE IF EXISTS updateOptionDataDef;
diff --git a/src/share/database/scripts/pgsql/dhcpdb_create.pgsql b/src/share/database/scripts/pgsql/dhcpdb_create.pgsql
index a3c716eae2..46e3ad6dc4 100644
--- a/src/share/database/scripts/pgsql/dhcpdb_create.pgsql
+++ b/src/share/database/scripts/pgsql/dhcpdb_create.pgsql
@@ -6387,6 +6387,8 @@ INSERT INTO lease_state VALUES (3, 'released');
UPDATE schema_version
SET version = '23', minor = '0';
+-- This line concludes the schema upgrade to version 23.0.
+
-- This line starts the schema upgrade to version 24.0.
-- Create a function to conditionally migrate option_def data type
@@ -6396,7 +6398,7 @@ DROP FUNCTION IF EXISTS updateOptionDataDef();
CREATE OR REPLACE FUNCTION updateOptionDataDef() RETURNS text AS $$
DECLARE skipper BOOLEAN;
BEGIN
- SELECT exists(SELECT FROM pg_tables WHERE tablename = 'option_def_data_type') into skipper;
+ SELECT exists(SELECT FROM pg_tables WHERE tablename = 'option_def_data_type') INTO skipper;
IF skipper THEN
-- Table already exists which means the migration was already done.
RETURN 'EXISTS';
@@ -6447,7 +6449,7 @@ BEGIN
END;
$$ LANGUAGE plpgsql;
-select updateOptionDataDef();
+SELECT updateOptionDataDef();
-- Get rid of the now obsolete function.
DROP FUNCTION IF EXISTS updateOptionDataDef();
diff --git a/src/share/database/scripts/pgsql/upgrade_023_to_024.sh.in b/src/share/database/scripts/pgsql/upgrade_023_to_024.sh.in
index ce169aadc3..a67cb9ecff 100644
--- a/src/share/database/scripts/pgsql/upgrade_023_to_024.sh.in
+++ b/src/share/database/scripts/pgsql/upgrade_023_to_024.sh.in
@@ -46,7 +46,7 @@ DROP FUNCTION IF EXISTS updateOptionDataDef();
CREATE OR REPLACE FUNCTION updateOptionDataDef() RETURNS text AS \$\$
DECLARE skipper BOOLEAN;
BEGIN
- SELECT exists(SELECT FROM pg_tables WHERE tablename = 'option_def_data_type') into skipper;
+ SELECT exists(SELECT FROM pg_tables WHERE tablename = 'option_def_data_type') INTO skipper;
IF skipper THEN
-- Table already exists which means the migration was already done.
RETURN 'EXISTS';
@@ -97,7 +97,7 @@ BEGIN
END;
\$\$ LANGUAGE plpgsql;
-select updateOptionDataDef();
+SELECT updateOptionDataDef();
-- Get rid of the now obsolete function.
DROP FUNCTION IF EXISTS updateOptionDataDef();