Skip to content

Commit 57af2c6

Browse files
committed
adjust autotest
1 parent 259fd52 commit 57af2c6

File tree

2 files changed

+24
-29
lines changed

2 files changed

+24
-29
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ HELM_DOCS_VERSION ?= v1.13.1
270270
# renovate: datasource=github-tags depName=mikefarah/yq
271271
YQ_VERSION ?= v4.44.1
272272
# renovate: datasource=github-tags depName=onsi/ginkgo
273-
GINKGO_VERSION ?= v2.17.3
273+
GINKGO_VERSION ?= v2.19.0
274274

275275
## Tool install scripts
276276
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"

test/e2e/e2e_test.go

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"fmt"
2121
"os"
2222
"os/exec"
23-
"sync"
2423
"time"
2524

2625
. "github.com/onsi/ginkgo/v2"
@@ -76,8 +75,6 @@ var _ = Describe("etcd-operator", Ordered, func() {
7675
Context("Simple", func() {
7776
It("should deploy etcd cluster", func() {
7877
const namespace = "test-simple-etcd-cluster"
79-
var wg sync.WaitGroup
80-
wg.Add(1)
8178

8279
CreateNamespace(namespace)
8380
DeferCleanup(DeleteNamespaceCB(namespace))
@@ -96,14 +93,14 @@ var _ = Describe("etcd-operator", Ordered, func() {
9693

9794
var etcdClient *clientv3.Client
9895

99-
By("get etcd client", func() {
100-
etcdClient, err := utils.GetEtcdClient(ctx, client.ObjectKey{Namespace: namespace, Name: "test"})
96+
// By("get etcd client", func() {
97+
etcdClient, err := utils.GetEtcdClient(ctx, client.ObjectKey{Namespace: namespace, Name: "test"})
98+
Expect(err).NotTo(HaveOccurred())
99+
defer func() {
100+
err := etcdClient.Close()
101101
Expect(err).NotTo(HaveOccurred())
102-
defer func() {
103-
err := etcdClient.Close()
104-
Expect(err).NotTo(HaveOccurred())
105-
}()
106-
})
102+
}()
103+
// })
107104

108105
By("check etcd cluster is healthy", func() {
109106
Expect(utils.IsEtcdClusterHealthy(ctx, etcdClient)).To(BeTrue())
@@ -116,8 +113,6 @@ var _ = Describe("etcd-operator", Ordered, func() {
116113
It("should deploy etcd cluster with auth", func() {
117114
var err error
118115
const namespace = "test-tls-auth-etcd-cluster"
119-
var wg sync.WaitGroup
120-
wg.Add(1)
121116

122117
By("create namespace", func() {
123118
cmd := exec.Command("sh", "-c", fmt.Sprintf("kubectl create namespace %s --dry-run=client -o yaml | kubectl apply -f -", namespace)) //nolint:lll
@@ -138,7 +133,7 @@ var _ = Describe("etcd-operator", Ordered, func() {
138133
By("wait for statefulset is ready", func() {
139134
cmd := exec.Command("kubectl", "wait",
140135
"statefulset/test",
141-
"--for", "jsonpath={.status.availableReplicas}=3",
136+
"--for", "jsonpath={.status.readyReplicas}=3",
142137
"--namespace", namespace,
143138
"--timeout", "5m",
144139
)
@@ -148,14 +143,14 @@ var _ = Describe("etcd-operator", Ordered, func() {
148143

149144
var etcdClient *clientv3.Client
150145

151-
By("get etcd client", func() {
152-
etcdClient, err := utils.GetEtcdClient(ctx, client.ObjectKey{Namespace: namespace, Name: "test"})
146+
// By("get etcd client", func() {
147+
etcdClient, err = utils.GetEtcdClient(ctx, client.ObjectKey{Namespace: namespace, Name: "test"})
148+
Expect(err).NotTo(HaveOccurred())
149+
defer func() {
150+
err := etcdClient.Close()
153151
Expect(err).NotTo(HaveOccurred())
154-
defer func() {
155-
err := etcdClient.Close()
156-
Expect(err).NotTo(HaveOccurred())
157-
}()
158-
})
152+
}()
153+
// })
159154

160155
By("check etcd cluster is healthy", func() {
161156
Expect(utils.IsEtcdClusterHealthy(ctx, etcdClient)).To(BeTrue())
@@ -200,14 +195,14 @@ var _ = Describe("etcd-operator", Ordered, func() {
200195

201196
var etcdClient *clientv3.Client
202197

203-
By("get etcd client", func() {
204-
etcdClient, err := utils.GetEtcdClient(ctx, client.ObjectKey{Namespace: namespace, Name: "test"})
198+
// By("get etcd client", func() {
199+
etcdClient, err := utils.GetEtcdClient(ctx, client.ObjectKey{Namespace: namespace, Name: "test"})
200+
Expect(err).NotTo(HaveOccurred())
201+
defer func() {
202+
err := etcdClient.Close()
205203
Expect(err).NotTo(HaveOccurred())
206-
defer func() {
207-
err := etcdClient.Close()
208-
Expect(err).NotTo(HaveOccurred())
209-
}()
210-
})
204+
}()
205+
// })
211206

212207
WaitSTSReady("statefulset/test", namespace)
213208

@@ -312,7 +307,7 @@ func WaitSTSReady(stsName, namespace string) {
312307
By("wait for statefulset is ready", func() {
313308
cmd := exec.Command("kubectl", "wait",
314309
stsName,
315-
"--for", "jsonpath={.status.availableReplicas}=3",
310+
"--for", "jsonpath={.status.readyReplicas}=3",
316311
"--namespace", namespace,
317312
"--timeout", "5m",
318313
)

0 commit comments

Comments
 (0)