Skip to content

Commit cad97fd

Browse files
pengzhoumlPeng Zhou
andauthored
MLE-17367 E2E Test for TLS (#45)
* update test to accept cli flags * Added Named Cert E2E Test * add ednode for TLS * update the README according to review * fixed test failure * fix test failuire * fix test failure --------- Co-authored-by: Peng Zhou <[email protected]>
1 parent 4706e50 commit cad97fd

File tree

15 files changed

+608
-7
lines changed

15 files changed

+608
-7
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ test: manifests generate fmt vet envtest ## Run tests.
123123
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test -v $$(go list ./... | grep -v /e2e) -coverprofile cover.out
124124

125125
# Utilize minikube or modify the e2e tests to load the image locally, enabling compatibility with other vendors.
126+
# To run specific e2e test with label, try go test -v ./test/e2e -count=1 -args --labels="type=tls-multi-node"
126127
.PHONY: e2e-test # Run the e2e tests against a minikube k8s instance that is spun up.
127128
e2e-test:
128129
@echo "=====Setting hugepages value to 1280 for hugepages-e2e test"

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ require (
77
github.com/go-logr/logr v1.4.2
88
github.com/onsi/ginkgo/v2 v2.19.0
99
github.com/onsi/gomega v1.33.1
10+
github.com/tidwall/gjson v1.17.3
1011
k8s.io/api v0.31.1
1112
k8s.io/apiextensions-apiserver v0.31.0
1213
k8s.io/apimachinery v0.31.1
@@ -55,6 +56,8 @@ require (
5556
github.com/prometheus/common v0.55.0 // indirect
5657
github.com/prometheus/procfs v0.15.1 // indirect
5758
github.com/spf13/pflag v1.0.5 // indirect
59+
github.com/tidwall/match v1.1.1 // indirect
60+
github.com/tidwall/pretty v1.2.0 // indirect
5861
github.com/vladimirvivien/gexe v0.3.0 // indirect
5962
github.com/x448/float16 v0.8.4 // indirect
6063
go.uber.org/multierr v1.11.0 // indirect

go.sum

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
116116
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
117117
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
118118
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
119+
github.com/tidwall/gjson v1.17.3 h1:bwWLZU7icoKRG+C+0PNwIKC6FCJO/Q3p2pZvuP0jN94=
120+
github.com/tidwall/gjson v1.17.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
121+
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
122+
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
123+
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
124+
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
119125
github.com/vladimirvivien/gexe v0.3.0 h1:4xwiOwGrDob5OMR6E92B9olDXYDglXdHhzR1ggYtWJM=
120126
github.com/vladimirvivien/gexe v0.3.0/go.mod h1:fp7cy60ON1xjhtEI/+bfSEIXX35qgmI+iRYlGOqbBFM=
121127
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=

test/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Test MarkLogic Kubernetes Operator with e2e-framework
2+
3+
## How to run the test
4+
5+
```
6+
make e2e-setup-minikube
7+
make e2e-test
8+
make e2e-delete-minikube
9+
```
10+
11+
Each test is assigned a “type” label, allowing you to run only the tests of a specified type.
12+
13+
For example, to run only the test for TLS named cert test:
14+
```
15+
go test -v ./test/e2e -count=1 -args --labels="type=tls-named-cert"
16+
```
17+
18+
To run only the TLS self signed cert test:
19+
```
20+
go test -v ./test/e2e -count=1 -args --labels="type=tls-self-signed"
21+
```

test/e2e/2_marklogic_cluster_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ import (
2424
var verifyHugePages = flag.Bool("verifyHugePages", false, "Test hugePages configuration")
2525

2626
const (
27-
groupName = "node"
28-
mlNamespace = "default"
27+
groupName = "node"
28+
mlNamespace = "default"
29+
mlContainerName = "marklogic-server"
2930
)
3031

3132
var (
@@ -59,7 +60,7 @@ var (
5960
)
6061

6162
func TestMarklogicCluster(t *testing.T) {
62-
feature := features.New("MarklogicCluster Resource")
63+
feature := features.New("Marklogic Cluster Test")
6364

6465
// Assessment for MarklogicCluster creation
6566
feature.Setup(func(ctx context.Context, t *testing.T, c *envconf.Config) context.Context {
@@ -97,7 +98,7 @@ func TestMarklogicCluster(t *testing.T) {
9798
client := c.Client()
9899

99100
podName := "node-0"
100-
err := utils.WaitForPod(ctx, t, client, mlNamespace, podName, 90*time.Second)
101+
err := utils.WaitForPod(ctx, t, client, mlNamespace, podName, 120*time.Second)
101102
if err != nil {
102103
t.Fatalf("Failed to wait for pod creation: %v", err)
103104
}

test/e2e/3_ml_cluster_ednode_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ func TestMlClusterWithEdnode(t *testing.T) {
117117
client := c.Client()
118118

119119
podName := "dnode-0"
120-
err := utils.WaitForPod(ctx, t, client, mlClusterNs, podName, 90*time.Second)
120+
err := utils.WaitForPod(ctx, t, client, mlClusterNs, podName, 120*time.Second)
121121
if err != nil {
122122
t.Fatalf("Failed to wait for pod creation: %v", err)
123123
}
124124
epodName := "enode-0"
125-
err = utils.WaitForPod(ctx, t, client, mlClusterNs, epodName, 150*time.Second)
125+
err = utils.WaitForPod(ctx, t, client, mlClusterNs, epodName, 180*time.Second)
126126
if err != nil {
127127
t.Fatalf("Failed to wait for pod creation: %v", err)
128128
}

0 commit comments

Comments
 (0)