コード例 #1
0
ファイル: lock_test.go プロジェクト: klauspost/restic
func TestLockStale(t *testing.T) {
	for i, test := range staleLockTests {
		lock := restic.Lock{
			Time: test.timestamp,
			PID:  test.pid,
		}

		Assert(t, lock.Stale() == test.stale,
			"TestStaleLock: test %d failed: expected stale: %v, got %v",
			i, test.stale, !test.stale)
	}
}
コード例 #2
0
ファイル: lock_test.go プロジェクト: marete/restic
func TestLockStale(t *testing.T) {
	hostname, err := os.Hostname()
	OK(t, err)

	otherHostname := "other-" + hostname

	for i, test := range staleLockTests {
		lock := restic.Lock{
			Time:     test.timestamp,
			PID:      test.pid,
			Hostname: hostname,
		}

		Assert(t, lock.Stale() == test.stale,
			"TestStaleLock: test %d failed: expected stale: %v, got %v",
			i, test.stale, !test.stale)

		lock.Hostname = otherHostname
		Assert(t, lock.Stale() == test.staleOnOtherHost,
			"TestStaleLock: test %d failed: expected staleOnOtherHost: %v, got %v",
			i, test.staleOnOtherHost, !test.staleOnOtherHost)
	}
}