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
335217dd
Commit
335217dd
authored
Mar 08, 2017
by
Fabiano Franz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix failing kubectl skew tests
parent
0d60fc40
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
kubectl.sh
cluster/kubectl.sh
+6
-0
kubectl.go
test/e2e/kubectl.go
+15
-5
No files found.
cluster/kubectl.sh
View file @
335217dd
...
@@ -68,4 +68,10 @@ if false; then
...
@@ -68,4 +68,10 @@ if false; then
echo
"Running:"
"
${
kubectl
}
"
"
${
config
[@]
:+
${
config
[@]
}}
"
"
${
@+
$@
}
"
>
&2
echo
"Running:"
"
${
kubectl
}
"
"
${
config
[@]
:+
${
config
[@]
}}
"
"
${
@+
$@
}
"
>
&2
fi
fi
if
[[
"
${
1
:-}
"
=
~ ^
(
path
)
$
]]
;
then
echo
"
${
kubectl
}
"
exit
0
fi
"
${
kubectl
}
"
"
${
config
[@]
:+
${
config
[@]
}}
"
"
${
@+
$@
}
"
"
${
kubectl
}
"
"
${
config
[@]
:+
${
config
[@]
}}
"
"
${
@+
$@
}
"
test/e2e/kubectl.go
View file @
335217dd
...
@@ -590,19 +590,29 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -590,19 +590,29 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
By
(
"overriding icc with values provided by flags"
)
By
(
"overriding icc with values provided by flags"
)
kubectlPath
:=
framework
.
TestContext
.
KubectlPath
kubectlPath
:=
framework
.
TestContext
.
KubectlPath
// we need the actual kubectl binary, not the script wrapper
kubectlPathNormalizer
:=
exec
.
Command
(
"which"
,
kubectlPath
)
if
strings
.
HasSuffix
(
kubectlPath
,
"kubectl.sh"
)
{
kubectlPathNormalizer
=
exec
.
Command
(
"sh"
,
"-c"
,
kubectlPath
,
"path"
)
}
kubectlPathNormalized
,
err
:=
kubectlPathNormalizer
.
Output
()
framework
.
ExpectNoError
(
err
)
kubectlPath
=
strings
.
TrimSpace
(
string
(
kubectlPathNormalized
))
inClusterHost
:=
strings
.
TrimSpace
(
framework
.
RunHostCmdOrDie
(
ns
,
simplePodName
,
"printenv KUBERNETES_SERVICE_HOST"
))
inClusterHost
:=
strings
.
TrimSpace
(
framework
.
RunHostCmdOrDie
(
ns
,
simplePodName
,
"printenv KUBERNETES_SERVICE_HOST"
))
inClusterPort
:=
strings
.
TrimSpace
(
framework
.
RunHostCmdOrDie
(
ns
,
simplePodName
,
"printenv KUBERNETES_SERVICE_PORT"
))
inClusterPort
:=
strings
.
TrimSpace
(
framework
.
RunHostCmdOrDie
(
ns
,
simplePodName
,
"printenv KUBERNETES_SERVICE_PORT"
))
framework
.
RunKubectlOrDie
(
"cp"
,
kubectlPath
,
ns
+
"/"
+
simplePodName
+
":/"
)
framework
.
Logf
(
"copying %s to the %s pod"
,
kubectlPath
,
simplePodName
)
framework
.
RunKubectlOrDie
(
"cp"
,
kubectlPath
,
ns
+
"/"
+
simplePodName
+
":/tmp/"
)
By
(
"getting pods with in-cluster configs"
)
By
(
"getting pods with in-cluster configs"
)
execOutput
:=
framework
.
RunHostCmdOrDie
(
ns
,
simplePodName
,
"/kubectl get pods"
)
execOutput
:=
framework
.
RunHostCmdOrDie
(
ns
,
simplePodName
,
"/
tmp/
kubectl get pods"
)
if
matched
,
err
:=
regexp
.
MatchString
(
"nginx +1/1 +Running"
,
execOutput
);
err
!=
nil
||
!
matched
{
if
matched
,
err
:=
regexp
.
MatchString
(
"nginx +1/1 +Running"
,
execOutput
);
err
!=
nil
||
!
matched
{
framework
.
Failf
(
"Unexpected kubectl exec output: "
,
execOutput
)
framework
.
Failf
(
"Unexpected kubectl exec output: "
,
execOutput
)
}
}
By
(
"trying to use kubectl with invalid token"
)
By
(
"trying to use kubectl with invalid token"
)
_
,
err
=
framework
.
RunHostCmd
(
ns
,
simplePodName
,
"/kubectl get pods --token=invalid --v=7 2>&1"
)
_
,
err
=
framework
.
RunHostCmd
(
ns
,
simplePodName
,
"/
tmp/
kubectl get pods --token=invalid --v=7 2>&1"
)
framework
.
Logf
(
"got err %v"
,
err
)
framework
.
Logf
(
"got err %v"
,
err
)
Expect
(
err
)
.
To
(
HaveOccurred
())
Expect
(
err
)
.
To
(
HaveOccurred
())
Expect
(
err
)
.
To
(
ContainSubstring
(
"Using in-cluster namespace"
))
Expect
(
err
)
.
To
(
ContainSubstring
(
"Using in-cluster namespace"
))
...
@@ -611,14 +621,14 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
...
@@ -611,14 +621,14 @@ var _ = framework.KubeDescribe("Kubectl client", func() {
Expect
(
err
)
.
To
(
ContainSubstring
(
"Response Status: 401 Unauthorized"
))
Expect
(
err
)
.
To
(
ContainSubstring
(
"Response Status: 401 Unauthorized"
))
By
(
"trying to use kubectl with invalid server"
)
By
(
"trying to use kubectl with invalid server"
)
_
,
err
=
framework
.
RunHostCmd
(
ns
,
simplePodName
,
"/kubectl get pods --server=invalid --v=6 2>&1"
)
_
,
err
=
framework
.
RunHostCmd
(
ns
,
simplePodName
,
"/
tmp/
kubectl get pods --server=invalid --v=6 2>&1"
)
framework
.
Logf
(
"got err %v"
,
err
)
framework
.
Logf
(
"got err %v"
,
err
)
Expect
(
err
)
.
To
(
HaveOccurred
())
Expect
(
err
)
.
To
(
HaveOccurred
())
Expect
(
err
)
.
To
(
ContainSubstring
(
"Unable to connect to the server"
))
Expect
(
err
)
.
To
(
ContainSubstring
(
"Unable to connect to the server"
))
Expect
(
err
)
.
To
(
ContainSubstring
(
"GET http://invalid/api"
))
Expect
(
err
)
.
To
(
ContainSubstring
(
"GET http://invalid/api"
))
By
(
"trying to use kubectl with invalid namespace"
)
By
(
"trying to use kubectl with invalid namespace"
)
output
,
_
:=
framework
.
RunHostCmd
(
ns
,
simplePodName
,
"/kubectl get pods --namespace=invalid --v=6 2>&1"
)
output
,
_
:=
framework
.
RunHostCmd
(
ns
,
simplePodName
,
"/
tmp/
kubectl get pods --namespace=invalid --v=6 2>&1"
)
Expect
(
output
)
.
To
(
ContainSubstring
(
"No resources found"
))
Expect
(
output
)
.
To
(
ContainSubstring
(
"No resources found"
))
Expect
(
output
)
.
ToNot
(
ContainSubstring
(
"Using in-cluster namespace"
))
Expect
(
output
)
.
ToNot
(
ContainSubstring
(
"Using in-cluster namespace"
))
Expect
(
output
)
.
To
(
ContainSubstring
(
"Using in-cluster configuration"
))
Expect
(
output
)
.
To
(
ContainSubstring
(
"Using in-cluster configuration"
))
...
...
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