Skip to content

Commit

Permalink
[#3631] fixed option_def_data_type int8 entry with id 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Razvan Becheriu committed Oct 28, 2024
1 parent 7dd4146 commit 86c2361
Show file tree
Hide file tree
Showing 6 changed files with 222 additions and 2 deletions.
108 changes: 108 additions & 0 deletions src/bin/admin/tests/mysql_tests.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,108 @@ mysql_upgrade_23_to_24_test() {
mysql_execute "${query}"
assert_eq 0 "${EXIT_CODE}" "${query}: expected %d, returned %d"
assert_str_eq '18' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 0"
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'empty' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 1"
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'binary' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 2"
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'boolean' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 4"
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'int16' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 5"
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'int32' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 6"
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'uint8' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 7"
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'uint16' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 8"
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'uint32' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 10"
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'ipv4-address' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 11"
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'ipv6-address' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 12"
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'ipv6-prefix' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 13"
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'psid' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 14"
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'string' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 15"
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'tuple' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 16"
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'fqdn' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 17"
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'internal' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 254"
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'record' "${OUTPUT}" "${query}: expected output %s, returned %s"
}

mysql_upgrade_24_to_25_test() {
Expand Down Expand Up @@ -855,6 +957,12 @@ mysql_upgrade_25_to_26_test() {
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"

qry="select name from option_def_data_type where id = 3"
run_command \
mysql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'int8' "${OUTPUT}" "${query}: expected output %s, returned %s"
}

mysql_upgrade_test() {
Expand Down
108 changes: 108 additions & 0 deletions src/bin/admin/tests/pgsql_tests.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,108 @@ pgsql_upgrade_23_to_24_test() {
pgsql_execute "${query}"
assert_eq 0 "${EXIT_CODE}" "${query}: expected %d, returned %d"
assert_str_eq '18' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 0"
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'empty' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 1"
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'binary' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 2"
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'boolean' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 4"
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'int16' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 5"
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'int32' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 6"
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'uint8' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 7"
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'uint16' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 8"
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'uint32' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 10"
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'ipv4-address' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 11"
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'ipv6-address' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 12"
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'ipv6-prefix' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 13"
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'psid' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 14"
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'string' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 15"
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'tuple' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 16"
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'fqdn' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 17"
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'internal' "${OUTPUT}" "${query}: expected output %s, returned %s"

qry="select name from option_def_data_type where id = 254"
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'record' "${OUTPUT}" "${query}: expected output %s, returned %s"
}

pgsql_upgrade_24_to_25_test() {
Expand All @@ -948,6 +1050,12 @@ pgsql_upgrade_25_to_26_test() {
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"

qry="select name from option_def_data_type where id = 3"
run_command \
pgsql_execute "${qry}"
assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
assert_str_eq 'int8' "${OUTPUT}" "${query}: expected output %s, returned %s"
}

pgsql_upgrade_test() {
Expand Down
2 changes: 1 addition & 1 deletion src/share/database/scripts/mysql/dhcpdb_create.mysql
Original file line number Diff line number Diff line change
Expand Up @@ -5972,7 +5972,7 @@ BEGIN
(0, 'empty'),
(1, 'binary'),
(2, 'boolean'),
(3, 'int8"'),
(3, 'int8'),
(4, 'int16'),
(5, 'int32'),
(6, 'uint8'),
Expand Down
2 changes: 2 additions & 0 deletions src/share/database/scripts/mysql/upgrade_025_to_026.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ ALTER TABLE dhcp4_options
ALTER TABLE dhcp6_options
ADD COLUMN client_classes LONGTEXT DEFAULT NULL;
UPDATE option_def_data_type SET name='int8' where id = 3;
-- Update the schema version number.
UPDATE schema_version
SET version = '26', minor = '0';
Expand Down
2 changes: 1 addition & 1 deletion src/share/database/scripts/pgsql/dhcpdb_create.pgsql
Original file line number Diff line number Diff line change
Expand Up @@ -6432,7 +6432,7 @@ BEGIN
(0, 'empty'),
(1, 'binary'),
(2, 'boolean'),
(3, 'int8"'),
(3, 'int8'),
(4, 'int16'),
(5, 'int32'),
(6, 'uint8'),
Expand Down
2 changes: 2 additions & 0 deletions src/share/database/scripts/pgsql/upgrade_025_to_026.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ ALTER TABLE dhcp4_options
ALTER TABLE dhcp6_options
ADD COLUMN client_classes TEXT DEFAULT NULL;
UPDATE option_def_data_type SET name='int8' where id = 3;
-- Update the schema version number.
UPDATE schema_version
SET version = '26', minor = '0';
Expand Down

0 comments on commit 86c2361

Please sign in to comment.