Commit 4851b78c authored by Alaric Sénat's avatar Alaric Sénat Committed by Alaric Sénat
Browse files

test: subscription_importer: Only wait for cache idle

Subscriptions no containing valid medias won't trigger any cache update
events and thats expected by the API.

The cache update is then checked after that the cache worker reach an
idle state and an error message is written accordingly.
parent 3ec7344c
Pipeline #271675 passed with stages
in 1 minute and 39 seconds
......@@ -59,14 +59,19 @@ public:
m_cacheWorkerIdle = false;
}
void waitForCacheUpdated()
void waitForCacheIdle()
{
std::unique_lock<compat::Mutex> lock{ m_mutex };
m_cond.wait( lock, [this]() {
return m_cacheWorkerIdle == true && m_cacheUpdated == true;
return m_cacheWorkerIdle == true;
});
}
bool wasCacheUpdated() const
{
return m_cacheUpdated;
}
private:
virtual void onParsingStatsUpdated( uint32_t done, uint32_t scheduled ) override
{
......@@ -164,6 +169,13 @@ int main( int argc, char** argv )
{
testCb->prepareWaitForCache();
ml->cacheNewSubscriptionMedia();
testCb->waitForCacheUpdated();
testCb->waitForCacheIdle();
if (!testCb->wasCacheUpdated())
{
std::cerr << "No cache update event received."
" Subscription might be empty." << std::endl;
exit(2);
}
}
}
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