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
6a15e0a9
Commit
6a15e0a9
authored
May 12, 2016
by
Jeff Lowdermilk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
e2e: make ForEach fail if filter is empty, fix no-op tests
parent
4aabafe4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
6 deletions
+19
-6
framework.go
test/e2e/framework/framework.go
+3
-0
kubectl.go
test/e2e/kubectl.go
+16
-6
No files found.
test/e2e/framework/framework.go
View file @
6a15e0a9
...
@@ -668,6 +668,9 @@ func (cl *ClusterVerification) WaitForOrFail(atLeast int, timeout time.Duration)
...
@@ -668,6 +668,9 @@ func (cl *ClusterVerification) WaitForOrFail(atLeast int, timeout time.Duration)
func
(
cl
*
ClusterVerification
)
ForEach
(
podFunc
func
(
api
.
Pod
))
error
{
func
(
cl
*
ClusterVerification
)
ForEach
(
podFunc
func
(
api
.
Pod
))
error
{
pods
,
err
:=
cl
.
podState
.
filter
(
cl
.
client
,
cl
.
namespace
)
pods
,
err
:=
cl
.
podState
.
filter
(
cl
.
client
,
cl
.
namespace
)
if
err
==
nil
{
if
err
==
nil
{
if
len
(
pods
)
==
0
{
Failf
(
"No pods matched the filter."
)
}
Logf
(
"ForEach: Found %v pods from the filter. Now looping through them."
,
len
(
pods
))
Logf
(
"ForEach: Found %v pods from the filter. Now looping through them."
,
len
(
pods
))
for
_
,
p
:=
range
pods
{
for
_
,
p
:=
range
pods
{
podFunc
(
p
)
podFunc
(
p
)
...
...
test/e2e/kubectl.go
View file @
6a15e0a9
...
@@ -669,7 +669,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -669,7 +669,7 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
framework
.
RunKubectlOrDieInput
(
string
(
controllerJson
[
:
]),
"create"
,
"-f"
,
"-"
,
nsFlag
)
framework
.
RunKubectlOrDieInput
(
string
(
controllerJson
[
:
]),
"create"
,
"-f"
,
"-"
,
nsFlag
)
framework
.
RunKubectlOrDieInput
(
string
(
serviceJson
[
:
]),
"create"
,
"-f"
,
"-"
,
nsFlag
)
framework
.
RunKubectlOrDieInput
(
string
(
serviceJson
[
:
]),
"create"
,
"-f"
,
"-"
,
nsFlag
)
// Wait for the redis pods to come online...
By
(
"Waiting for Redis master to start."
)
waitFor
(
1
)
waitFor
(
1
)
// Pod
// Pod
forEachPod
(
func
(
pod
api
.
Pod
)
{
forEachPod
(
func
(
pod
api
.
Pod
)
{
...
@@ -892,6 +892,14 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -892,6 +892,14 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
It
(
"should be able to retrieve and filter logs [Conformance]"
,
func
()
{
It
(
"should be able to retrieve and filter logs [Conformance]"
,
func
()
{
framework
.
SkipUnlessServerVersionGTE
(
extendedPodLogFilterVersion
,
c
)
framework
.
SkipUnlessServerVersionGTE
(
extendedPodLogFilterVersion
,
c
)
// Split("something\n", "\n") returns ["something", ""], so
// strip trailing newline first
lines
:=
func
(
out
string
)
[]
string
{
return
strings
.
Split
(
strings
.
TrimRight
(
out
,
"
\n
"
),
"
\n
"
)
}
By
(
"Waiting for Redis master to start."
)
waitFor
(
1
)
forEachPod
(
func
(
pod
api
.
Pod
)
{
forEachPod
(
func
(
pod
api
.
Pod
)
{
By
(
"checking for a matching strings"
)
By
(
"checking for a matching strings"
)
_
,
err
:=
framework
.
LookForStringInLog
(
ns
,
pod
.
Name
,
containerName
,
"The server is now ready to accept connections"
,
framework
.
PodStartTimeout
)
_
,
err
:=
framework
.
LookForStringInLog
(
ns
,
pod
.
Name
,
containerName
,
"The server is now ready to accept connections"
,
framework
.
PodStartTimeout
)
...
@@ -900,18 +908,18 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -900,18 +908,18 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
By
(
"limiting log lines"
)
By
(
"limiting log lines"
)
out
:=
framework
.
RunKubectlOrDie
(
"log"
,
pod
.
Name
,
containerName
,
nsFlag
,
"--tail=1"
)
out
:=
framework
.
RunKubectlOrDie
(
"log"
,
pod
.
Name
,
containerName
,
nsFlag
,
"--tail=1"
)
Expect
(
len
(
out
))
.
NotTo
(
BeZero
())
Expect
(
len
(
out
))
.
NotTo
(
BeZero
())
Expect
(
len
(
strings
.
Split
(
out
,
"
\n
"
)))
.
To
(
Equal
(
1
))
Expect
(
len
(
lines
(
out
)))
.
To
(
Equal
(
1
))
By
(
"limiting log bytes"
)
By
(
"limiting log bytes"
)
out
=
framework
.
RunKubectlOrDie
(
"log"
,
pod
.
Name
,
containerName
,
nsFlag
,
"--limit-bytes=1"
)
out
=
framework
.
RunKubectlOrDie
(
"log"
,
pod
.
Name
,
containerName
,
nsFlag
,
"--limit-bytes=1"
)
Expect
(
len
(
strings
.
Split
(
out
,
"
\n
"
)))
.
To
(
Equal
(
1
))
Expect
(
len
(
lines
(
out
)))
.
To
(
Equal
(
1
))
Expect
(
len
(
out
))
.
To
(
Equal
(
1
))
Expect
(
len
(
out
))
.
To
(
Equal
(
1
))
By
(
"exposing timestamps"
)
By
(
"exposing timestamps"
)
out
=
framework
.
RunKubectlOrDie
(
"log"
,
pod
.
Name
,
containerName
,
nsFlag
,
"--tail=1"
,
"--timestamps"
)
out
=
framework
.
RunKubectlOrDie
(
"log"
,
pod
.
Name
,
containerName
,
nsFlag
,
"--tail=1"
,
"--timestamps"
)
l
ines
:=
strings
.
Split
(
out
,
"
\n
"
)
l
:=
lines
(
out
)
Expect
(
len
(
l
ines
))
.
To
(
Equal
(
1
))
Expect
(
len
(
l
))
.
To
(
Equal
(
1
))
words
:=
strings
.
Split
(
l
ines
[
0
],
" "
)
words
:=
strings
.
Split
(
l
[
0
],
" "
)
Expect
(
len
(
words
))
.
To
(
BeNumerically
(
">"
,
1
))
Expect
(
len
(
words
))
.
To
(
BeNumerically
(
">"
,
1
))
if
_
,
err
:=
time
.
Parse
(
time
.
RFC3339Nano
,
words
[
0
]);
err
!=
nil
{
if
_
,
err
:=
time
.
Parse
(
time
.
RFC3339Nano
,
words
[
0
]);
err
!=
nil
{
if
_
,
err
:=
time
.
Parse
(
time
.
RFC3339
,
words
[
0
]);
err
!=
nil
{
if
_
,
err
:=
time
.
Parse
(
time
.
RFC3339
,
words
[
0
]);
err
!=
nil
{
...
@@ -942,6 +950,8 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -942,6 +950,8 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
nsFlag
:=
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
)
nsFlag
:=
fmt
.
Sprintf
(
"--namespace=%v"
,
ns
)
By
(
"creating Redis RC"
)
By
(
"creating Redis RC"
)
framework
.
RunKubectlOrDieInput
(
string
(
controllerJson
[
:
]),
"create"
,
"-f"
,
"-"
,
nsFlag
)
framework
.
RunKubectlOrDieInput
(
string
(
controllerJson
[
:
]),
"create"
,
"-f"
,
"-"
,
nsFlag
)
By
(
"Waiting for Redis master to start."
)
waitFor
(
1
)
By
(
"patching all pods"
)
By
(
"patching all pods"
)
forEachPod
(
func
(
pod
api
.
Pod
)
{
forEachPod
(
func
(
pod
api
.
Pod
)
{
framework
.
RunKubectlOrDie
(
"patch"
,
"pod"
,
pod
.
Name
,
nsFlag
,
"-p"
,
"{
\"
metadata
\"
:{
\"
annotations
\"
:{
\"
x
\"
:
\"
y
\"
}}}"
)
framework
.
RunKubectlOrDie
(
"patch"
,
"pod"
,
pod
.
Name
,
nsFlag
,
"-p"
,
"{
\"
metadata
\"
:{
\"
annotations
\"
:{
\"
x
\"
:
\"
y
\"
}}}"
)
...
...
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