Skip to content

Commit

Permalink
Merge "Fix UT to run consistently" into R2.20
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jul 17, 2015
2 parents ba3a707 + 3165de3 commit 1959d95
Show file tree
Hide file tree
Showing 20 changed files with 666 additions and 718 deletions.
7 changes: 5 additions & 2 deletions src/vnsw/agent/cfg/cfg_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,11 @@ bool CfgIntTable::Delete(DBEntry *entry, const DBRequest *req) {
CfgVnPortKey vn_port_key(cfg->GetVnUuid(), cfg->GetUuid());
CfgVnPortTree::iterator it = uuid_tree_.find(vn_port_key);

assert(it != uuid_tree_.end());
uuid_tree_.erase(it);
// Delete entry from UUID tree.
if (it != uuid_tree_.end()) {
// If duplicate delete, there will be no entry in UUID tree
uuid_tree_.erase(it);
}
return true;
}

Expand Down
21 changes: 4 additions & 17 deletions src/vnsw/agent/filter/test/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,15 @@ env = AgentEnv.Clone()

AgentEnv.MakeTestEnv(env)

#acl_entry_test = env.Program('acl_entry_test',
# ['acl_entry_test.cc'])
#
#env.Alias('agent:acl_entry_test', acl_entry_test)

#acl_test = env.Program('acl_test',
# ['acl_test.cc'])
#env.Alias('agent:acl_test', acl_test)
#policy_test = env.Program('policy_test',
# ['policy_test.cc'])
#env.Alias('agent:policy_test', policy_test)

#test = env.TestSuite('agent-test', test_suite)
#env.Alias('controller/src/vnsw/agent/filter:test', test)

filter_flaky_test_suite = []
filter_test_suite = []
acl_entry_test = AgentEnv.MakeTestCmd(env, 'acl_entry_test', filter_flaky_test_suite)
acl_test = AgentEnv.MakeTestCmd(env, 'acl_test', filter_flaky_test_suite)
acl_change_test = AgentEnv.MakeTestCmd(env, 'acl_change_test', filter_flaky_test_suite)
#policy_test = AgentEnv.MakeTestCmd(env, 'policy_test', filter_flaky_test_suite)

flaky_test = env.TestSuite('agent-flaky-test', filter_flaky_test_suite)
test = env.TestSuite('agent-test', filter_test_suite)
env.Alias('agent:filter', test)
env.Alias('controller/src/vnsw/agent/filter:flaky_test', flaky_test)

#Return('test_suite')
Return('filter_test_suite')
138 changes: 0 additions & 138 deletions src/vnsw/agent/filter/test/policy_test.cc

This file was deleted.

15 changes: 9 additions & 6 deletions src/vnsw/agent/openstack/instance_service_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,28 +64,31 @@ InstanceServiceAsyncHandler::AddPort(const PortList& port_list) {
uuid vn_id = ConvertToUuid(port.vn_id);
uuid vm_project_id = ConvertToUuid(port.vm_project_id);
boost::system::error_code ec;
bool v6_correct = true, v4_correct = true;
IpAddress ip = IpAddress::from_string(port.ip_address, ec);
if (ec.value() != 0) {
bool v4_valid = (ec.value() == 0);
if (v4_valid == false) {
CFG_TRACE(IntfInfo,
"IPv4 address is not correct, " + port.ip_address);
v4_correct = false;
v4_valid = false;
}

bool v6_valid = false;
Ip6Address ip6;
if (port.__isset.ip6_address) {
ip6 = Ip6Address::from_string(port.ip6_address, ec);
if (ec.value() != 0) {
CFG_TRACE(IntfInfo,
"IPv6 address is not correct, " + port.ip6_address);
v6_correct = false;
v6_valid = false;
} else {
v6_valid = true;
}
}

if (!v4_correct && !v6_correct) {
if ((v4_valid == false) && (v6_valid == false)) {
return false;
}

CfgIntTable *ctable = static_cast<CfgIntTable *>
(agent_->db()->FindTable("db.cfg_int.0"));
assert(ctable);
Expand Down
13 changes: 11 additions & 2 deletions src/vnsw/agent/openstack/instance_service_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,21 @@ class InstanceServiceAsyncHandler: virtual public InstanceServiceAsyncIf {
const std::string& label);

virtual CreateVrf_shared_future_t CreateVrf(const std::string& vrf_name);
uuid ConvertToUuid(const tuuid &tid);

int version() const { return version_; }
protected:
boost::asio::io_service& io_service_;

private:
uuid ConvertToUuid(const tuuid &tid);
friend class InstanceServiceTest;
InterfaceConfigStaleCleaner *interface_stale_cleaner() const {
return interface_stale_cleaner_.get();
}
ConfigStaleCleaner *vgw_stale_cleaner() const {
return vgw_stale_cleaner_.get();
}

uuid MakeUuid(int id);

Agent *agent_;
Expand Down
7 changes: 4 additions & 3 deletions src/vnsw/agent/openstack/test/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ env.Prepend(CPPPATH = env['TOP'] + '/vnsw/agent/test')
openstack_test_suite = []
openstack_flaky_test_suite = []

nova_info_server_test = AgentEnv.MakeTestCmdSrc(env, 'nova_info_server_test',
['instance_service_test.cc'],
openstack_flaky_test_suite)
test_instance_service = AgentEnv.MakeTestCmd(env, 'test_instance_service',
openstack_flaky_test_suite)
test_instance_sandesh = AgentEnv.MakeTestCmd(env, 'test_instance_sandesh',
openstack_flaky_test_suite)
nova_inc = AgentEnv.MakeTestCmdSrc(env, 'nova_inc',
['instance_service_client.cc'],
openstack_flaky_test_suite)
Expand Down
10 changes: 5 additions & 5 deletions src/vnsw/agent/openstack/test/instance_service_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ void connected(boost::shared_ptr<InstanceServiceAsyncClient> client) {

int main(int argc, char* argv[])
{
if (argc != 3) {
std::cout << argv[0] << ": <vmport-mac1> <vmport-mac2>" << std::endl;
return 1;
strcpy(macs[0], "00:00:00:00:00:01");
strcpy(macs[1], "00:00:00:00:00:02");
if (argc >= 3) {
strcpy(macs[0], argv[1]);
strcpy(macs[1], argv[2]);
}
strcpy(macs[0], argv[1]);
strcpy(macs[1], argv[2]);

try
{
Expand Down

0 comments on commit 1959d95

Please sign in to comment.