def testTimeSyncRunning(self):

    found = ["Expected state was not found"]
    bad = [("foo", 233, ["/usr/local/foo", "-flags"])]
    good = [("ntpd", 42, ["/usr/sbin/ntpd", "-p", "/var/run/ntpd.pid",
                          "-g", "-u", "117:125"])]

    # Check for when it is not running.

    self.assertCheckDetectedAnom(
        "TIME-SYNC-RUNNING", self.RunChecks(self.GenProcessData(bad)),
        "Missing attribute: A time synchronization service is not running.",
        found)
    # Now check for when it is.
    self.assertCheckUndetected("TIME-SYNC-RUNNING",
                               self.RunChecks(self.GenProcessData(good)))
Test we handle the cases for when a time service is running or not.
dataset/ETHPy150Open google/grr/grr/checks/time_test.py/TimeSyncTests.testTimeSyncRunning