EvenPodsSpread: integration test

This commit is contained in:
Wei Huang
2019-07-10 15:59:07 -07:00
parent 270d9529e0
commit caab8b74ba
7 changed files with 356 additions and 17 deletions

View File

@@ -17,10 +17,14 @@ limitations under the License.
package testing
import (
"fmt"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
var zero int64
// NodeSelectorWrapper wraps a NodeSelector inside.
type NodeSelectorWrapper struct{ v1.NodeSelector }
@@ -152,6 +156,27 @@ func (p *PodWrapper) Namespace(s string) *PodWrapper {
return p
}
// Container appends a container into PodSpec of the inner pod.
func (p *PodWrapper) Container(s string) *PodWrapper {
p.Spec.Containers = append(p.Spec.Containers, v1.Container{
Name: fmt.Sprintf("con%d", len(p.Spec.Containers)),
Image: s,
})
return p
}
// Priority sets a priority value into PodSpec of the inner pod.
func (p *PodWrapper) Priority(val int32) *PodWrapper {
p.Spec.Priority = &val
return p
}
// ZeroTerminationGracePeriod sets the TerminationGracePeriodSeconds of the inner pod to zero.
func (p *PodWrapper) ZeroTerminationGracePeriod() *PodWrapper {
p.Spec.TerminationGracePeriodSeconds = &zero
return p
}
// Node sets `s` as the nodeName of the inner pod.
func (p *PodWrapper) Node(s string) *PodWrapper {
p.Spec.NodeName = s