...

Source file src/github.com/redhat-developer/odo/pkg/testingutil/pods.go

Documentation: github.com/redhat-developer/odo/pkg/testingutil

     1  package testingutil
     2  
     3  import (
     4  	corev1 "k8s.io/api/core/v1"
     5  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     6  
     7  	odolabels "github.com/redhat-developer/odo/pkg/labels"
     8  )
     9  
    10  // CreateFakePod creates a fake pod with the given pod name and component name
    11  func CreateFakePod(componentName, podName, containerName string) *corev1.Pod {
    12  	fakePod := &corev1.Pod{
    13  		ObjectMeta: metav1.ObjectMeta{
    14  			Name:   podName,
    15  			Labels: odolabels.GetLabels(componentName, "app", "", odolabels.ComponentDevMode, false),
    16  		},
    17  		Spec: corev1.PodSpec{
    18  			Containers: []corev1.Container{
    19  				{
    20  					Name: containerName,
    21  				},
    22  			},
    23  		},
    24  		Status: corev1.PodStatus{
    25  			Phase: corev1.PodRunning,
    26  		},
    27  	}
    28  	return fakePod
    29  }
    30  

View as plain text