aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/VersionStatusUpdaterTest.java
blob: aab38952602d15ce0b1c0a45b53ed04b756feae7 (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
28
29
30
31
32
33
34
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.maintenance;

import com.yahoo.vespa.hosted.controller.ControllerTester;
import com.yahoo.vespa.hosted.controller.persistence.MockCuratorDb;
import com.yahoo.vespa.hosted.controller.versions.VersionStatus;
import org.junit.Test;

import java.time.Duration;
import java.util.Collections;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

/**
 * @author bratseth
 */
public class VersionStatusUpdaterTest {

    /** Test that this job updates the status. Test of the content of the update is in
     * {@link com.yahoo.vespa.hosted.controller.versions.VersionStatusTest} */
    @Test
    public void testVersionUpdating() {
        ControllerTester tester = new ControllerTester();
        tester.controller().updateVersionStatus(new VersionStatus(Collections.emptyList()));
        assertFalse(tester.controller().versionStatus().systemVersion().isPresent());

        VersionStatusUpdater updater = new VersionStatusUpdater(tester.controller(), Duration.ofDays(1),
                                                                new JobControl(new MockCuratorDb()));
        updater.maintain();
        assertTrue(tester.controller().versionStatus().systemVersion().isPresent());
    }
    
}