Opened 4 years ago

Last modified 3 years ago

#4214 new enhancement

MySQL/Postgres is not tested in src/bin/dhcp{4,6} unit-tests

Reported by: tomek Owned by:
Priority: medium Milestone: Outstanding Tasks
Component: database-all Version: git
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: DHCP Feature Depending on Ticket:
Estimated Difficulty: 0 Add Hours to Ticket: 0
Total Hours: 0 Internal?: no

Description

It seems that the unit-tests responsible for kea-dhcp4 and kea-dhcp6 binaries are not testing lease managers configuration. This was brought up when Thomas and I were discussing how to test MySQL host data source.

There's a number of issues to consider there.

  1. We don't have any unit-tests that validate whole dhcp server with lease or host database configuration. In fact, there's no mention of MySQL in src/bin/dhcp4/ at all.
  1. trac3569_rebase contains Dhcpv4SrvTest.hostDataSourceMySQL test with the following code:
// Checks if the v4 server can be configured to use MySQL HostDataSource.
TEST_F(Dhcpv4SrvTest, hostDataSourceMySQL) {
    IfaceMgrTestConfig test_config(true);
    IfaceMgr::instance().openSockets4();

    NakedDhcpv4Srv srv(0);

    EXPECT_NO_THROW(configure(CONFIGS[1]));

    HostDataSourcePtr hds;
    hds = HostMgr::instance().getHostDataSource();

    EXPECT_TRUE(hds);
}

It's a sketch of a solution, but there are multiple problems with it. First, the only supported host data source is the one based on MySQL. To test whether the server is parsing its config correctly, it requires setting up MySQL database. The test utility functions for setting/cleaning up the database are in src/lib/dhcpsrv/tests, which is not accessible from dhcp4/tests. The code could be moved to src/lib/dhcpsrv/testutils, but that would bring in MySQL dependency to that lib.

Subtickets

Change History (2)

comment:1 Changed 4 years ago by tomek

  • Milestone changed from Kea-proposed to Kea1.1

comment:2 Changed 3 years ago by tomek

  • Milestone changed from Kea1.1 to Outstanding Tasks

We're back in shoving tickets off from the current milestone. We decided on 2016-06-02 call to move this ticket to Outstanding.

Note: See TracTickets for help on using tickets.