|
7 | 7 | import static oracle.kubernetes.operator.create.KubernetesArtifactUtils.*;
|
8 | 8 | import static oracle.kubernetes.operator.create.YamlUtils.*;
|
9 | 9 | import oracle.kubernetes.weblogic.domain.v1.Domain;
|
10 |
| -import static org.hamcrest.MatcherAssert.assertThat; |
11 |
| -import org.junit.AfterClass; |
12 | 10 | import org.junit.BeforeClass;
|
13 |
| -import org.junit.Test; |
14 | 11 |
|
15 | 12 | /**
|
16 | 13 | * Tests that the all artifacts in the yaml files that create-domain-operator.sh
|
17 | 14 | * creates are correct when the admin node port is enabled, the t3 channel is enabled,
|
18 |
| - * there is no image pull secret, and production mode is enabled |
| 15 | + * there is an image pull secret, production mode is enabled, and the persistence type |
| 16 | + * is nfs |
19 | 17 | */
|
20 |
| -public class CreateDomainGeneratedFilesOptionalFeaturesEnabledTest { |
21 |
| - |
22 |
| - private static CreateDomainInputs inputs; |
23 |
| - private static GeneratedDomainYamlFiles generatedFiles; |
| 18 | +public class CreateDomainGeneratedFilesOptionalFeaturesEnabledTest extends CreateDomainGeneratedFilesBaseTest { |
24 | 19 |
|
25 | 20 | @BeforeClass
|
26 | 21 | public static void setup() throws Exception {
|
27 |
| - inputs = |
| 22 | + setup( |
28 | 23 | CreateDomainInputs.newInputs()
|
29 | 24 | .exposeAdminNodePort("true")
|
30 | 25 | .exposeAdminT3Channel("true")
|
31 | 26 | .imagePullSecretName("test-weblogic-image-pull-secret-name")
|
32 | 27 | .loadBalancer(LOAD_BALANCER_TRAEFIK)
|
33 | 28 | .persistenceType(PERSISTENCE_TYPE_NFS)
|
34 |
| - .productionModeEnabled("true"); |
35 |
| - generatedFiles = GeneratedDomainYamlFiles.generateDomainYamlFiles(inputs); |
36 |
| - } |
37 |
| - |
38 |
| - @AfterClass |
39 |
| - public static void tearDown() throws Exception { |
40 |
| - if (generatedFiles != null) { |
41 |
| - generatedFiles.remove(); |
42 |
| - } |
| 29 | + .productionModeEnabled("true") |
| 30 | + ); |
43 | 31 | }
|
44 | 32 |
|
45 |
| - @Test |
46 |
| - public void generatesCorrect_createWeblogicDomainYaml_createWeblogicDomainJob() throws Exception { |
47 |
| - V1Job want = generatedFiles.getCreateWeblogicDomainJobYaml().getExpectedBaseCreateWeblogicDomainJob(); |
48 |
| - want.getSpec().getTemplate().getSpec().addImagePullSecretsItem(newLocalObjectReference() |
49 |
| - .name(inputs.getImagePullSecretName())); |
50 |
| - assertThat( |
51 |
| - generatedFiles.getCreateWeblogicDomainJobYaml().getCreateWeblogicDomainJob(), |
52 |
| - yamlEqualTo(want)); |
| 33 | + @Override |
| 34 | + protected V1Job getExpectedCreateWeblogicDomainJob() { |
| 35 | + V1Job expected = super.getExpectedCreateWeblogicDomainJob(); |
| 36 | + expected.getSpec().getTemplate().getSpec().addImagePullSecretsItem(newLocalObjectReference() |
| 37 | + .name(getInputs().getImagePullSecretName())); |
| 38 | + return expected; |
53 | 39 | }
|
54 | 40 |
|
55 |
| - @Test |
56 |
| - public void generatesCorrect_domainCustomResourceYaml_domain() throws Exception { |
57 |
| - Domain want = generatedFiles.getDomainCustomResourceYaml().getBaseExpectedDomain(); |
58 |
| - want.getSpec().withExportT3Channels(newStringList().addElement("T3Channel")); |
| 41 | + @Override |
| 42 | + protected Domain getExpectedDomain() { |
| 43 | + Domain expected = super.getExpectedDomain(); |
| 44 | + expected.getSpec().withExportT3Channels(newStringList().addElement("T3Channel")); |
59 | 45 | // there is only one server startup item in the base domain config - set its node port:
|
60 |
| - want.getSpec().getServerStartup().get(0).withNodePort(Integer.parseInt(inputs.getAdminNodePort())); |
61 |
| - assertThat( |
62 |
| - generatedFiles.getDomainCustomResourceYaml().getDomain(), |
63 |
| - yamlEqualTo(want)); |
| 46 | + expected.getSpec().getServerStartup().get(0).withNodePort(Integer.parseInt(getInputs().getAdminNodePort())); |
| 47 | + return expected; |
64 | 48 | }
|
65 | 49 |
|
66 |
| - @Test |
67 |
| - public void generatesCorrect_weblogicDomainPersistentVolumeYaml_weblogicDomainPersistentVolume() throws Exception { |
68 |
| - V1PersistentVolume want = |
69 |
| - generatedFiles.getWeblogicDomainPersistentVolumeYaml().getExpectedBaseCreateWeblogicDomainPersistentVolume(); |
70 |
| - want.getSpec() |
| 50 | + @Override |
| 51 | + protected V1PersistentVolume getExpectedWeblogicDomainPersistentVolume() { |
| 52 | + V1PersistentVolume expected = super.getExpectedWeblogicDomainPersistentVolume(); |
| 53 | + expected.getSpec() |
71 | 54 | .nfs(newNFSVolumeSource()
|
72 |
| - .server(inputs.getNfsServer()) |
73 |
| - .path(inputs.getPersistencePath())); |
74 |
| - assertThat( |
75 |
| - generatedFiles.getWeblogicDomainPersistentVolumeYaml().getWeblogicDomainPersistentVolume(), |
76 |
| - yamlEqualTo(want)); |
| 55 | + .server(getInputs().getNfsServer()) |
| 56 | + .path(getInputs().getPersistencePath())); |
| 57 | + return expected; |
77 | 58 | }
|
78 | 59 | }
|
0 commit comments