~indicator-applet-developers/ubuntu-app-launch/trunk.17.04

« back to all changes in this revision

Viewing changes to tests/jobs-systemd.cpp

  • Committer: Bileto Bot
  • Author(s): Ted Gould
  • Date: 2017-02-06 16:00:20 UTC
  • mfrom: (257.2.153 reset-units)
  • Revision ID: ci-train-bot@canonical.com-20170206160020-vueltmoslgyd3drz
Reset failed units so they can be tried again (LP: #1655754)

Approved by: Rodney Dawes, unity-api-1-bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
360
360
 
361
361
    EXPECT_EQ(multipleAppID(), removeunit.get_future().get());
362
362
}
 
363
 
 
364
TEST_F(JobsSystemd, UnitFailure)
 
365
{
 
366
    auto manager = std::make_shared<ubuntu::app_launch::jobs::manager::SystemD>(registry);
 
367
    registry->impl->jobs = manager;
 
368
 
 
369
    ubuntu::app_launch::AppID failedappid;
 
370
    manager->appFailed().connect([&](const std::shared_ptr<ubuntu::app_launch::Application> &app,
 
371
                                     const std::shared_ptr<ubuntu::app_launch::Application::Instance> &inst,
 
372
                                     ubuntu::app_launch::Registry::FailureType type) { failedappid = app->appId(); });
 
373
 
 
374
    systemd->managerEmitFailed({defaultJobName(), std::string{multipleAppID()}, "1234567890", 1, {}});
 
375
 
 
376
    EXPECT_EVENTUALLY_EQ(multipleAppID(), failedappid);
 
377
 
 
378
    std::list<std::string> resets;
 
379
    EXPECT_EVENTUALLY_FUNC_LT(0u, std::function<unsigned int()>([&]() {
 
380
                                  resets = systemd->resetCalls();
 
381
                                  return resets.size();
 
382
                              }));
 
383
 
 
384
    EXPECT_EQ(SystemdMock::instanceName({defaultJobName(), std::string{multipleAppID()}, "1234567890", 1, {}}),
 
385
              *resets.begin());
 
386
}