aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/concurrent/OnceTest.java
blob: e9426e96a80d3170262f0dd0d0b20dbc634717f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.concurrent;

import org.junit.Test;

import java.time.Duration;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import static org.junit.Assert.assertTrue;

/**
 * @author mpolden
 */
public class OnceTest {

    @Test(timeout = 60_000)
    public void test_run() throws Exception {
        CountDownLatch latch = new CountDownLatch(1);
        Once.after(Duration.ZERO, latch::countDown);

        assertTrue(latch.await(30, TimeUnit.SECONDS));
    }

}