Skip to content

Commit ca9e12f

Browse files
ChunyiLyuJonathan Tsang
and
Jonathan Tsang
committed
Add make smoke-test target
- separate out a single 'smoke-test' from our system tests [#170954291] Co-authored-by: Jonathan Tsang <[email protected]>
1 parent 8f46ac0 commit ca9e12f

File tree

2 files changed

+43
-26
lines changed

2 files changed

+43
-26
lines changed

Diff for: Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,12 @@ kind-unprepare: ## Remove KIND support for LoadBalancer services, and local-pat
150150
@kubectl delete -f https://raw.githubusercontent.com/pivotal-k8s/kind-on-c/master/metallb-cm.yaml
151151
@kubectl delete -f https://raw.githubusercontent.com/danderson/metallb/v0.8.1/manifests/metallb.yaml
152152

153-
system-tests: ## Run system tests
153+
system-tests:
154154
NAMESPACE="pivotal-rabbitmq-system" ginkgo -nodes=3 --randomizeAllSpecs -r system_tests/
155155

156+
smoke-test:
157+
NAMESPACE="pivotal-rabbitmq-system" ginkgo --focus="Publish and consume a message" -r system_tests/
158+
156159
DOCKER_REGISTRY_SECRET=p-rmq-registry-access
157160
DOCKER_REGISTRY_SERVER=registry.pivotal.io
158161
DOCKER_REGISTRY_USERNAME_LOCAL=$(shell lpassd show "Shared-RabbitMQ for Kubernetes/pivnet-registry-ci" --notes | jq -r .name)

Diff for: system_tests/system_tests.go

+39-25
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ import (
1616
)
1717

1818
const (
19-
podCreationTimeout = 360 * time.Second
20-
serviceCreationTimeout = 10 * time.Second
21-
ingressServiceSuffix = "ingress"
22-
statefulSetSuffix = "server"
23-
configMapSuffix = "server-conf"
19+
podCreationTimeout = 360 * time.Second
20+
ingressServiceSuffix = "ingress"
21+
statefulSetSuffix = "server"
2422
)
2523

2624
var _ = Describe("Operator", func() {
@@ -35,7 +33,7 @@ var _ = Describe("Operator", func() {
3533
Expect(err).NotTo(HaveOccurred())
3634
})
3735

38-
Context("Initial RabbitmqCluster setup", func() {
36+
Context("Publish and consume a message", func() {
3937
var (
4038
cluster *rabbitmqv1beta1.RabbitmqCluster
4139
hostname string
@@ -92,30 +90,46 @@ var _ = Describe("Operator", func() {
9290

9391
Expect(err).NotTo(HaveOccurred())
9492
})
93+
})
94+
})
9595

96-
By("publishing a message", func() {
97-
err := rabbitmqPublishToNewQueue(hostname, username, password)
98-
Expect(err).NotTo(HaveOccurred())
99-
})
96+
Context("Persistence", func() {
97+
var (
98+
cluster *rabbitmqv1beta1.RabbitmqCluster
99+
hostname string
100+
username string
101+
password string
102+
)
100103

101-
By("updating the CR status correctly", func() {
102-
Expect(clientSet.CoreV1().Pods(namespace).Delete(statefulSetPodName(cluster, 0), &metav1.DeleteOptions{})).NotTo(HaveOccurred())
104+
BeforeEach(func() {
105+
cluster = generateRabbitmqCluster(namespace, "persistence-rabbit")
106+
cluster.Spec.Service.Type = "LoadBalancer"
107+
cluster.Spec.Image = "registry.pivotal.io/p-rabbitmq-for-kubernetes-staging/rabbitmq:latest"
108+
cluster.Spec.ImagePullSecret = "p-rmq-registry-access"
109+
cluster.Spec.Resources = &corev1.ResourceRequirements{
110+
Requests: map[corev1.ResourceName]k8sresource.Quantity{},
111+
Limits: map[corev1.ResourceName]k8sresource.Quantity{},
112+
}
113+
Expect(createRabbitmqCluster(rmqClusterClient, cluster)).NotTo(HaveOccurred())
103114

104-
Eventually(func() []byte {
105-
output, err := kubectl(
106-
"-n",
107-
cluster.Namespace,
108-
"get",
109-
"rabbitmqclusters",
110-
cluster.Name,
111-
"-o=jsonpath='{.status.clusterStatus}'",
112-
)
113-
Expect(err).NotTo(HaveOccurred())
114-
return output
115+
waitForRabbitmqRunning(cluster)
115116

116-
}, 20, 1).Should(ContainSubstring("created"))
117+
hostname = rabbitmqHostname(clientSet, cluster)
117118

118-
waitForRabbitmqRunning(cluster)
119+
var err error
120+
username, password, err = getRabbitmqUsernameAndPassword(clientSet, cluster.Namespace, cluster.Name)
121+
Expect(err).NotTo(HaveOccurred())
122+
assertHttpReady(hostname)
123+
})
124+
125+
AfterEach(func() {
126+
Expect(rmqClusterClient.Delete(context.TODO(), cluster)).To(Succeed())
127+
})
128+
129+
It("persists messages after pod deletion", func() {
130+
By("publishing a message", func() {
131+
err := rabbitmqPublishToNewQueue(hostname, username, password)
132+
Expect(err).NotTo(HaveOccurred())
119133
})
120134

121135
By("consuming a message after RabbitMQ was restarted", func() {

0 commit comments

Comments
 (0)