@@ -13,7 +13,7 @@ import (
13
13
"github.com/gruntwork-io/terratest/modules/random"
14
14
)
15
15
16
- func TestChartTemplate (t * testing.T ) {
16
+ func TestChartTemplateNoLogging (t * testing.T ) {
17
17
t .Parallel ()
18
18
19
19
// Path to the helm chart we will test
@@ -29,9 +29,10 @@ func TestChartTemplate(t *testing.T) {
29
29
// Setup the args for helm install
30
30
options := & helm.Options {
31
31
SetValues : map [string ]string {
32
- "image.repository" : "store/ marklogicdb/marklogic-server " ,
33
- "image.tag" : "tag: 10.0-8.3-centos-1.0.0-ea3-test " ,
32
+ "image.repository" : "marklogicdb/marklogic-db " ,
33
+ "image.tag" : "latest " ,
34
34
"persistence.enabled" : "false" ,
35
+ "logging.enabled" : "false" ,
35
36
},
36
37
KubectlOptions : k8s .NewKubectlOptions ("" , "" , namespaceName ),
37
38
}
@@ -47,8 +48,52 @@ func TestChartTemplate(t *testing.T) {
47
48
require .Equal (t , namespaceName , statefulset .Namespace )
48
49
49
50
// Verify the image matches
50
- expectedImage := "store/ marklogicdb/marklogic-server:tag: 10.0-8.3-centos-1.0.0-ea3-test "
51
+ expectedImage := "marklogicdb/marklogic-db:latest "
51
52
statefulSetContainers := statefulset .Spec .Template .Spec .Containers
52
53
require .Equal (t , len (statefulSetContainers ), 1 )
53
54
require .Equal (t , statefulSetContainers [0 ].Image , expectedImage )
54
55
}
56
+
57
+ func TestChartTemplateLogging (t * testing.T ) {
58
+ t .Parallel ()
59
+
60
+ // Path to the helm chart we will test
61
+ helmChartPath , err := filepath .Abs ("../../charts" )
62
+ releaseName := "marklogic-test"
63
+ t .Log (helmChartPath , releaseName )
64
+ require .NoError (t , err )
65
+
66
+ // Set up the namespace; confirm that the template renders the expected value for the namespace.
67
+ namespaceName := "marklogic-" + strings .ToLower (random .UniqueId ())
68
+ t .Logf ("Namespace: %s\n " , namespaceName )
69
+
70
+ // Setup the args for helm install
71
+ options := & helm.Options {
72
+ SetValues : map [string ]string {
73
+ "image.repository" : "marklogicdb/marklogic-db" ,
74
+ "image.tag" : "latest" ,
75
+ "persistence.enabled" : "false" ,
76
+ "logging.enabled" : "true" ,
77
+ },
78
+ KubectlOptions : k8s .NewKubectlOptions ("" , "" , namespaceName ),
79
+ }
80
+
81
+ // render the tempate
82
+ output := helm .RenderTemplate (t , options , helmChartPath , releaseName , []string {"templates/statefulset.yaml" })
83
+
84
+ var statefulset appsv1.Deployment
85
+ helm .UnmarshalK8SYaml (t , output , & statefulset )
86
+ // t.Log(statefulset)
87
+
88
+ // Verify the name and namespace matches
89
+ require .Equal (t , namespaceName , statefulset .Namespace )
90
+
91
+ // Verify the image matches
92
+ expectedImage1 := "marklogicdb/marklogic-db:latest"
93
+ expectedImage2 := "fluent/fluent-bit:1.9.7"
94
+
95
+ statefulSetContainers := statefulset .Spec .Template .Spec .Containers
96
+ require .Equal (t , len (statefulSetContainers ), 2 )
97
+ require .Equal (t , statefulSetContainers [0 ].Image , expectedImage1 )
98
+ require .Equal (t , statefulSetContainers [1 ].Image , expectedImage2 )
99
+ }
0 commit comments