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

Tests for containerstatus and livenssprobe #1347

Open
wants to merge 7 commits into
base: ci_prod
Choose a base branch
from

Conversation

suyadav1
Copy link
Contributor

This PR is the part-1 of end-to-end test automation framework. In this PR, I have added tests for containerstatus and livenessprobe. The changes are similar to Prometheus tests.

ToDo:
Add tests for LAW queries.
Add a readme file.

Tests:
Tested the changes on the local cluster and ci-cd cluster with a test pipeline.

@suyadav1 suyadav1 requested a review from a team as a code owner January 31, 2025 01:42
* Returns all pods in the given namespace with the given label.
*/
func GetPodsWithLabel(clientset *kubernetes.Clientset, namespace string, labelKey string, labelValue string) ([]corev1.Pod, error) {
podList, err := clientset.CoreV1().Pods(namespace).List(context.TODO(), metav1.ListOptions{

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality

Suspicious comment
func CheckIfAllPodsScheduleOnNodes(clientset *kubernetes.Clientset, namespace, labelKey string, labelValue string, osLabel string) error {

// Get list of all nodes
nodes, err := clientset.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality

Suspicious comment
for _, node := range nodes.Items {
if node.Labels["beta.kubernetes.io/os"] == osLabel {
// Get list of pods scheduled on this node
pods, err := clientset.CoreV1().Pods(namespace).List(context.TODO(), metav1.ListOptions{

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality

Suspicious comment
func CheckIfAllPodsScheduleOnSpecificNodesLabels(clientset *kubernetes.Clientset, namespace, labelKey string, labelValue string, nodeLabelKey string, nodeLabelValue string) error {

// Get list of all nodes
nodes, err := clientset.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality

Suspicious comment
if value, ok := node.Labels[nodeLabelKey]; ok && value == nodeLabelValue {

// Get list of pods scheduled on this node
pods, err := clientset.CoreV1().Pods(namespace).List(context.TODO(), metav1.ListOptions{

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality

Suspicious comment
ganga1980
ganga1980 previously approved these changes Jan 31, 2025
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.

3 participants