@@ -6,31 +6,26 @@ import (
6
6
"io/ioutil"
7
7
"net/http"
8
8
"os"
9
- "path/filepath"
10
9
"strings"
11
10
"testing"
12
11
"time"
13
12
14
- "github.com/gruntwork-io/terratest/modules/helm"
15
13
http_helper "github.com/gruntwork-io/terratest/modules/http-helper"
16
14
"github.com/gruntwork-io/terratest/modules/k8s"
17
15
"github.com/gruntwork-io/terratest/modules/random"
16
+ "github.com/marklogic/marklogic-kubernetes/test/testUtil"
18
17
"github.com/stretchr/testify/assert"
19
18
"github.com/tidwall/gjson"
20
19
digestAuth "github.com/xinsnake/go-http-digest-auth-client"
21
20
)
22
21
23
22
func TestHelmInstall (t * testing.T ) {
24
- // Path to the helm chart we will test
25
- helmChartPath , e := filepath .Abs ("../../charts" )
26
- if e != nil {
27
- t .Fatalf (e .Error ())
28
- }
29
- imageRepo , repoPres := os .LookupEnv ("dockerRepository" )
30
- imageTag , tagPres := os .LookupEnv ("dockerVersion" )
31
23
var resp * http.Response
32
24
var body []byte
33
25
var err error
26
+ var podName string
27
+ imageRepo , repoPres := os .LookupEnv ("dockerRepository" )
28
+ imageTag , tagPres := os .LookupEnv ("dockerVersion" )
34
29
35
30
if ! repoPres {
36
31
imageRepo = "marklogic-centos/marklogic-server-centos"
@@ -42,31 +37,28 @@ func TestHelmInstall(t *testing.T) {
42
37
t .Logf ("No imageTag variable present, setting to default value: " + imageTag )
43
38
}
44
39
40
+ options := map [string ]string {
41
+ "persistence.enabled" : "false" ,
42
+ "replicaCount" : "2" ,
43
+ "image.repository" : imageRepo ,
44
+ "image.tag" : imageTag ,
45
+ "logCollection.enabled" : "false" ,
46
+ }
47
+ t .Logf ("====Installing Helm Chart" )
48
+ releaseName := "test-install"
49
+
45
50
namespaceName := "marklogic-" + strings .ToLower (random .UniqueId ())
46
51
kubectlOptions := k8s .NewKubectlOptions ("" , "" , namespaceName )
47
- options := & helm.Options {
48
- KubectlOptions : kubectlOptions ,
49
- SetValues : map [string ]string {
50
- "persistence.enabled" : "false" ,
51
- "replicaCount" : "2" ,
52
- "image.repository" : imageRepo ,
53
- "image.tag" : imageTag ,
54
- "logCollection.enabled" : "false" ,
55
- },
56
- }
57
52
58
53
t .Logf ("====Creating namespace: " + namespaceName )
59
54
k8s .CreateNamespace (t , kubectlOptions , namespaceName )
60
55
61
56
defer t .Logf ("====Deleting namespace: " + namespaceName )
62
57
defer k8s .DeleteNamespace (t , kubectlOptions , namespaceName )
63
58
64
- t .Logf ("====Installing Helm Chart" )
65
- releaseName := "test-install"
66
- helm .Install (t , options , helmChartPath , releaseName )
59
+ podName = testUtil .HelmInstall (t , options , releaseName , kubectlOptions )
67
60
68
61
tlsConfig := tls.Config {}
69
- podName := releaseName + "-marklogic-0"
70
62
// wait until the pod is in Ready status
71
63
k8s .WaitUntilPodAvailable (t , kubectlOptions , podName , 10 , 15 * time .Second )
72
64
tunnel7997 := k8s .NewTunnel (kubectlOptions , k8s .ResourceTypePod , podName , 7997 , 7997 )
0 commit comments