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

e2e test tests #220

Closed
wants to merge 15 commits into from
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ go 1.12

require (
github.com/GoogleCloudPlatform/spark-on-k8s-operator v0.0.0-20200817155620-c19d2b8660d8
github.com/apache/incubator-yunikorn-core v0.0.0-20210113182138-361d455c7f28
github.com/apache/incubator-yunikorn-core v0.0.0-20210126031445-dec073221f5f
github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20210106054514-49c4f33ed27b
github.com/google/uuid v1.1.1
github.com/looplab/fsm v0.1.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ github.com/apache/incubator-yunikorn-core v0.0.0-20210106054125-dcf631d5c6b5 h1:
github.com/apache/incubator-yunikorn-core v0.0.0-20210106054125-dcf631d5c6b5/go.mod h1:d/fn47kdGd094NHiysHAY+0d4evpYRFQ6q5b9eaBONo=
github.com/apache/incubator-yunikorn-core v0.0.0-20210113182138-361d455c7f28 h1:7NO76ZYnYtrdC8CT+ZjBKsezSzviYwDjW9DzVu090/M=
github.com/apache/incubator-yunikorn-core v0.0.0-20210113182138-361d455c7f28/go.mod h1:IhX7VztC5z9LfPVKTIkbkuisl+2CLum0neLVMF+hfXM=
github.com/apache/incubator-yunikorn-core v0.0.0-20210126031445-dec073221f5f h1:Z8jT6NQ7is9bYuNO3XDlrCYT4XpyY/LxNc5CAFmxzp8=
github.com/apache/incubator-yunikorn-core v0.0.0-20210126031445-dec073221f5f/go.mod h1:IhX7VztC5z9LfPVKTIkbkuisl+2CLum0neLVMF+hfXM=
github.com/apache/incubator-yunikorn-scheduler-interface v0.0.0-20210106054514-49c4f33ed27b/go.mod h1:ObMs03XFbnmpGD81jYvdUDEVZbHvz8W6dWH5nGDCjc0=
github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20200901200728-b9033558f319 h1:I12nCcXdHe6W4oysVejFHfQDy0Ix0r+ZHdfooyEoldo=
github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20200901200728-b9033558f319/go.mod h1:ObMs03XFbnmpGD81jYvdUDEVZbHvz8W6dWH5nGDCjc0=
Expand Down
1 change: 1 addition & 0 deletions pkg/shim/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ func (ss *KubernetesShim) enterState(event *fsm.Event) {

func (ss *KubernetesShim) stop() {
log.Logger().Info("stopping scheduler")
log.Logger().Info("this is a test")
select {
case ss.stopChan <- struct{}{}:
// stop the dispatcher
Expand Down
12 changes: 12 additions & 0 deletions test/e2e/framework/helpers/k8s/k8s_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"path/filepath"
"time"

"github.com/onsi/ginkgo"
podutil "k8s.io/kubernetes/pkg/api/v1/pod"

"github.com/apache/incubator-yunikorn-k8shim/test/e2e/framework/helpers/common"
Expand Down Expand Up @@ -228,6 +229,7 @@ func (k *KubeCtl) DeletePod(podName string, namespace string) error {
func (k *KubeCtl) isPodInDesiredState(podName string, namespace string, state v1.PodPhase) wait.ConditionFunc {
return func() (bool, error) {
pod, err := k.clientSet.CoreV1().Pods(namespace).Get(podName, metav1.GetOptions{})

if err != nil {
return false, err
}
Expand Down Expand Up @@ -304,6 +306,16 @@ func (k *KubeCtl) WaitForPodBySelectorRunning(namespace string, selector string,

for _, pod := range podList.Items {
if err := k.WaitForPodRunning(namespace, pod.Name, time.Duration(timeout)*time.Second); err != nil {
ginkgo.By(fmt.Sprintf("expected pod state: Running, actual state: %s", pod.Status.Phase))
events := k.clientSet.CoreV1().Events(namespace)
if podEvents, podEventError := events.List(metav1.ListOptions{
FieldSelector: fmt.Sprintf("involvedObject.name=%s,involvedObject.namespace=%s", pod.Name, pod.Namespace)}); podEventError == nil {
for _, pe := range podEvents.Items {
ginkgo.By(fmt.Sprint(pe.String()))
}
} else {
ginkgo.By("Unable to get pod event")
}
return err
}
}
Expand Down