blob: 9fcf426e2e88a46ec5d5f71990afb05599925d04 (
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.content;
import com.yahoo.vespa.config.content.StorFilestorConfig;
import com.yahoo.vespa.model.VespaModel;
import com.yahoo.vespa.model.content.cluster.ContentCluster;
import com.yahoo.vespa.model.content.storagecluster.StorageCluster;
import com.yahoo.vespa.model.test.utils.ApplicationPackageUtils;
import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author gjoranv
* @since 5.1.8
*/
public class GenericConfigTest {
private VespaModel model;
private String servicesXml() {
return "" +
"<services version='1.0'>" +
" <config name='vespa.config.content.stor-filestor'>" +
" <num_threads>7</num_threads> " +
" </config>" +
" <admin version=\"2.0\">" +
" <adminserver hostalias=\"node0\" />" +
" <cluster-controllers>" +
" <cluster-controller hostalias='node0'/>" +
" </cluster-controllers>" +
" </admin>" +
" <content version='1.0' id='storage'>" +
" <documents>" +
" <document type=\"type1\" mode=\"store-only\"/>\n" +
" </documents>" +
" <config name='config.juniperrc'>" +
" <length>1024</length>" +
" </config>" +
" <redundancy>1</redundancy>" +
" <group>" +
" <node distribution-key='0' hostalias='node0'/>" +
" </group>" +
" </content>" +
"</services>";
}
@BeforeEach
public void getVespaModel() {
model = (new VespaModelCreatorWithMockPkg(ContentBaseTest.getHosts(), servicesXml(), ApplicationPackageUtils.generateSchemas("type1"))).create();
}
@Test
void config_override_on_root_is_visible_on_storage_cluster() {
StorageCluster cluster = model.getContentClusters().get("storage").getStorageCluster();
StorFilestorConfig config = model.getConfig(StorFilestorConfig.class, cluster.getConfigId());
assertEquals(7, config.num_threads());
}
@Test
void config_override_on_root_is_visible_on_content_cluster() {
ContentCluster cluster = model.getContentClusters().get("storage");
StorFilestorConfig config = model.getConfig(StorFilestorConfig.class, cluster.getConfigId());
assertEquals(7, config.num_threads());
}
}
|