Skip to content

Commit

Permalink
fix auth in address tests
Browse files Browse the repository at this point in the history
Signed-off-by: ruromero <[email protected]>
  • Loading branch information
ruromero committed Jan 10, 2023
1 parent 78f37bc commit a12f43b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions controllers/activemqartemisaddress_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ import (
"k8s.io/client-go/tools/remotecommand"
)

var JOLOKIA_AUTH = jolokia.BasicAuth{
User: "admin",
Password: "admin1!",
}

var _ = Describe("Address controller tests", func() {

Context("address queue config defaults", Label("queue-config-defaults"), func() {
Expand All @@ -56,7 +61,10 @@ var _ = Describe("Address controller tests", func() {
anycastType := "ANYCAST"
It("configurationManaged default should be true (without queue configuration)", func() {
By("deploy a broker cr")
brokerCr, createdBrokerCr := DeployCustomBroker(defaultNamespace, nil)
brokerCr, createdBrokerCr := DeployCustomBroker(defaultNamespace, func(candidate *brokerv1beta1.ActiveMQArtemis) {
candidate.Spec.AdminUser = JOLOKIA_AUTH.User
candidate.Spec.AdminPassword = JOLOKIA_AUTH.Password
})

By("deploy an address cr")
addressCr, createdAddressCr := DeployCustomAddress(defaultNamespace, func(candidate *brokerv1beta1.ActiveMQArtemisAddress) {
Expand Down Expand Up @@ -88,7 +96,10 @@ var _ = Describe("Address controller tests", func() {

It("configurationManaged default should be true (with queue configuration)", func() {
By("deploy a broker cr")
brokerCr, createdBrokerCr := DeployCustomBroker(defaultNamespace, nil)
brokerCr, createdBrokerCr := DeployCustomBroker(defaultNamespace, func(candidate *brokerv1beta1.ActiveMQArtemis) {
candidate.Spec.AdminUser = JOLOKIA_AUTH.User
candidate.Spec.AdminPassword = JOLOKIA_AUTH.Password
})

By("deploy an address cr")
addressCr, createdAddressCr := DeployCustomAddress(defaultNamespace, func(candidate *brokerv1beta1.ActiveMQArtemisAddress) {
Expand Down Expand Up @@ -1162,7 +1173,7 @@ func CheckQueueAttribute(brokerCrName string, podName string, namespace string,
pod := &corev1.Pod{}
Eventually(func(g Gomega) {
g.Expect(k8sClient.Get(ctx, podKey, pod)).Should(Succeed())
jolokia := jolokia.GetJolokia(pod.Status.PodIP, "8161", "/console/jolokia", &jolokia.BasicAuth{}, "http")
jolokia := jolokia.GetJolokia(pod.Status.PodIP, "8161", "/console/jolokia", &JOLOKIA_AUTH, "http")
data, err := jolokia.Read("org.apache.activemq.artemis:broker=\"amq-broker\",address=\"" + addressName + "\",component=addresses,queue=\"" + queueName + "\",routing-type=\"" + routingType + "\",subcomponent=queues/" + attrName)
g.Expect(err).To(BeNil())
g.Expect(data.Value).Should(ContainSubstring(attrValueAsString), data.Value)
Expand Down

0 comments on commit a12f43b

Please sign in to comment.