Verified Commit 3116ab4e authored by Andrei Pavel's avatar Andrei Pavel 🐧
Browse files

[#2293] adjust tests for kea-lfc called in kea-admin lease-upload

parent c52f590b
address,hwaddr,client_id,valid_lifetime,expire,subnet_id,fqdn_fwd,fqdn_rev,hostname,state,user_context
0.0.0.10,32:30,33:30,40,1642000000,50,1,1,one.example.com,0,
0.0.0.11,,31:32:33,40,1643210000,50,1,1,,1,{}
0.0.0.12,32:32,,40,1643212345,50,1,1,three&#x2cexample&#x2ccom,2,{"a":1&#x2c"b":"c"}
0.0.0.11,,31:32:33,40,1643210000,50,1,1,,1,{ }
0.0.0.12,32:32,,40,1643212345,50,1,1,three&#x2cexample&#x2ccom,2,{ "a": 1&#x2c "b": "c" }
address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,hwaddr,state,user_context,hwtype,hwaddr_source
::10,32:30,30,1642000000,40,50,1,60,70,1,1,one.example.com,38:30,0,,90,16
::11,,30,1643210000,40,50,1,60,70,1,1,,38:30,1,{},90,1
::12,32:31,30,1643212345,40,50,1,60,70,1,1,three&#x2cexample&#x2ccom,38:30,2,{"a":1&#x2c"b":"c"},90,4
::11,32:31,30,1643210000,40,50,1,60,70,1,1,,38:30,1,{ },90,1
::12,32:32,30,1643212345,40,50,1,60,70,1,1,three&#x2cexample&#x2ccom,38:30,2,{ "a": 1&#x2c "b": "c" },90,4
......@@ -68,10 +68,10 @@ memfile_header_v6() {
# Print data copied from mysql_upgrade_12_to_13_test and pgsql_upgrade_7_0_to_8_0.
# @{
memfile_data_v4() {
printf '0.0.0.10,32:30,33:30,40,1678900000,50,1,1,one&#x2cexample&#x2ccom,0,{ "a": 1&#x2c "b": 2 }'
printf '0.0.0.10,32:30,33:30,40,1678900000,50,1,1,one&#x2cexample&#x2ccom,0,{"a":1&#x2c"b":2}'
}
memfile_data_v6() {
printf '::10,32:30,30,1678900000,40,50,1,60,70,1,1,one&#x2cexample&#x2ccom,38:30,0,{ "a": 1&#x2c "b": 2 },90,16'
printf '::10,32:30,30,1678900000,40,50,1,60,70,1,1,one&#x2cexample&#x2ccom,38:30,0,{"a":1&#x2c"b":2},90,16'
}
# @}
......
......@@ -1049,8 +1049,8 @@ mysql_lease4_dump_test() {
# Insert the reference record
insert_sql="\
insert into lease4 values(10,20,30,40,(SELECT FROM_UNIXTIME(1642000000)),50,1,1,'one.example.com',0,NULL);
insert into lease4 values(11,NULL,123,40,(SELECT FROM_UNIXTIME(1643210000)),50,1,1,'',1,'{}');\
insert into lease4 values(12,22,NULL,40,(SELECT FROM_UNIXTIME(1643212345)),50,1,1,'three,example,com',2,'{\"a\":1,\"b\":\"c\"}');"
insert into lease4 values(11,NULL,123,40,(SELECT FROM_UNIXTIME(1643210000)),50,1,1,'',1,'{ }');\
insert into lease4 values(12,22,NULL,40,(SELECT FROM_UNIXTIME(1643212345)),50,1,1,'three,example,com',2,'{ \"a\": 1, \"b\": \"c\" }');"
run_command \
mysql_execute "$insert_sql"
......@@ -1098,8 +1098,8 @@ mysql_lease6_dump_test() {
# Insert the reference record
insert_sql="\
insert into lease6 values('::10',20,30,(SELECT FROM_UNIXTIME(1642000000)),40,50,1,60,70,1,1,'one.example.com',80,90,16,0,NULL);\
insert into lease6 values('::11',NULL,30,(SELECT FROM_UNIXTIME(1643210000)),40,50,1,60,70,1,1,'',80,90,1,1,'{}');\
insert into lease6 values('::12',21,30,(SELECT FROM_UNIXTIME(1643212345)),40,50,1,60,70,1,1,'three,example,com',80,90,4,2,'{\"a\":1,\"b\":\"c\"}');"
insert into lease6 values('::11',21,30,(SELECT FROM_UNIXTIME(1643210000)),40,50,1,60,70,1,1,'',80,90,1,1,'{ }');\
insert into lease6 values('::12',22,30,(SELECT FROM_UNIXTIME(1643212345)),40,50,1,60,70,1,1,'three,example,com',80,90,4,2,'{ \"a\": 1, \"b\": \"c\" }');"
run_command \
mysql_execute "$insert_sql"
......@@ -1133,9 +1133,14 @@ mysql_lease4_upload_test() {
# Wipe the whole database.
mysql_wipe
# Make sure there's no output file left from previous failures, otherwise
# kea-admin is going to ask you if you want to overwrite which blocks tests.
rm -f "${output_file}"
# Initialize the database.
run_command \
"${kea_admin}" db-init mysql -u "${db_user}" -p "${db_password}" -n "${db_name}" -d "${db_scripts_dir}"
"${kea_admin}" db-init mysql -u "${db_user}" -p "${db_password}" \
-n "${db_name}" -d "${db_scripts_dir}"
assert_eq 0 "${EXIT_CODE}" "could not create database, expected exit code %d, actual %d"
# Upload leases.
......@@ -1175,9 +1180,14 @@ mysql_lease6_upload_test() {
# Wipe the whole database.
mysql_wipe
# Make sure there's no output file left from previous failures, otherwise
# kea-admin is going to ask you if you want to overwrite which blocks tests.
rm -f "${output_file}"
# Initialize the database.
run_command \
"${kea_admin}" db-init mysql -u "${db_user}" -p "${db_password}" -n "${db_name}" -d "${db_scripts_dir}"
"${kea_admin}" db-init mysql -u "${db_user}" -p "${db_password}" \
-n "${db_name}" -d "${db_scripts_dir}"
assert_eq 0 "${EXIT_CODE}" "could not create database, expected exit code %d, actual %d"
# Upload leases.
......
......@@ -551,8 +551,8 @@ pgsql_lease4_dump_test() {
# Otherwise, the value is interpreted as ASCII instead of raw bytes.
insert_sql="\
insert into lease4 values(10,E'\\\\x3230',E'\\\\x3330',40,TO_TIMESTAMP(1642000000),50,'t','t','one.example.com',0,'');\
insert into lease4 values(11,'',E'\\\\x313233',40,TO_TIMESTAMP(1643210000),50,'t','t','',1,'{}');\
insert into lease4 values(12,E'\\\\x3232','',40,TO_TIMESTAMP(1643212345),50,'t','t','three,example,com',2,'{\"a\":1,\"b\":\"c\"}');"
insert into lease4 values(11,'',E'\\\\x313233',40,TO_TIMESTAMP(1643210000),50,'t','t','',1,'{ }');\
insert into lease4 values(12,E'\\\\x3232','',40,TO_TIMESTAMP(1643212345),50,'t','t','three,example,com',2,'{ \"a\": 1, \"b\": \"c\" }');"
run_command \
pgsql_execute "$insert_sql"
......@@ -615,8 +615,8 @@ pgsql_lease6_dump_test() {
# Otherwise, the value is interpreted as ASCII instead of raw bytes.
insert_sql="\
insert into lease6 values('::10',E'\\\\x3230',30,TO_TIMESTAMP(1642000000),40,50,1,60,70,'t','t','one.example.com',0,decode(encode('80','hex'),'hex'),90,16,''); \
insert into lease6 values('::11','',30,TO_TIMESTAMP(1643210000),40,50,1,60,70,'t','t','',1,decode(encode('80','hex'),'hex'),90,1,'{}'); \
insert into lease6 values('::12',E'\\\\x3231',30,TO_TIMESTAMP(1643212345),40,50,1,60,70,'t','t','three,example,com',2,decode(encode('80','hex'),'hex'),90,4,'{\"a\":1,\"b\":\"c\"}');"
insert into lease6 values('::11',E'\\\\x3231',30,TO_TIMESTAMP(1643210000),40,50,1,60,70,'t','t','',1,decode(encode('80','hex'),'hex'),90,1,'{ }'); \
insert into lease6 values('::12',E'\\\\x3232',30,TO_TIMESTAMP(1643212345),40,50,1,60,70,'t','t','three,example,com',2,decode(encode('80','hex'),'hex'),90,4,'{ \"a\": 1, \"b\": \"c\" }');"
run_command \
pgsql_execute "$insert_sql"
......@@ -650,10 +650,14 @@ pgsql_lease4_upload_test() {
# Wipe the whole database.
pgsql_wipe
# Make sure there's no output file left from previous failures, otherwise
# kea-admin is going to ask you if you want to overwrite which blocks tests.
rm -f "${output_file}"
# Initialize the database.
run_command \
"${kea_admin}" db-init pgsql -u "${db_user}" -p "${db_password}" \
-n "${db_name}" -d "${db_scripts_dir}"
-n "${db_name}" -d "${db_scripts_dir}"
assert_eq 0 "${EXIT_CODE}" "could not create database, expected exit code %d, actual %d"
# Upload leases.
......@@ -693,10 +697,14 @@ pgsql_lease6_upload_test() {
# Wipe the whole database.
pgsql_wipe
# Make sure there's no output file left from previous failures, otherwise
# kea-admin is going to ask you if you want to overwrite which blocks tests.
rm -f "${output_file}"
# Initialize the database.
run_command \
"${kea_admin}" db-init pgsql -u "${db_user}" -p "${db_password}" \
-n "${db_name}" -d "${db_scripts_dir}"
-n "${db_name}" -d "${db_scripts_dir}"
assert_eq 0 "${EXIT_CODE}" "could not create database, expected exit code %d, actual %d"
# Upload leases.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment