]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3476] minor changes
authorAndrei Pavel <andrei@isc.org>
Wed, 17 Jul 2024 07:28:51 +0000 (10:28 +0300)
committerThomas Markwalder <tmark@isc.org>
Thu, 18 Jul 2024 15:18:26 +0000 (11:18 -0400)
src/bin/admin/tests/mysql_tests.sh.in
src/bin/admin/tests/pgsql_tests.sh.in
src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc
src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc
src/share/database/scripts/mysql/dhcpdb_create.mysql
src/share/database/scripts/mysql/upgrade_023_to_024.sh.in
src/share/database/scripts/pgsql/dhcpdb_create.pgsql
src/share/database/scripts/pgsql/upgrade_023_to_024.sh.in

index a57879374936c04b9283be4a4465abc22dac8f90..304933bcded9c852829616994db539988ba729f1 100644 (file)
@@ -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
index d4f6cbfe9b18fe64cb86b4c7300a9d2e443484f0..e5c0de51af955bc8231f4e861ceff33e43dd40c5 100644 (file)
@@ -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
index 51569d798c85030045e5d0277e4b100ae1652a84..c95b70f9001144d72168a21a8c6da44a5abfecd8 100644 (file)
@@ -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) {
index cd18e8b1db8d3522e3340337fb5d03e8e582684f..dd2dbfc36fcb723dbc2a6ba98f1cd9fea69b6abc 100644 (file)
@@ -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) {
index 2070e0cce930967c9cf988b7f1e5a272616b0cdc..edc754074b83e6d6853b0b81d131a163c2b87cd4 100644 (file)
@@ -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;
index 37b34aa6edd6ee1eca63c975edabe1cb423243b5..bdd0839d45e9ebbe9c3f8d8645cbb7035e6a4605 100644 (file)
@@ -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;
index a3c716eae24a7a4bd268ab3b814af8341d89508a..46e3ad6dc49fe8a6f87cce08df4128066a22d28b 100644 (file)
@@ -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();
index ce169aadc33f4cc0f074677164d9690c967b5b60..a67cb9ecffacd328d62f5004854b5f4401235bbe 100644 (file)
@@ -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();