aboutsummaryrefslogtreecommitdiffstats
path: root/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/ArtifactProducersTest.java
blob: b6d572c890320ee99474ee3e61162e0963739108 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.maintenance.servicedump;

import com.yahoo.yolean.concurrent.Sleeper;
import org.junit.jupiter.api.Test;

import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

/**
 * @author bjorncs
 */
class ArtifactProducersTest {

    @Test
    void generates_exception_on_unknown_artifact() {
        ArtifactProducers instance = ArtifactProducers.createDefault(Sleeper.NOOP);
        IllegalArgumentException exception = assertThrows(
                IllegalArgumentException.class, () -> instance.resolve(List.of("unknown-artifact")));
        String expectedMsg =
                "Invalid artifact type 'unknown-artifact'. Valid types are " +
                        "['config-dump', 'jvm-heap-dump', 'jvm-jfr', 'jvm-jmap', 'jvm-jstack', 'jvm-jstat', 'perf-report', 'pmap', " +
                        "'vespa-log', 'zookeeper-snapshot'] " +
                        "and valid aliases are " +
                        "['jvm-dump': ['jvm-heap-dump', 'jvm-jmap', 'jvm-jstack', 'jvm-jstat', 'vespa-log']]";
        assertEquals(expectedMsg, exception.getMessage());
    }

}