tests: increase tolerance in several time-sensitive test cases
To avoid spurious failures when CI build bots are overloaded.
Change-Id: If6ec5579dfef1f9fdbd57723e6aeec0a46221a3f
diff --git a/tests/tools/ndn-autoconfig-server/program.t.cpp b/tests/tools/ndn-autoconfig-server/program.t.cpp
index afcf908..7a4a216 100644
--- a/tests/tools/ndn-autoconfig-server/program.t.cpp
+++ b/tests/tools/ndn-autoconfig-server/program.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,6 +26,7 @@
#include "ndn-autoconfig-server/program.hpp"
#include "tests/identity-management-fixture.hpp"
+
#include <ndn-cxx/encoding/buffer.hpp>
#include <ndn-cxx/util/dummy-client-face.hpp>
@@ -48,11 +49,11 @@
initialize(const Options& options)
{
program = make_unique<Program>(options, face, m_keyChain);
- face.processEvents(time::milliseconds(1));
+ face.processEvents(500_ms);
face.sentInterests.clear();
}
-public:
+protected:
util::DummyClientFace face;
unique_ptr<Program> program;
};
@@ -68,10 +69,10 @@
Interest interest("/localhop/ndn-autoconf/hub");
face.receive(interest);
- face.processEvents(time::milliseconds(1));
+ face.processEvents(500_ms);
- BOOST_CHECK_EQUAL(face.sentData.size(), 1);
- const Name& dataName = face.sentData.at(0).getName();
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+ const Name& dataName = face.sentData[0].getName();
BOOST_CHECK_EQUAL(dataName.size(), interest.getName().size() + 1);
BOOST_CHECK(interest.getName().isPrefixOf(dataName));
BOOST_CHECK(dataName.at(-1).isVersion());
@@ -79,7 +80,7 @@
// interest2 asks for a different version, and should not be responded
Interest interest2(Name(interest.getName()).appendVersion(dataName.at(-1).toVersion() - 1));
face.receive(interest2);
- face.processEvents(time::milliseconds(1));
+ face.processEvents(500_ms);
BOOST_CHECK_EQUAL(face.sentData.size(), 1);
}
@@ -87,18 +88,18 @@
{
Options options;
options.hubFaceUri = FaceUri("udp4://192.0.2.1:6363");
- const int nRoutablePrefixes = 2000;
- for (int i = 0; i < nRoutablePrefixes; ++i) {
+ const size_t nRoutablePrefixes = 2000;
+ for (size_t i = 0; i < nRoutablePrefixes; ++i) {
options.routablePrefixes.push_back(Name("/PREFIX").appendNumber(i));
}
this->initialize(options);
Interest interest("/localhop/nfd/rib/routable-prefixes");
face.receive(interest);
- face.processEvents(time::milliseconds(1));
+ face.processEvents(500_ms);
- BOOST_CHECK_EQUAL(face.sentData.size(), 1);
- const Name& dataName0 = face.sentData.at(0).getName();
+ BOOST_REQUIRE_EQUAL(face.sentData.size(), 1);
+ const Name& dataName0 = face.sentData[0].getName();
BOOST_CHECK_EQUAL(dataName0.size(), interest.getName().size() + 2);
BOOST_CHECK(interest.getName().isPrefixOf(dataName0));
BOOST_CHECK(dataName0.at(-2).isVersion());
@@ -108,7 +109,7 @@
const Name& lastName = face.sentData.back().getName();
Interest interest2(lastName.getPrefix(-1).appendSegment(lastName.at(-1).toSegment() + 1));
face.receive(interest2);
- face.processEvents(time::milliseconds(1));
+ face.processEvents(500_ms);
}
auto buffer = make_shared<Buffer>();
@@ -119,9 +120,9 @@
Block payload(tlv::Content, buffer);
payload.parse();
- BOOST_CHECK_EQUAL(payload.elements_size(), nRoutablePrefixes);
- for (int i = 0; i < nRoutablePrefixes; ++i) {
- BOOST_CHECK_EQUAL(Name(payload.elements().at(i)), options.routablePrefixes.at(i));
+ BOOST_REQUIRE_EQUAL(payload.elements_size(), nRoutablePrefixes);
+ for (size_t i = 0; i < nRoutablePrefixes; ++i) {
+ BOOST_CHECK_EQUAL(Name(payload.elements()[i]), options.routablePrefixes[i]);
}
}
@@ -133,7 +134,7 @@
Interest interest("/localhop/nfd/rib/routable-prefixes");
face.receive(interest);
- face.processEvents(time::milliseconds(1));
+ face.processEvents(500_ms);
BOOST_CHECK_EQUAL(face.sentData.size(), 0);
}