Skip to content

Commit

Permalink
Make "age" of pod print example static
Browse files Browse the repository at this point in the history
  • Loading branch information
janetkuo committed Jul 8, 2015
1 parent 56da0be commit 524e70d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/kubectl/cmd/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"os"
"reflect"
"testing"
"time"

"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
Expand All @@ -35,6 +36,7 @@ import (
cmdutil "github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/resource"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
)

type internalType struct {
Expand Down Expand Up @@ -291,8 +293,11 @@ func ExamplePrintPodWithWideFormat() {
}
nodeName := "kubernetes-minion-abcd"
cmd := NewCmdRun(f, os.Stdout)
ctrl := &api.Pod{
ObjectMeta: api.ObjectMeta{Name: "test1"},
pod := &api.Pod{
ObjectMeta: api.ObjectMeta{
Name: "test1",
CreationTimestamp: util.Time{time.Now().AddDate(-10, 0, 0)},
},
Spec: api.PodSpec{
Containers: make([]api.Container, 2),
NodeName: nodeName,
Expand All @@ -305,13 +310,13 @@ func ExamplePrintPodWithWideFormat() {
},
},
}
err := f.PrintObject(cmd, ctrl, os.Stdout)
err := f.PrintObject(cmd, pod, os.Stdout)
if err != nil {
fmt.Printf("Unexpected error: %v", err)
}
// Output:
// NAME READY STATUS RESTARTS AGE NODE
// test1 1/2 podPhase 6 292y kubernetes-minion-abcd
// test1 1/2 podPhase 6 10y kubernetes-minion-abcd
}

func TestNormalizationFuncGlobalExistance(t *testing.T) {
Expand Down

0 comments on commit 524e70d

Please sign in to comment.