aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/concurrent/OnceTest.java
blob: c1a8f77f2e9c9bd56ab5010841653c4b6f0629ed (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
26
27
// 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.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;

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

import static org.junit.jupiter.api.Assertions.assertTrue;

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

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

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

}