@@ -245,7 +245,7 @@ mysql_upgrade_schema_to_version() {
245
245
246
246
mysql_upgrade_test () {
247
247
248
- test_start " mysql.host_reservation- upgrade"
248
+ test_start " mysql.upgrade"
249
249
250
250
# Let's wipe the whole database
251
251
mysql_wipe
@@ -469,11 +469,182 @@ EOF
469
469
ERRCODE=$?
470
470
assert_eq 0 $ERRCODE " logs table is missing or broken. (expected status code %d, returned %d)"
471
471
472
+ # table: modification (upgrade 6.0 -> 7.0)
473
+ qry=" select id, modification_type from modification" ;
474
+ count=` mysql_execute " ${qry} " `
475
+ ERRCODE=$?
476
+ assert_eq 0 $ERRCODE " modification table is missing or broken. (expected status code %d, returned %d)"
477
+
478
+ # table: modification table should have 3 entries (upgrade 6.0 -> 7.0)
479
+ qry=" select count(*) from modification" ;
480
+ count=` mysql_execute " ${qry} " `
481
+ ERRCODE=$?
482
+ assert_eq 3 " $count " " modification table does not contain correct number of entries. (expected count %d, returned %d)"
483
+
484
+ # table: dhcp4_server
485
+ qry=" select id, tag, description, modification_ts from dhcp4_server" ;
486
+ count=` mysql_execute " ${qry} " `
487
+ ERRCODE=$?
488
+ assert_eq 0 $ERRCODE " dhcp4_server table missing or broken (expected status code %d, returned %d)" ;
489
+
490
+ # table: dhcp4_audit
491
+ qry=" select id, object_type, object_id, modification_type, modification_ts from dhcp4_audit" ;
492
+ count=` mysql_execute " ${qry} " `
493
+ ERRCODE=$?
494
+ assert_eq 0 $ERRCODE " dhcp4_audit table missing or broken (expected status code %d, returned %d)" ;
495
+
496
+ # table: dhcp4_global_parameter
497
+ qry=" select id, name, value, modification_ts from dhcp4_global_parameter" ;
498
+ count=` mysql_execute " ${qry} " `
499
+ ERRCODE=$?
500
+ assert_eq 0 $ERRCODE " dhcp4_global_parameter table missing or broken (expected status code %d, returned %d)" ;
501
+
502
+ # table: dhcp4_global_parameter_server
503
+ qry=" select parameter_id, server_id, modification_ts from dhcp4_global_parameter_server" ;
504
+ count=` mysql_execute " ${qry} " `
505
+ ERRCODE=$?
506
+ assert_eq 0 $ERRCODE " dhcp4_global_parameter_server table missing or broken (expected status code %d, returned %d)" ;
507
+
508
+ # table: dhcp4_option_def
509
+ qry=" select id, code, space, modification_ts, array, encapsulate, record_types, user_context from dhcp4_option_def" ;
510
+ count=` mysql_execute " ${qry} " `
511
+ ERRCODE=$?
512
+ assert_eq 0 $ERRCODE " dhcp4_option_def table missing or broken (expected status code %d, returned %d)" ;
513
+
514
+ # table: dhcp4_option_def_server
515
+ qry=" select option_def_id, server_id, modification_ts from dhcp4_option_def_server" ;
516
+ count=` mysql_execute " ${qry} " `
517
+ ERRCODE=$?
518
+ assert_eq 0 $ERRCODE " dhcp4_option_def_server table missing or broken (expected status code %d, returned %d)" ;
519
+
520
+ # table: dhcp4_shared_network
521
+ qry=" select name, client_class, interface, match_client_id, modification_ts, rebind_timer, relay, renew_timer, require_client_classes, reservation_mode, server_hostname, user_context, valid_lifetime from dhcp4_shared_network" ;
522
+ count=` mysql_execute " ${qry} " `
523
+ ERRCODE=$?
524
+ assert_eq 0 $ERRCODE " dhcp4_shared_network table missing or broken (expected status code %d, returned %d)" ;
525
+
526
+ # table: dhcp4_shared_network_server
527
+ qry=" select shared_network_name, server_id, modification_ts from dhcp4_shared_network_server" ;
528
+ count=` mysql_execute " ${qry} " `
529
+ ERRCODE=$?
530
+ assert_eq 0 $ERRCODE " dhcp4_shared_network_server table missing or broken (expected status code %d, returned %d)" ;
531
+
532
+ # table: dhcp4_subnet
533
+ qry=" select subnet_prefix, 4o6_interface, 4o6_interface_id, 4o6_subnet, boot_file_name, client_class, interface, match_client_id, modification_ts, next_server, rebind_timer, relay, renew_timer, require_client_classes, reservation_mode, server_hostname, shared_network_name, subnet_id, user_context, valid_lifetime from dhcp4_subnet" ;
534
+ count=` mysql_execute " ${qry} " `
535
+ ERRCODE=$?
536
+ assert_eq 0 $ERRCODE " dhcp4_subnet table missing or broken (expected status code %d, returned %d)" ;
537
+
538
+ # table: dhcp4_pool
539
+ qry=" select id, start_address, end_address, subnet_id, modification_ts from dhcp4_pool" ;
540
+ count=` mysql_execute " ${qry} " `
541
+ ERRCODE=$?
542
+ assert_eq 0 $ERRCODE " dhcp4_pool table missing or broken (expected status code %d, returned %d)" ;
543
+
544
+ # table: dhcp4_subnet_server
545
+ qry=" select subnet_id, server_id, modification_ts from dhcp4_subnet_server" ;
546
+ count=` mysql_execute " ${qry} " `
547
+ ERRCODE=$?
548
+ assert_eq 0 $ERRCODE " dhcp4_subnet_server table missing or broken (expected status code %d, returned %d)" ;
549
+
550
+ # table: dhcp4_options (should include three new columns)
551
+ qry=" select shared_network_name, pool_id, modification_ts from dhcp4_options" ;
552
+ count=` mysql_execute " ${qry} " `
553
+ ERRCODE=$?
554
+ assert_eq 0 $ERRCODE " dhcp4_options table missing or broken (expected status code %d, returned %d)" ;
555
+
556
+ # table: dhcp4_options_server
557
+ qry=" select option_id, server_id, modification_ts from dhcp4_options_server" ;
558
+ count=` mysql_execute " ${qry} " `
559
+ ERRCODE=$?
560
+ assert_eq 0 $ERRCODE " dhcp4_options_server table missing or broken (expected status code %d, returned %d)" ;
561
+ # table: dhcp6_server
562
+ qry=" select id, tag, description, modification_ts from dhcp6_server" ;
563
+ count=` mysql_execute " ${qry} " `
564
+ ERRCODE=$?
565
+ assert_eq 0 $ERRCODE " dhcp6_server table missing or broken (expected status code %d, returned %d)" ;
566
+
567
+ # table: dhcp6_audit
568
+ qry=" select id, object_type, object_id, modification_type, modification_ts from dhcp6_audit" ;
569
+ count=` mysql_execute " ${qry} " `
570
+ ERRCODE=$?
571
+ assert_eq 0 $ERRCODE " dhcp6_audit table missing or broken (expected status code %d, returned %d)" ;
572
+
573
+ # table: dhcp6_global_parameter
574
+ qry=" select id, name, value, modification_ts from dhcp6_global_parameter" ;
575
+ count=` mysql_execute " ${qry} " `
576
+ ERRCODE=$?
577
+ assert_eq 0 $ERRCODE " dhcp6_global_parameter table missing or broken (expected status code %d, returned %d)" ;
578
+
579
+ # table: dhcp6_global_parameter_server
580
+ qry=" select parameter_id, server_id, modification_ts from dhcp6_global_parameter_server" ;
581
+ count=` mysql_execute " ${qry} " `
582
+ ERRCODE=$?
583
+ assert_eq 0 $ERRCODE " dhcp6_global_parameter_server table missing or broken (expected status code %d, returned %d)" ;
584
+
585
+ # table: dhcp6_option_def
586
+ qry=" select id, code, space, modification_ts, array, encapsulate, record_types, user_context from dhcp6_option_def" ;
587
+ count=` mysql_execute " ${qry} " `
588
+ ERRCODE=$?
589
+ assert_eq 0 $ERRCODE " dhcp6_option_def table missing or broken (expected status code %d, returned %d)" ;
590
+
591
+ # table: dhcp6_option_def_server
592
+ qry=" select option_def_id, server_id, modification_ts from dhcp6_option_def_server" ;
593
+ count=` mysql_execute " ${qry} " `
594
+ ERRCODE=$?
595
+ assert_eq 0 $ERRCODE " dhcp6_option_def_server table missing or broken (expected status code %d, returned %d)" ;
596
+
597
+ # table: dhcp6_shared_network
598
+ qry=" select name, client_class, interface, modification_ts, preferred_lifetime, rapid_commit, rebind_timer, relay, renew_timer, require_client_classes, reservation_mode, server_hostname, user_context, valid_lifetime from dhcp6_shared_network" ;
599
+ count=` mysql_execute " ${qry} " `
600
+ ERRCODE=$?
601
+ assert_eq 0 $ERRCODE " dhcp6_shared_network table missing or broken (expected status code %d, returned %d)" ;
602
+ # table: dhcp6_shared_network_server
603
+ qry=" select shared_network_name, server_id, modification_ts from dhcp6_shared_network_server" ;
604
+ count=` mysql_execute " ${qry} " `
605
+ ERRCODE=$?
606
+ assert_eq 0 $ERRCODE " dhcp6_shared_network_server table missing or broken (expected status code %d, returned %d)" ;
607
+
608
+ # table: dhcp6_subnet
609
+ qry=" select subnet_prefix, client_class, interface, modification_ts, preferred_lifetime, rapid_commit, rebind_timer, relay, renew_timer, require_client_classes, reservation_mode, shared_network_name, subnet_id, user_context, valid_lifetime from dhcp6_subnet" ;
610
+ count=` mysql_execute " ${qry} " `
611
+ ERRCODE=$?
612
+ assert_eq 0 $ERRCODE " dhcp6_subnet table missing or broken (expected status code %d, returned %d)" ;
613
+
614
+ # table: dhcp6_subnet_server
615
+ qry=" select subnet_id, server_id, modification_ts from dhcp6_subnet_server" ;
616
+ count=` mysql_execute " ${qry} " `
617
+ ERRCODE=$?
618
+ assert_eq 0 $ERRCODE " dhcp6_subnet_server table missing or broken (expected status code %d, returned %d)" ;
619
+
620
+ # table: dhcp6_pd_pool
621
+ qry=" select id, prefix_length, delegated_prefix_length, dhcp6_subnet_id, modification_ts from dhcp6_pd_pool" ;
622
+ count=` mysql_execute " ${qry} " `
623
+ ERRCODE=$?
624
+ assert_eq 0 $ERRCODE " dhcp6_pd_pool table missing or broken (expected status code %d, returned %d)" ;
625
+
626
+ # table: dhcp6_pool
627
+ qry=" select id, start_address, end_address, dhcp6_subnet_id, modification_ts from dhcp6_pool" ;
628
+ count=` mysql_execute " ${qry} " `
629
+ ERRCODE=$?
630
+ assert_eq 0 $ERRCODE " dhcp6_pool table missing or broken (expected status code %d, returned %d)" ;
631
+
632
+ # table: dhcp6_options (should include four new columns)
633
+ qry=" select shared_network_name, pool_id, pd_pool_id, modification_ts from dhcp6_options" ;
634
+ count=` mysql_execute " ${qry} " `
635
+ ERRCODE=$?
636
+ assert_eq 0 $ERRCODE " dhcp6_options table missing or broken (expected status code %d, returned %d)" ;
637
+
638
+ # table: dhcp6_options_server
639
+ qry=" select option_id, server_id, modification_ts from dhcp6_options_server" ;
640
+ count=` mysql_execute " ${qry} " `
641
+ ERRCODE=$?
642
+ assert_eq 0 $ERRCODE " dhcp6_options_server table missing or broken (expected status code %d, returned %d)" ;
643
+
472
644
# Verify upgraded schema reports version 7.0
473
645
version=$( ${keaadmin} lease-version mysql -u $db_user -p $db_password -n $db_name -d $db_scripts_dir )
474
646
assert_str_eq " 7.0" ${version} " Expected kea-admin to return %s, returned value was %s"
475
647
476
-
477
648
# Let's wipe the whole database
478
649
mysql_wipe
479
650
0 commit comments