Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: added test cases for statefulset update, pdb, hpa, ingress & co… #56

Merged
merged 1 commit into from
May 9, 2023

Conversation

avtarOPS
Copy link
Contributor

@avtarOPS avtarOPS commented May 8, 2023

Improves #42

Description

This PR includes additional test cases to check for :-

  • Statefulset
  • Poddisruptionbudget
  • Horizontalpodautoscaler
  • Ingress
  • ConfigMaps

It also includes update for ingress in druid-smoke-test-cluster.yaml file.


This PR has:

  • been tested on a real K8S cluster to ensure creation of a brand new Druid cluster works.
  • been tested for backward compatibility on a real K*S cluster by applying the changes introduced here on an existing Druid cluster. If there are any backward incompatible changes then they have been noted in the PR description.
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added documentation for new or modified features or behaviors.

Key changed/added files in this PR
  • controllers/druid/druid_controller_test.go
  • controllers/druid/testdata/druid-smoke-test-cluster.yaml

Comment on lines +198 to +217
for _, componentName := range druidComponents {
componentName := componentName
It(fmt.Sprintf("Test kubernetes service for %s", componentName), func() {
createdService := &v1.Service{}
serviceName := fmt.Sprintf("druid-%s-%s", druidCR.Name, componentName)
serviceNamespacedName := types.NamespacedName{Name: serviceName, Namespace: druidCR.Namespace}

// Checking the kubernetes service Type
By(fmt.Sprintf("By checking kubernetes service type %s ", serviceName))
Eventually(func() bool {
err := k8sClient.Get(context.TODO(), serviceNamespacedName, createdService)
return err == nil
}, timeout, interval).Should(BeTrue())
Expect(createdService.Spec.Type).To(Equal(druidCR.Spec.Services[0].Spec.Type))
// Kubernetes service check for targetport and port
By(fmt.Sprintf("By checking kubernetes service port for %s ", serviceName))
Expect(createdService.Spec.Ports[0].Port).To(Equal(druidCR.Spec.Nodes[componentName].DruidPort))
Expect(createdService.Spec.Ports[0].TargetPort.IntVal).To(Equal(druidCR.Spec.Nodes[componentName].DruidPort))
})
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: I had one more test in mind to assert the annotations in. a service. To enable cloud loadbalancers, druid CR nodespec.service supports adding annotations, those scenarios can also be asserted.
We can take that in a separate PR also.

@AdheipSingh AdheipSingh merged commit 003d13d into datainfrahq:master May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants