Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
62e492a2
Commit
62e492a2
authored
Jul 19, 2016
by
Phillip Wittrock
Committed by
GitHub
Jul 19, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #29223 from kubernetes/revert-28212-wait_pod
Revert "Switched watches in tests require ResourceVersion to be passed"
parents
f8711829
321c4103
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
62 additions
and
80 deletions
+62
-80
configmap.go
test/e2e/configmap.go
+2
-2
dns.go
test/e2e/dns.go
+1
-2
downwardapi_volume.go
test/e2e/downwardapi_volume.go
+4
-4
empty_dir_wrapper.go
test/e2e/empty_dir_wrapper.go
+2
-3
es_cluster_logging.go
test/e2e/es_cluster_logging.go
+2
-2
example_cluster_dns.go
test/e2e/example_cluster_dns.go
+1
-1
examples.go
test/e2e/examples.go
+7
-7
framework.go
test/e2e/framework/framework.go
+4
-4
util.go
test/e2e/framework/util.go
+19
-33
initial_resources.go
test/e2e/initial_resources.go
+1
-1
kibana_logging.go
test/e2e/kibana_logging.go
+1
-1
mesos.go
test/e2e/mesos.go
+1
-1
namespace.go
test/e2e/namespace.go
+1
-1
pods.go
test/e2e/pods.go
+5
-6
pre_stop.go
test/e2e/pre_stop.go
+4
-4
scheduler_predicates.go
test/e2e/scheduler_predicates.go
+0
-0
security_context.go
test/e2e/security_context.go
+2
-2
volumes.go
test/e2e/volumes.go
+5
-6
No files found.
test/e2e/configmap.go
View file @
62e492a2
...
...
@@ -131,10 +131,10 @@ var _ = framework.KubeDescribe("ConfigMap", func() {
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Delete
(
pod
.
Name
,
api
.
NewDeleteOptions
(
0
))
}()
By
(
"Creating the pod"
)
pod
,
err
=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Create
(
pod
)
_
,
err
=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Create
(
pod
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
pod
))
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
pod
.
Name
,
f
.
Namespace
.
Name
))
pollLogs
:=
func
()
(
string
,
error
)
{
return
framework
.
GetPodLogs
(
f
.
Client
,
f
.
Namespace
.
Name
,
pod
.
Name
,
containerName
)
...
...
test/e2e/dns.go
View file @
62e492a2
...
...
@@ -245,8 +245,7 @@ func verifyDNSPodIsRunning(f *framework.Framework) {
if
len
(
dnsPods
.
Items
)
<
1
{
framework
.
Failf
(
"No pods match the label selector %v"
,
dnsServiceLabelSelector
.
String
())
}
pod
:=
dnsPods
.
Items
[
0
]
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
&
pod
))
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
dnsPods
.
Items
[
0
]
.
Name
,
api
.
NamespaceSystem
))
}
func
createServiceSpec
(
serviceName
string
,
isHeadless
bool
,
selector
map
[
string
]
string
)
*
api
.
Service
{
...
...
test/e2e/downwardapi_volume.go
View file @
62e492a2
...
...
@@ -70,10 +70,10 @@ var _ = framework.KubeDescribe("Downward API volume", func() {
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Delete
(
pod
.
Name
,
api
.
NewDeleteOptions
(
0
))
}()
By
(
"Creating the pod"
)
pod
,
err
:=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Create
(
pod
)
_
,
err
:=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Create
(
pod
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
pod
))
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
pod
.
Name
,
f
.
Namespace
.
Name
))
Eventually
(
func
()
(
string
,
error
)
{
return
framework
.
GetPodLogs
(
f
.
Client
,
f
.
Namespace
.
Name
,
podName
,
containerName
)
...
...
@@ -103,9 +103,9 @@ var _ = framework.KubeDescribe("Downward API volume", func() {
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Delete
(
pod
.
Name
,
api
.
NewDeleteOptions
(
0
))
}()
By
(
"Creating the pod"
)
pod
,
err
:=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Create
(
pod
)
_
,
err
:=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Create
(
pod
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
pod
))
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
pod
.
Name
,
f
.
Namespace
.
Name
))
pod
,
err
=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Get
(
pod
.
Name
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
...
...
test/e2e/empty_dir_wrapper.go
View file @
62e492a2
...
...
@@ -152,8 +152,7 @@ var _ = framework.KubeDescribe("EmptyDir wrapper volumes", func() {
},
}
pod
,
err
=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Create
(
pod
)
if
err
!=
nil
{
if
pod
,
err
=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Create
(
pod
);
err
!=
nil
{
framework
.
Failf
(
"unable to create pod %v: %v"
,
pod
.
Name
,
err
)
}
...
...
@@ -176,6 +175,6 @@ var _ = framework.KubeDescribe("EmptyDir wrapper volumes", func() {
}
}()
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
pod
))
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
pod
.
Name
,
f
.
Namespace
.
Name
))
})
})
test/e2e/es_cluster_logging.go
View file @
62e492a2
...
...
@@ -99,7 +99,7 @@ func ClusterLevelLoggingWithElasticsearch(f *framework.Framework) {
pods
,
err
:=
f
.
Client
.
Pods
(
api
.
NamespaceSystem
)
.
List
(
options
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
for
_
,
pod
:=
range
pods
.
Items
{
err
=
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
&
pod
)
err
=
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
pod
.
Name
,
api
.
NamespaceSystem
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
}
...
...
@@ -227,7 +227,7 @@ func ClusterLevelLoggingWithElasticsearch(f *framework.Framework) {
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
for
_
,
pod
:=
range
fluentdPods
.
Items
{
if
nodeInNodeList
(
pod
.
Spec
.
NodeName
,
nodes
)
{
err
=
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
&
pod
)
err
=
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
pod
.
Name
,
api
.
NamespaceSystem
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
}
}
...
...
test/e2e/example_cluster_dns.go
View file @
62e492a2
...
...
@@ -139,7 +139,7 @@ var _ = framework.KubeDescribe("ClusterDns [Feature:Example]", func() {
// wait until the pods have been scheduler, i.e. are not Pending anymore. Remember
// that we cannot wait for the pods to be running because our pods terminate by themselves.
for
_
,
ns
:=
range
namespaces
{
err
:=
framework
.
WaitForPodNotPending
(
c
,
ns
.
Name
,
frontendPodName
,
""
)
err
:=
framework
.
WaitForPodNotPending
(
c
,
ns
.
Name
,
frontendPodName
)
framework
.
ExpectNoError
(
err
)
}
...
...
test/e2e/examples.go
View file @
62e492a2
...
...
@@ -79,7 +79,7 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() {
By
(
"starting redis bootstrap"
)
framework
.
RunKubectlOrDie
(
"create"
,
"-f"
,
bootstrapYaml
,
nsFlag
)
err
:=
framework
.
WaitForPod
Name
RunningInNamespace
(
c
,
bootstrapPodName
,
ns
)
err
:=
framework
.
WaitForPodRunningInNamespace
(
c
,
bootstrapPodName
,
ns
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
_
,
err
=
framework
.
LookForStringInLog
(
ns
,
bootstrapPodName
,
"master"
,
expectedOnServer
,
serverStartTimeout
)
...
...
@@ -308,7 +308,7 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() {
By
(
"starting Zookeeper"
)
framework
.
RunKubectlOrDie
(
"create"
,
"-f"
,
zookeeperPodJson
,
nsFlag
)
framework
.
RunKubectlOrDie
(
"create"
,
"-f"
,
zookeeperServiceJson
,
nsFlag
)
err
:=
framework
.
WaitForPod
Name
RunningInNamespace
(
c
,
zookeeperPod
,
ns
)
err
:=
framework
.
WaitForPodRunningInNamespace
(
c
,
zookeeperPod
,
ns
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
By
(
"checking if zookeeper is up and running"
)
...
...
@@ -320,7 +320,7 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() {
By
(
"starting Nimbus"
)
framework
.
RunKubectlOrDie
(
"create"
,
"-f"
,
nimbusPodJson
,
nsFlag
)
framework
.
RunKubectlOrDie
(
"create"
,
"-f"
,
nimbusServiceJson
,
nsFlag
)
err
=
framework
.
WaitForPod
Name
RunningInNamespace
(
c
,
"nimbus"
,
ns
)
err
=
framework
.
WaitForPodRunningInNamespace
(
c
,
"nimbus"
,
ns
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
err
=
framework
.
WaitForEndpoint
(
c
,
ns
,
"nimbus"
)
...
...
@@ -365,7 +365,7 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() {
var
wg
sync
.
WaitGroup
passed
:=
true
checkRestart
:=
func
(
podName
string
,
timeout
time
.
Duration
)
{
err
:=
framework
.
WaitForPod
Name
RunningInNamespace
(
c
,
podName
,
ns
)
err
:=
framework
.
WaitForPodRunningInNamespace
(
c
,
podName
,
ns
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
for
t
:=
time
.
Now
();
time
.
Since
(
t
)
<
timeout
;
time
.
Sleep
(
framework
.
Poll
)
{
pod
,
err
:=
c
.
Pods
(
ns
)
.
Get
(
podName
)
...
...
@@ -412,7 +412,7 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() {
By
(
"creating secret and pod"
)
framework
.
RunKubectlOrDie
(
"create"
,
"-f"
,
secretYaml
,
nsFlag
)
framework
.
RunKubectlOrDie
(
"create"
,
"-f"
,
podYaml
,
nsFlag
)
err
:=
framework
.
WaitForPodNoLongerRunningInNamespace
(
c
,
podName
,
ns
,
""
)
err
:=
framework
.
WaitForPodNoLongerRunningInNamespace
(
c
,
podName
,
ns
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
By
(
"checking if secret was read correctly"
)
...
...
@@ -432,7 +432,7 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() {
By
(
"creating the pod"
)
framework
.
RunKubectlOrDie
(
"create"
,
"-f"
,
podYaml
,
nsFlag
)
err
:=
framework
.
WaitForPodNoLongerRunningInNamespace
(
c
,
podName
,
ns
,
""
)
err
:=
framework
.
WaitForPodNoLongerRunningInNamespace
(
c
,
podName
,
ns
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
By
(
"checking if name and namespace were passed correctly"
)
...
...
@@ -477,7 +477,7 @@ var _ = framework.KubeDescribe("[Feature:Example]", func() {
By
(
"starting admin"
)
framework
.
RunKubectlOrDie
(
"create"
,
"-f"
,
adminServiceYaml
,
nsFlag
)
framework
.
RunKubectlOrDie
(
"create"
,
"-f"
,
adminPodYaml
,
nsFlag
)
err
=
framework
.
WaitForPod
Name
RunningInNamespace
(
c
,
"rethinkdb-admin"
,
ns
)
err
=
framework
.
WaitForPodRunningInNamespace
(
c
,
"rethinkdb-admin"
,
ns
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
checkDbInstances
()
content
,
err
:=
makeHttpRequestToService
(
c
,
ns
,
"rethinkdb-admin"
,
"/"
,
framework
.
EndpointRegisterTimeout
)
...
...
test/e2e/framework/framework.go
View file @
62e492a2
...
...
@@ -365,24 +365,24 @@ func (f *Framework) WaitForPodTerminated(podName, reason string) error {
// WaitForPodRunning waits for the pod to run in the namespace.
func
(
f
*
Framework
)
WaitForPodRunning
(
podName
string
)
error
{
return
WaitForPod
Name
RunningInNamespace
(
f
.
Client
,
podName
,
f
.
Namespace
.
Name
)
return
WaitForPodRunningInNamespace
(
f
.
Client
,
podName
,
f
.
Namespace
.
Name
)
}
// WaitForPodReady waits for the pod to flip to ready in the namespace.
func
(
f
*
Framework
)
WaitForPodReady
(
podName
string
)
error
{
return
waitTimeoutForPodReadyInNamespace
(
f
.
Client
,
podName
,
f
.
Namespace
.
Name
,
""
,
PodStartTimeout
)
return
waitTimeoutForPodReadyInNamespace
(
f
.
Client
,
podName
,
f
.
Namespace
.
Name
,
PodStartTimeout
)
}
// WaitForPodRunningSlow waits for the pod to run in the namespace.
// It has a longer timeout then WaitForPodRunning (util.slowPodStartTimeout).
func
(
f
*
Framework
)
WaitForPodRunningSlow
(
podName
string
)
error
{
return
waitForPodRunningInNamespaceSlow
(
f
.
Client
,
podName
,
f
.
Namespace
.
Name
,
""
)
return
waitForPodRunningInNamespaceSlow
(
f
.
Client
,
podName
,
f
.
Namespace
.
Name
)
}
// WaitForPodNoLongerRunning waits for the pod to no longer be running in the namespace, for either
// success or failure.
func
(
f
*
Framework
)
WaitForPodNoLongerRunning
(
podName
string
)
error
{
return
WaitForPodNoLongerRunningInNamespace
(
f
.
Client
,
podName
,
f
.
Namespace
.
Name
,
""
)
return
WaitForPodNoLongerRunningInNamespace
(
f
.
Client
,
podName
,
f
.
Namespace
.
Name
)
}
// Runs the given pod and verifies that the output of exact container matches the desired output.
...
...
test/e2e/framework/util.go
View file @
62e492a2
...
...
@@ -86,7 +86,8 @@ const (
// How long to wait for the pod to be listable
PodListTimeout
=
time
.
Minute
// Initial pod start can be delayed O(minutes) by slow docker pulls
PodStartTimeout
=
30
*
time
.
Second
// TODO: Make this 30 seconds once #4566 is resolved.
PodStartTimeout
=
5
*
time
.
Minute
// How long to wait for the pod to no longer be running
podNoLongerRunningTimeout
=
30
*
time
.
Second
...
...
@@ -1177,31 +1178,18 @@ func CheckInvariants(events []watch.Event, fns ...InvariantFunc) error {
// Waits default amount of time (PodStartTimeout) for the specified pod to become running.
// Returns an error if timeout occurs first, or pod goes in to failed state.
func
WaitForPodRunningInNamespace
(
c
*
client
.
Client
,
pod
*
api
.
Pod
)
error
{
// this short-cicuit is needed for cases when we pass a list of pods instead
// of newly created pod (eg. VerifyPods) which means we are getting already
// running pod for which waiting does not make sense and will always fail
if
pod
.
Status
.
Phase
==
api
.
PodRunning
{
return
nil
}
return
waitTimeoutForPodRunningInNamespace
(
c
,
pod
.
Name
,
pod
.
Namespace
,
pod
.
ResourceVersion
,
PodStartTimeout
)
}
// Waits default amount of time (PodStartTimeout) for the specified pod to become running.
// Returns an error if timeout occurs first, or pod goes in to failed state.
func
WaitForPodNameRunningInNamespace
(
c
*
client
.
Client
,
podName
,
namespace
string
)
error
{
return
waitTimeoutForPodRunningInNamespace
(
c
,
podName
,
namespace
,
""
,
PodStartTimeout
)
func
WaitForPodRunningInNamespace
(
c
*
client
.
Client
,
podName
string
,
namespace
string
)
error
{
return
waitTimeoutForPodRunningInNamespace
(
c
,
podName
,
namespace
,
PodStartTimeout
)
}
// Waits an extended amount of time (slowPodStartTimeout) for the specified pod to become running.
// The resourceVersion is used when Watching object changes, it tells since when we care
// about changes to the pod. Returns an error if timeout occurs first, or pod goes in to failed state.
func
waitForPodRunningInNamespaceSlow
(
c
*
client
.
Client
,
podName
,
namespace
,
resourceVersion
string
)
error
{
return
waitTimeoutForPodRunningInNamespace
(
c
,
podName
,
namespace
,
resourceVersion
,
slowPodStartTimeout
)
// Returns an error if timeout occurs first, or pod goes in to failed state.
func
waitForPodRunningInNamespaceSlow
(
c
*
client
.
Client
,
podName
string
,
namespace
string
)
error
{
return
waitTimeoutForPodRunningInNamespace
(
c
,
podName
,
namespace
,
slowPodStartTimeout
)
}
func
waitTimeoutForPodRunningInNamespace
(
c
*
client
.
Client
,
podName
,
namespace
,
resourceVersion
string
,
timeout
time
.
Duration
)
error
{
w
,
err
:=
c
.
Pods
(
namespace
)
.
Watch
(
api
.
SingleObject
(
api
.
ObjectMeta
{
Name
:
podName
,
ResourceVersion
:
resourceVersion
}))
func
waitTimeoutForPodRunningInNamespace
(
c
*
client
.
Client
,
podName
string
,
namespace
string
,
timeout
time
.
Duration
)
error
{
w
,
err
:=
c
.
Pods
(
namespace
)
.
Watch
(
api
.
SingleObject
(
api
.
ObjectMeta
{
Name
:
podName
}))
if
err
!=
nil
{
return
err
}
...
...
@@ -1211,12 +1199,12 @@ func waitTimeoutForPodRunningInNamespace(c *client.Client, podName, namespace, r
// Waits default amount of time (podNoLongerRunningTimeout) for the specified pod to stop running.
// Returns an error if timeout occurs first.
func
WaitForPodNoLongerRunningInNamespace
(
c
*
client
.
Client
,
podName
,
namespace
,
resourceVersion
string
)
error
{
return
waitTimeoutForPodNoLongerRunningInNamespace
(
c
,
podName
,
namespace
,
resourceVersion
,
podNoLongerRunningTimeout
)
func
WaitForPodNoLongerRunningInNamespace
(
c
*
client
.
Client
,
podName
string
,
namespace
string
)
error
{
return
waitTimeoutForPodNoLongerRunningInNamespace
(
c
,
podName
,
namespace
,
podNoLongerRunningTimeout
)
}
func
waitTimeoutForPodNoLongerRunningInNamespace
(
c
*
client
.
Client
,
podName
,
namespace
,
resourceVersion
string
,
timeout
time
.
Duration
)
error
{
w
,
err
:=
c
.
Pods
(
namespace
)
.
Watch
(
api
.
SingleObject
(
api
.
ObjectMeta
{
Name
:
podName
,
ResourceVersion
:
resourceVersion
}))
func
waitTimeoutForPodNoLongerRunningInNamespace
(
c
*
client
.
Client
,
podName
string
,
namespace
string
,
timeout
time
.
Duration
)
error
{
w
,
err
:=
c
.
Pods
(
namespace
)
.
Watch
(
api
.
SingleObject
(
api
.
ObjectMeta
{
Name
:
podName
}))
if
err
!=
nil
{
return
err
}
...
...
@@ -1224,8 +1212,8 @@ func waitTimeoutForPodNoLongerRunningInNamespace(c *client.Client, podName, name
return
err
}
func
waitTimeoutForPodReadyInNamespace
(
c
*
client
.
Client
,
podName
,
namespace
,
resourceVersion
string
,
timeout
time
.
Duration
)
error
{
w
,
err
:=
c
.
Pods
(
namespace
)
.
Watch
(
api
.
SingleObject
(
api
.
ObjectMeta
{
Name
:
podName
,
ResourceVersion
:
resourceVersion
}))
func
waitTimeoutForPodReadyInNamespace
(
c
*
client
.
Client
,
podName
string
,
namespace
string
,
timeout
time
.
Duration
)
error
{
w
,
err
:=
c
.
Pods
(
namespace
)
.
Watch
(
api
.
SingleObject
(
api
.
ObjectMeta
{
Name
:
podName
}))
if
err
!=
nil
{
return
err
}
...
...
@@ -1234,10 +1222,8 @@ func waitTimeoutForPodReadyInNamespace(c *client.Client, podName, namespace, res
}
// WaitForPodNotPending returns an error if it took too long for the pod to go out of pending state.
// The resourceVersion is used when Watching object changes, it tells since when we care
// about changes to the pod.
func
WaitForPodNotPending
(
c
*
client
.
Client
,
ns
,
podName
,
resourceVersion
string
)
error
{
w
,
err
:=
c
.
Pods
(
ns
)
.
Watch
(
api
.
SingleObject
(
api
.
ObjectMeta
{
Name
:
podName
,
ResourceVersion
:
resourceVersion
}))
func
WaitForPodNotPending
(
c
*
client
.
Client
,
ns
,
podName
string
)
error
{
w
,
err
:=
c
.
Pods
(
ns
)
.
Watch
(
api
.
SingleObject
(
api
.
ObjectMeta
{
Name
:
podName
}))
if
err
!=
nil
{
return
err
}
...
...
@@ -1632,7 +1618,7 @@ func podsRunning(c *client.Client, pods *api.PodList) []error {
for
_
,
pod
:=
range
pods
.
Items
{
go
func
(
p
api
.
Pod
)
{
error_chan
<-
WaitForPodRunningInNamespace
(
c
,
&
p
)
error_chan
<-
WaitForPodRunningInNamespace
(
c
,
p
.
Name
,
p
.
Namespace
)
}(
pod
)
}
...
...
@@ -3521,7 +3507,7 @@ func LaunchHostExecPod(client *client.Client, ns, name string) *api.Pod {
hostExecPod
:=
NewHostExecPodSpec
(
ns
,
name
)
pod
,
err
:=
client
.
Pods
(
ns
)
.
Create
(
hostExecPod
)
ExpectNoError
(
err
)
err
=
WaitForPodRunningInNamespace
(
client
,
pod
)
err
=
WaitForPodRunningInNamespace
(
client
,
pod
.
Name
,
pod
.
Namespace
)
ExpectNoError
(
err
)
return
pod
}
...
...
test/e2e/initial_resources.go
View file @
62e492a2
...
...
@@ -67,6 +67,6 @@ func runPod(f *framework.Framework, name, image string) *api.Pod {
}
createdPod
,
err
:=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
Create
(
pod
)
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
createdPod
))
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
name
,
f
.
Namespace
.
Name
))
return
createdPod
}
test/e2e/kibana_logging.go
View file @
62e492a2
...
...
@@ -73,7 +73,7 @@ func ClusterLevelLoggingWithKibana(f *framework.Framework) {
pods
,
err
:=
f
.
Client
.
Pods
(
api
.
NamespaceSystem
)
.
List
(
options
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
for
_
,
pod
:=
range
pods
.
Items
{
err
=
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
&
pod
)
err
=
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
pod
.
Name
,
api
.
NamespaceSystem
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
}
...
...
test/e2e/mesos.go
View file @
62e492a2
...
...
@@ -101,7 +101,7 @@ var _ = framework.KubeDescribe("Mesos", func() {
})
framework
.
ExpectNoError
(
err
)
framework
.
ExpectNoError
(
framework
.
WaitForPod
Name
RunningInNamespace
(
c
,
podName
,
ns
))
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
c
,
podName
,
ns
))
pod
,
err
:=
c
.
Pods
(
ns
)
.
Get
(
podName
)
framework
.
ExpectNoError
(
err
)
...
...
test/e2e/namespace.go
View file @
62e492a2
...
...
@@ -106,7 +106,7 @@ func ensurePodsAreRemovedWhenNamespaceIsDeleted(f *framework.Framework) {
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
By
(
"Waiting for the pod to have running status"
)
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
pod
))
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
pod
.
Name
,
pod
.
Namespace
))
By
(
"Deleting the namespace"
)
err
=
f
.
Client
.
Namespaces
()
.
Delete
(
namespace
.
Name
)
...
...
test/e2e/pods.go
View file @
62e492a2
...
...
@@ -53,7 +53,7 @@ var (
func
runLivenessTest
(
c
*
client
.
Client
,
ns
string
,
podDescr
*
api
.
Pod
,
expectNumRestarts
int
,
timeout
time
.
Duration
)
{
By
(
fmt
.
Sprintf
(
"Creating pod %s in namespace %s"
,
podDescr
.
Name
,
ns
))
podDescr
,
err
:=
c
.
Pods
(
ns
)
.
Create
(
podDescr
)
_
,
err
:=
c
.
Pods
(
ns
)
.
Create
(
podDescr
)
framework
.
ExpectNoError
(
err
,
fmt
.
Sprintf
(
"creating pod %s"
,
podDescr
.
Name
))
// At the end of the test, clean up by removing the pod.
...
...
@@ -65,7 +65,7 @@ func runLivenessTest(c *client.Client, ns string, podDescr *api.Pod, expectNumRe
// Wait until the pod is not pending. (Here we need to check for something other than
// 'Pending' other than checking for 'Running', since when failures occur, we go to
// 'Terminated' which can cause indefinite blocking.)
framework
.
ExpectNoError
(
framework
.
WaitForPodNotPending
(
c
,
ns
,
podDescr
.
Name
,
podDescr
.
ResourceVersion
),
framework
.
ExpectNoError
(
framework
.
WaitForPodNotPending
(
c
,
ns
,
podDescr
.
Name
),
fmt
.
Sprintf
(
"starting pod %s in namespace %s"
,
podDescr
.
Name
,
ns
))
framework
.
Logf
(
"Started pod %s in namespace %s"
,
podDescr
.
Name
,
ns
)
...
...
@@ -114,14 +114,13 @@ func testHostIP(c *client.Client, ns string, pod *api.Pod) {
podClient
:=
c
.
Pods
(
ns
)
By
(
"creating pod"
)
defer
podClient
.
Delete
(
pod
.
Name
,
api
.
NewDeleteOptions
(
0
))
pod
,
err
:=
podClient
.
Create
(
pod
)
if
err
!=
nil
{
if
_
,
err
:=
podClient
.
Create
(
pod
);
err
!=
nil
{
framework
.
Failf
(
"Failed to create pod: %v"
,
err
)
}
By
(
"ensuring that pod is running and has a hostIP"
)
// Wait for the pods to enter the running state. Waiting loops until the pods
// are running so non-running pods cause a timeout for this test.
err
=
framework
.
WaitForPodRunningInNamespace
(
c
,
pod
)
err
:=
framework
.
WaitForPodRunningInNamespace
(
c
,
pod
.
Name
,
ns
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
// Try to make sure we get a hostIP for each pod.
hostIPTimeout
:=
2
*
time
.
Minute
...
...
@@ -816,7 +815,7 @@ var _ = framework.KubeDescribe("Pods", func() {
wr
:=
watch
.
NewRecorder
(
w
)
event
,
err
:=
watch
.
Until
(
framework
.
Pod
ReadyBefore
Timeout
,
wr
,
framework
.
Pod
Start
Timeout
,
wr
,
// check for the first container to fail at least once
func
(
evt
watch
.
Event
)
(
bool
,
error
)
{
switch
t
:=
evt
.
Object
.
(
type
)
{
...
...
test/e2e/pre_stop.go
View file @
62e492a2
...
...
@@ -51,7 +51,7 @@ func testPreStop(c *client.Client, ns string) {
},
}
By
(
fmt
.
Sprintf
(
"Creating server pod %s in namespace %s"
,
podDescr
.
Name
,
ns
))
podDescr
,
err
:=
c
.
Pods
(
ns
)
.
Create
(
podDescr
)
_
,
err
:=
c
.
Pods
(
ns
)
.
Create
(
podDescr
)
framework
.
ExpectNoError
(
err
,
fmt
.
Sprintf
(
"creating pod %s"
,
podDescr
.
Name
))
// At the end of the test, clean up by removing the pod.
...
...
@@ -61,7 +61,7 @@ func testPreStop(c *client.Client, ns string) {
}()
By
(
"Waiting for pods to come up."
)
err
=
framework
.
WaitForPodRunningInNamespace
(
c
,
podDescr
)
err
=
framework
.
WaitForPodRunningInNamespace
(
c
,
podDescr
.
Name
,
ns
)
framework
.
ExpectNoError
(
err
,
"waiting for server pod to start"
)
val
:=
"{
\"
Source
\"
:
\"
prestop
\"
}"
...
...
@@ -94,7 +94,7 @@ func testPreStop(c *client.Client, ns string) {
}
By
(
fmt
.
Sprintf
(
"Creating tester pod %s in namespace %s"
,
preStopDescr
.
Name
,
ns
))
preStopDescr
,
err
=
c
.
Pods
(
ns
)
.
Create
(
preStopDescr
)
_
,
err
=
c
.
Pods
(
ns
)
.
Create
(
preStopDescr
)
framework
.
ExpectNoError
(
err
,
fmt
.
Sprintf
(
"creating pod %s"
,
preStopDescr
.
Name
))
deletePreStop
:=
true
...
...
@@ -106,7 +106,7 @@ func testPreStop(c *client.Client, ns string) {
}
}()
err
=
framework
.
WaitForPodRunningInNamespace
(
c
,
preStopDescr
)
err
=
framework
.
WaitForPodRunningInNamespace
(
c
,
preStopDescr
.
Name
,
ns
)
framework
.
ExpectNoError
(
err
,
"waiting for tester pod to start"
)
// Delete the pod with the preStop handler.
...
...
test/e2e/scheduler_predicates.go
View file @
62e492a2
This diff is collapsed.
Click to expand it.
test/e2e/security_context.go
View file @
62e492a2
...
...
@@ -168,11 +168,11 @@ func testPodSELinuxLabeling(f *framework.Framework, hostIPC bool, hostPID bool)
pod
.
Spec
.
Containers
[
0
]
.
Command
=
[]
string
{
"sleep"
,
"6000"
}
client
:=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
pod
,
err
:=
client
.
Create
(
pod
)
_
,
err
:=
client
.
Create
(
pod
)
framework
.
ExpectNoError
(
err
,
"Error creating pod %v"
,
pod
)
defer
client
.
Delete
(
pod
.
Name
,
nil
)
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
pod
))
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
f
.
Client
,
pod
.
Name
,
f
.
Namespace
.
Name
))
testContent
:=
"hello"
testFilePath
:=
mountPath
+
"/TEST"
...
...
test/e2e/volumes.go
View file @
62e492a2
...
...
@@ -141,10 +141,10 @@ func startVolumeServer(client *client.Client, config VolumeTestConfig) *api.Pod
Volumes
:
volumes
,
},
}
serverPod
,
err
:=
podClient
.
Create
(
serverPod
)
_
,
err
:=
podClient
.
Create
(
serverPod
)
framework
.
ExpectNoError
(
err
,
"Failed to create %s pod: %v"
,
serverPod
.
Name
,
err
)
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
client
,
serverPod
))
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
client
,
serverPod
.
Name
,
config
.
namespace
))
By
(
"locating the server pod"
)
pod
,
err
:=
podClient
.
Get
(
serverPod
.
Name
)
...
...
@@ -244,14 +244,13 @@ func testVolumeClient(client *client.Client, config VolumeTestConfig, volume api
if
fsGroup
!=
nil
{
clientPod
.
Spec
.
SecurityContext
.
FSGroup
=
fsGroup
}
clientPod
,
err
:=
podsNamespacer
.
Create
(
clientPod
)
if
err
!=
nil
{
if
_
,
err
:=
podsNamespacer
.
Create
(
clientPod
);
err
!=
nil
{
framework
.
Failf
(
"Failed to create %s pod: %v"
,
clientPod
.
Name
,
err
)
}
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
client
,
clientPod
))
framework
.
ExpectNoError
(
framework
.
WaitForPodRunningInNamespace
(
client
,
clientPod
.
Name
,
config
.
namespace
))
By
(
"Checking that text file contents are perfect."
)
_
,
err
=
framework
.
LookForStringInPodExec
(
config
.
namespace
,
clientPod
.
Name
,
[]
string
{
"cat"
,
"/opt/index.html"
},
expectedContent
,
time
.
Minute
)
_
,
err
:
=
framework
.
LookForStringInPodExec
(
config
.
namespace
,
clientPod
.
Name
,
[]
string
{
"cat"
,
"/opt/index.html"
},
expectedContent
,
time
.
Minute
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"failed: finding the contents of the mounted file."
)
if
fsGroup
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment