Skip to content

Tests for containerstatus and livenssprobe #1347

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

Merged
merged 6 commits into from
Feb 16, 2025

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
Copy link

github-actions bot commented Feb 8, 2025

This PR is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 5 days.

Copy link

This PR was closed because it has been stalled for 12 days with no activity.

@github-actions github-actions bot closed this Feb 13, 2025
@ganga1980 ganga1980 reopened this Feb 16, 2025
@ganga1980 ganga1980 merged commit 8c98ff7 into ci_prod Feb 16, 2025
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants