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
afb780d4
Commit
afb780d4
authored
Aug 11, 2016
by
Random-Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move utilities into different packages. Add local and remove runner.
parent
f0462c40
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
104 additions
and
51 deletions
+104
-51
.linted_packages
hack/.linted_packages
+1
-0
test-e2e-node.sh
hack/make-rules/test-e2e-node.sh
+4
-10
known-flags.txt
hack/verify-flags/known-flags.txt
+2
-1
build.go
test/e2e_node/build/build.go
+5
-5
e2e_node_suite_test.go
test/e2e_node/e2e_node_suite_test.go
+4
-7
e2e-node-jenkins.sh
test/e2e_node/jenkins/e2e-node-jenkins.sh
+1
-1
remote.go
test/e2e_node/remote/remote.go
+5
-4
run_local.go
test/e2e_node/runner/local/run_local.go
+61
-0
run_remote.go
test/e2e_node/runner/remote/run_remote.go
+11
-11
apiserver.go
test/e2e_node/services/apiserver.go
+1
-1
etcd.go
test/e2e_node/services/etcd.go
+1
-1
namespace_controller.go
test/e2e_node/services/namespace_controller.go
+1
-1
services.go
test/e2e_node/services/services.go
+6
-8
util.go
test/e2e_node/util.go
+1
-1
No files found.
hack/.linted_packages
View file @
afb780d4
...
@@ -191,6 +191,7 @@ plugin/pkg/client/auth/gcp
...
@@ -191,6 +191,7 @@ plugin/pkg/client/auth/gcp
test/e2e/cleanup
test/e2e/cleanup
test/e2e/generated
test/e2e/generated
test/e2e/perftype
test/e2e/perftype
test/e2e_node/runner/local
test/images/clusterapi-tester
test/images/clusterapi-tester
test/images/entrypoint-tester
test/images/entrypoint-tester
test/images/fakegitserver
test/images/fakegitserver
...
...
hack/make-rules/test-e2e-node.sh
View file @
afb780d4
...
@@ -52,12 +52,6 @@ if [[ $list_images == "true" ]]; then
...
@@ -52,12 +52,6 @@ if [[ $list_images == "true" ]]; then
exit
0
exit
0
fi
fi
ginkgo
=
$(
kube::util::find-binary
"ginkgo"
)
if
[[
-z
"
${
ginkgo
}
"
]]
;
then
echo
"You do not appear to have ginkgo built. Try 'make WHAT=vendor/github.com/onsi/ginkgo/ginkgo'"
exit
1
fi
# Parse the flags to pass to ginkgo
# Parse the flags to pass to ginkgo
ginkgoflags
=
""
ginkgoflags
=
""
if
[[
$parallelism
>
1
]]
;
then
if
[[
$parallelism
>
1
]]
;
then
...
@@ -135,7 +129,7 @@ if [ $remote = true ] ; then
...
@@ -135,7 +129,7 @@ if [ $remote = true ] ; then
echo
"Ginkgo Flags:
$ginkgoflags
"
echo
"Ginkgo Flags:
$ginkgoflags
"
echo
"Instance Metadata:
$metadata
"
echo
"Instance Metadata:
$metadata
"
# Invoke the runner
# Invoke the runner
go run
test
/e2e_node/runner/r
un_e2e.go
--logtostderr
--vmodule
=
*
=
2
--ssh-env
=
"gce"
\
go run
test
/e2e_node/runner/r
emote/run_remote.go
--logtostderr
--vmodule
=
*
=
4
--ssh-env
=
"gce"
\
--zone
=
"
$zone
"
--project
=
"
$project
"
--gubernator
=
"
$gubernator
"
\
--zone
=
"
$zone
"
--project
=
"
$project
"
--gubernator
=
"
$gubernator
"
\
--hosts
=
"
$hosts
"
--images
=
"
$images
"
--cleanup
=
"
$cleanup
"
\
--hosts
=
"
$hosts
"
--images
=
"
$images
"
--cleanup
=
"
$cleanup
"
\
--results-dir
=
"
$artifacts
"
--ginkgo-flags
=
"
$ginkgoflags
"
\
--results-dir
=
"
$artifacts
"
--ginkgo-flags
=
"
$ginkgoflags
"
\
...
@@ -171,8 +165,8 @@ else
...
@@ -171,8 +165,8 @@ else
# Test using the host the script was run on
# Test using the host the script was run on
# Provided for backwards compatibility
# Provided for backwards compatibility
"
${
ginkgo
}
"
$ginkgoflags
"
${
KUBE_ROOT
}
/test/e2e_node/"
--report-dir
=
${
report
}
\
go run
test
/e2e_node/runner/local/run_local.go
--ginkgo-flags
=
"
$ginkgoflags
"
\
--
--alsologtostderr
--v
2
--node-name
$(
hostname
)
--build-services
=
true
\
--
test-flags
=
"--alsologtostderr --v 2 --report-dir=
${
report
}
--node-name
$(
hostname
)
\
--start-services
=
true
--stop-services
=
true
$test_args
--start-services=true --stop-services=true
$test_args
"
--build-dependencies
=
true
exit
$?
exit
$?
fi
fi
hack/verify-flags/known-flags.txt
View file @
afb780d4
...
@@ -41,8 +41,8 @@ bind-address
...
@@ -41,8 +41,8 @@ bind-address
bind-pods-burst
bind-pods-burst
bind-pods-qps
bind-pods-qps
bounding-dirs
bounding-dirs
build-dependencies
build-only
build-only
build-services
build-tag
build-tag
cadvisor-port
cadvisor-port
cert-dir
cert-dir
...
@@ -494,6 +494,7 @@ target-port
...
@@ -494,6 +494,7 @@ target-port
target-ram-mb
target-ram-mb
tcp-services
tcp-services
terminated-pod-gc-threshold
terminated-pod-gc-threshold
test-flags
test-timeout
test-timeout
tls-cert-file
tls-cert-file
tls-private-key-file
tls-private-key-file
...
...
test/e2e_node/
e2e_
build.go
→
test/e2e_node/
build/
build.go
View file @
afb780d4
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
package
e2e_node
package
build
import
(
import
(
"flag"
"flag"
...
@@ -36,7 +36,7 @@ var buildTargets = []string{
...
@@ -36,7 +36,7 @@ var buildTargets = []string{
"vendor/github.com/onsi/ginkgo/ginkgo"
,
"vendor/github.com/onsi/ginkgo/ginkgo"
,
}
}
func
b
uildGo
()
error
{
func
B
uildGo
()
error
{
glog
.
Infof
(
"Building k8s binaries..."
)
glog
.
Infof
(
"Building k8s binaries..."
)
k8sRoot
,
err
:=
getK8sRootDir
()
k8sRoot
,
err
:=
getK8sRootDir
()
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -74,7 +74,7 @@ func getK8sBin(bin string) (string, error) {
...
@@ -74,7 +74,7 @@ func getK8sBin(bin string) (string, error) {
return
filepath
.
Join
(
path
,
bin
),
nil
return
filepath
.
Join
(
path
,
bin
),
nil
}
}
buildOutputDir
,
err
:=
g
etK8sBuildOutputDir
()
buildOutputDir
,
err
:=
G
etK8sBuildOutputDir
()
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
}
}
...
@@ -101,7 +101,7 @@ func getK8sRootDir() (string, error) {
...
@@ -101,7 +101,7 @@ func getK8sRootDir() (string, error) {
return
""
,
fmt
.
Errorf
(
"Could not find kubernetes source root directory."
)
return
""
,
fmt
.
Errorf
(
"Could not find kubernetes source root directory."
)
}
}
func
g
etK8sBuildOutputDir
()
(
string
,
error
)
{
func
G
etK8sBuildOutputDir
()
(
string
,
error
)
{
k8sRoot
,
err
:=
getK8sRootDir
()
k8sRoot
,
err
:=
getK8sRootDir
()
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
...
@@ -113,7 +113,7 @@ func getK8sBuildOutputDir() (string, error) {
...
@@ -113,7 +113,7 @@ func getK8sBuildOutputDir() (string, error) {
return
buildOutputDir
,
nil
return
buildOutputDir
,
nil
}
}
func
g
etKubeletServerBin
()
string
{
func
G
etKubeletServerBin
()
string
{
bin
,
err
:=
getK8sBin
(
"kubelet"
)
bin
,
err
:=
getK8sBin
(
"kubelet"
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Fatalf
(
"Could not locate kubelet binary %v."
,
err
)
glog
.
Fatalf
(
"Could not locate kubelet binary %v."
,
err
)
...
...
test/e2e_node/e2e_node_suite_test.go
View file @
afb780d4
...
@@ -35,6 +35,7 @@ import (
...
@@ -35,6 +35,7 @@ import (
clientset
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
clientset
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
commontest
"k8s.io/kubernetes/test/e2e/common"
commontest
"k8s.io/kubernetes/test/e2e/common"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e_node/services"
"github.com/golang/glog"
"github.com/golang/glog"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/ginkgo"
...
@@ -44,7 +45,7 @@ import (
...
@@ -44,7 +45,7 @@ import (
"github.com/spf13/pflag"
"github.com/spf13/pflag"
)
)
var
e2es
*
E2EServices
var
e2es
*
services
.
E2EServices
var
prePullImages
=
flag
.
Bool
(
"prepull-images"
,
true
,
"If true, prepull images so image pull failures do not cause test failures."
)
var
prePullImages
=
flag
.
Bool
(
"prepull-images"
,
true
,
"If true, prepull images so image pull failures do not cause test failures."
)
var
runServicesMode
=
flag
.
Bool
(
"run-services-mode"
,
false
,
"If true, only run services (etcd, apiserver) in current process, and not run test."
)
var
runServicesMode
=
flag
.
Bool
(
"run-services-mode"
,
false
,
"If true, only run services (etcd, apiserver) in current process, and not run test."
)
...
@@ -61,7 +62,7 @@ func TestE2eNode(t *testing.T) {
...
@@ -61,7 +62,7 @@ func TestE2eNode(t *testing.T) {
pflag
.
Parse
()
pflag
.
Parse
()
if
*
runServicesMode
{
if
*
runServicesMode
{
// If run-services-mode is specified, only run services in current process.
// If run-services-mode is specified, only run services in current process.
RunE2EServices
()
services
.
RunE2EServices
()
return
return
}
}
// If run-services-mode is not specified, run test.
// If run-services-mode is not specified, run test.
...
@@ -85,10 +86,6 @@ func TestE2eNode(t *testing.T) {
...
@@ -85,10 +86,6 @@ func TestE2eNode(t *testing.T) {
// Setup the kubelet on the node
// Setup the kubelet on the node
var
_
=
SynchronizedBeforeSuite
(
func
()
[]
byte
{
var
_
=
SynchronizedBeforeSuite
(
func
()
[]
byte
{
if
*
buildServices
{
Expect
(
buildGo
())
.
To
(
Succeed
())
}
// Initialize node name here, so that the following code can get right node name.
// Initialize node name here, so that the following code can get right node name.
if
framework
.
TestContext
.
NodeName
==
""
{
if
framework
.
TestContext
.
NodeName
==
""
{
hostname
,
err
:=
os
.
Hostname
()
hostname
,
err
:=
os
.
Hostname
()
...
@@ -109,7 +106,7 @@ var _ = SynchronizedBeforeSuite(func() []byte {
...
@@ -109,7 +106,7 @@ var _ = SynchronizedBeforeSuite(func() []byte {
maskLocksmithdOnCoreos
()
maskLocksmithdOnCoreos
()
if
*
startServices
{
if
*
startServices
{
e2es
=
NewE2EServices
()
e2es
=
services
.
NewE2EServices
()
Expect
(
e2es
.
Start
())
.
To
(
Succeed
(),
"should be able to start node services."
)
Expect
(
e2es
.
Start
())
.
To
(
Succeed
(),
"should be able to start node services."
)
glog
.
Infof
(
"Node services started. Running tests..."
)
glog
.
Infof
(
"Node services started. Running tests..."
)
}
else
{
}
else
{
...
...
test/e2e_node/jenkins/e2e-node-jenkins.sh
View file @
afb780d4
...
@@ -42,7 +42,7 @@ TIMEOUT=${TIMEOUT:-"45m"}
...
@@ -42,7 +42,7 @@ TIMEOUT=${TIMEOUT:-"45m"}
mkdir
-p
${
ARTIFACTS
}
mkdir
-p
${
ARTIFACTS
}
go run
test
/e2e_node/runner/r
un_e2
e.go
--logtostderr
--vmodule
=
*
=
4
--ssh-env
=
"gce"
\
go run
test
/e2e_node/runner/r
emote/run_remot
e.go
--logtostderr
--vmodule
=
*
=
4
--ssh-env
=
"gce"
\
--zone
=
"
$GCE_ZONE
"
--project
=
"
$GCE_PROJECT
"
--hosts
=
"
$GCE_HOSTS
"
\
--zone
=
"
$GCE_ZONE
"
--project
=
"
$GCE_PROJECT
"
--hosts
=
"
$GCE_HOSTS
"
\
--images
=
"
$GCE_IMAGES
"
--image-project
=
"
$GCE_IMAGE_PROJECT
"
\
--images
=
"
$GCE_IMAGES
"
--image-project
=
"
$GCE_IMAGE_PROJECT
"
\
--image-config-file
=
"
$GCE_IMAGE_CONFIG_PATH
"
--cleanup
=
"
$CLEANUP
"
\
--image-config-file
=
"
$GCE_IMAGE_CONFIG_PATH
"
--cleanup
=
"
$CLEANUP
"
\
...
...
test/e2e_node/
e2e_
remote.go
→
test/e2e_node/
remote/
remote.go
View file @
afb780d4
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
package
e2e_nod
e
package
remot
e
import
(
import
(
"flag"
"flag"
...
@@ -31,6 +31,7 @@ import (
...
@@ -31,6 +31,7 @@ import (
"github.com/golang/glog"
"github.com/golang/glog"
utilerrors
"k8s.io/kubernetes/pkg/util/errors"
utilerrors
"k8s.io/kubernetes/pkg/util/errors"
"k8s.io/kubernetes/test/e2e_node/build"
)
)
var
sshOptions
=
flag
.
String
(
"ssh-options"
,
""
,
"Commandline options passed to ssh."
)
var
sshOptions
=
flag
.
String
(
"ssh-options"
,
""
,
"Commandline options passed to ssh."
)
...
@@ -82,12 +83,12 @@ func GetHostnameOrIp(hostname string) string {
...
@@ -82,12 +83,12 @@ func GetHostnameOrIp(hostname string) string {
// the binaries k8s required for node e2e tests
// the binaries k8s required for node e2e tests
func
CreateTestArchive
()
(
string
,
error
)
{
func
CreateTestArchive
()
(
string
,
error
)
{
// Build the executables
// Build the executables
if
err
:=
buildGo
();
err
!=
nil
{
if
err
:=
build
.
Build
Go
();
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"failed to build the depedencies: %v"
,
err
)
return
""
,
fmt
.
Errorf
(
"failed to build the depedencies: %v"
,
err
)
}
}
// Make sure we can find the newly built binaries
// Make sure we can find the newly built binaries
buildOutputDir
,
err
:=
g
etK8sBuildOutputDir
()
buildOutputDir
,
err
:=
build
.
G
etK8sBuildOutputDir
()
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"failed to locate kubernetes build output directory %v"
,
err
)
return
""
,
fmt
.
Errorf
(
"failed to locate kubernetes build output directory %v"
,
err
)
}
}
...
@@ -194,7 +195,7 @@ func RunRemote(archive string, host string, cleanup bool, junitFilePrefix string
...
@@ -194,7 +195,7 @@ func RunRemote(archive string, host string, cleanup bool, junitFilePrefix string
// Run the tests
// Run the tests
cmd
=
getSshCommand
(
" && "
,
cmd
=
getSshCommand
(
" && "
,
fmt
.
Sprintf
(
"cd %s"
,
tmp
),
fmt
.
Sprintf
(
"cd %s"
,
tmp
),
fmt
.
Sprintf
(
"timeout -k 30s %fs ./ginkgo %s ./e2e_node.test -- --logtostderr --v 2 --
build-services=false --
stop-services=%t --node-name=%s --report-dir=%s/results --report-prefix=%s %s"
,
fmt
.
Sprintf
(
"timeout -k 30s %fs ./ginkgo %s ./e2e_node.test -- --logtostderr --v 2 --stop-services=%t --node-name=%s --report-dir=%s/results --report-prefix=%s %s"
,
testTimeoutSeconds
.
Seconds
(),
ginkgoFlags
,
cleanup
,
host
,
tmp
,
junitFilePrefix
,
testArgs
),
testTimeoutSeconds
.
Seconds
(),
ginkgoFlags
,
cleanup
,
host
,
tmp
,
junitFilePrefix
,
testArgs
),
)
)
aggErrs
:=
[]
error
{}
aggErrs
:=
[]
error
{}
...
...
test/e2e_node/runner/local/run_local.go
0 → 100644
View file @
afb780d4
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
main
import
(
"flag"
"os"
"os/exec"
"path/filepath"
"strings"
"k8s.io/kubernetes/test/e2e_node/build"
"github.com/golang/glog"
)
var
buildDependencies
=
flag
.
Bool
(
"build-dependencies"
,
true
,
"If true, build all dependencies."
)
var
ginkgoFlags
=
flag
.
String
(
"ginkgo-flags"
,
""
,
"Space-separated list of arguments to pass to Ginkgo test runner."
)
var
testFlags
=
flag
.
String
(
"test-flags"
,
""
,
"Space-separated list of arguments to pass to node e2e test."
)
func
main
()
{
flag
.
Parse
()
// Build dependencies - ginkgo, kubelet and apiserver.
if
*
buildDependencies
{
if
err
:=
build
.
BuildGo
();
err
!=
nil
{
glog
.
Fatalf
(
"Failed to build the dependencies: %v"
,
err
)
}
}
// Run node e2e test
outputDir
,
err
:=
build
.
GetK8sBuildOutputDir
()
if
err
!=
nil
{
glog
.
Fatalf
(
"Failed to get build output directory: %v"
,
err
)
}
ginkgo
:=
filepath
.
Join
(
outputDir
,
"ginkgo"
)
test
:=
filepath
.
Join
(
outputDir
,
"e2e_node.test"
)
runCommand
(
ginkgo
,
*
ginkgoFlags
,
test
,
"--"
,
*
testFlags
)
return
}
func
runCommand
(
name
string
,
args
...
string
)
error
{
cmd
:=
exec
.
Command
(
"sh"
,
"-c"
,
strings
.
Join
(
append
([]
string
{
name
},
args
...
),
" "
))
cmd
.
Stdout
=
os
.
Stdout
cmd
.
Stderr
=
os
.
Stderr
return
cmd
.
Run
()
}
test/e2e_node/runner/r
un_e2
e.go
→
test/e2e_node/runner/r
emote/run_remot
e.go
View file @
afb780d4
...
@@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
...
@@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
// To run the
e2e tests
against one or more hosts on gce:
// To run the
node e2e tests remotely
against one or more hosts on gce:
// $ go run run_
e2
e.go --logtostderr --v 2 --ssh-env gce --hosts <comma separated hosts>
// $ go run run_
remot
e.go --logtostderr --v 2 --ssh-env gce --hosts <comma separated hosts>
// To run the
e2e tests
against one or more images on gce and provision them:
// To run the
node e2e tests remotely
against one or more images on gce and provision them:
// $ go run run_
e2
e.go --logtostderr --v 2 --project <project> --zone <zone> --ssh-env gce --images <comma separated images>
// $ go run run_
remot
e.go --logtostderr --v 2 --project <project> --zone <zone> --ssh-env gce --images <comma separated images>
package
main
package
main
import
(
import
(
...
@@ -34,7 +34,7 @@ import (
...
@@ -34,7 +34,7 @@ import (
"sync"
"sync"
"time"
"time"
"k8s.io/kubernetes/test/e2e_node"
"k8s.io/kubernetes/test/e2e_node
/remote
"
"github.com/ghodss/yaml"
"github.com/ghodss/yaml"
"github.com/golang/glog"
"github.com/golang/glog"
...
@@ -131,7 +131,7 @@ func main() {
...
@@ -131,7 +131,7 @@ func main() {
rand
.
Seed
(
time
.
Now
()
.
UTC
()
.
UnixNano
())
rand
.
Seed
(
time
.
Now
()
.
UTC
()
.
UnixNano
())
if
*
buildOnly
{
if
*
buildOnly
{
// Build the archive and exit
// Build the archive and exit
e2e_nod
e
.
CreateTestArchive
()
remot
e
.
CreateTestArchive
()
return
return
}
}
...
@@ -295,7 +295,7 @@ func callGubernator(gubernator bool) {
...
@@ -295,7 +295,7 @@ func callGubernator(gubernator bool) {
}
}
func
(
a
*
Archive
)
getArchive
()
(
string
,
error
)
{
func
(
a
*
Archive
)
getArchive
()
(
string
,
error
)
{
a
.
Do
(
func
()
{
a
.
path
,
a
.
err
=
e2e_nod
e
.
CreateTestArchive
()
})
a
.
Do
(
func
()
{
a
.
path
,
a
.
err
=
remot
e
.
CreateTestArchive
()
})
return
a
.
path
,
a
.
err
return
a
.
path
,
a
.
err
}
}
...
@@ -346,7 +346,7 @@ func testHost(host string, deleteFiles bool, junitFilePrefix string, setupNode b
...
@@ -346,7 +346,7 @@ func testHost(host string, deleteFiles bool, junitFilePrefix string, setupNode b
}
}
externalIp
:=
getExternalIp
(
instance
)
externalIp
:=
getExternalIp
(
instance
)
if
len
(
externalIp
)
>
0
{
if
len
(
externalIp
)
>
0
{
e2e_nod
e
.
AddHostnameIp
(
host
,
externalIp
)
remot
e
.
AddHostnameIp
(
host
,
externalIp
)
}
}
path
,
err
:=
arc
.
getArchive
()
path
,
err
:=
arc
.
getArchive
()
...
@@ -357,7 +357,7 @@ func testHost(host string, deleteFiles bool, junitFilePrefix string, setupNode b
...
@@ -357,7 +357,7 @@ func testHost(host string, deleteFiles bool, junitFilePrefix string, setupNode b
}
}
}
}
output
,
exitOk
,
err
:=
e2e_nod
e
.
RunRemote
(
path
,
host
,
deleteFiles
,
junitFilePrefix
,
setupNode
,
*
testArgs
,
ginkgoFlagsStr
)
output
,
exitOk
,
err
:=
remot
e
.
RunRemote
(
path
,
host
,
deleteFiles
,
junitFilePrefix
,
setupNode
,
*
testArgs
,
ginkgoFlagsStr
)
return
&
TestResult
{
return
&
TestResult
{
output
:
output
,
output
:
output
,
err
:
err
,
err
:
err
,
...
@@ -497,10 +497,10 @@ func createInstance(imageConfig *internalGCEImage) (string, error) {
...
@@ -497,10 +497,10 @@ func createInstance(imageConfig *internalGCEImage) (string, error) {
}
}
externalIp
:=
getExternalIp
(
instance
)
externalIp
:=
getExternalIp
(
instance
)
if
len
(
externalIp
)
>
0
{
if
len
(
externalIp
)
>
0
{
e2e_nod
e
.
AddHostnameIp
(
name
,
externalIp
)
remot
e
.
AddHostnameIp
(
name
,
externalIp
)
}
}
var
output
string
var
output
string
output
,
err
=
e2e_node
.
RunSshCommand
(
"ssh"
,
e2e_nod
e
.
GetHostnameOrIp
(
name
),
"--"
,
"sudo"
,
"docker"
,
"version"
)
output
,
err
=
remote
.
RunSshCommand
(
"ssh"
,
remot
e
.
GetHostnameOrIp
(
name
),
"--"
,
"sudo"
,
"docker"
,
"version"
)
if
err
!=
nil
{
if
err
!=
nil
{
err
=
fmt
.
Errorf
(
"instance %s not running docker daemon - Command failed: %s"
,
name
,
output
)
err
=
fmt
.
Errorf
(
"instance %s not running docker daemon - Command failed: %s"
,
name
,
output
)
continue
continue
...
...
test/e2e_node/apiserver.go
→
test/e2e_node/
services/
apiserver.go
View file @
afb780d4
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
package
e2e_node
package
services
import
(
import
(
"fmt"
"fmt"
...
...
test/e2e_node/etcd.go
→
test/e2e_node/
services/
etcd.go
View file @
afb780d4
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
package
e2e_node
package
services
import
(
import
(
"crypto/tls"
"crypto/tls"
...
...
test/e2e_node/namespace_controller.go
→
test/e2e_node/
services/
namespace_controller.go
View file @
afb780d4
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
package
e2e_node
package
services
import
(
import
(
"time"
"time"
...
...
test/e2e_node/
e2e_service
.go
→
test/e2e_node/
services/services
.go
View file @
afb780d4
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
...
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
package
e2e_node
package
services
import
(
import
(
"flag"
"flag"
...
@@ -37,6 +37,7 @@ import (
...
@@ -37,6 +37,7 @@ import (
"github.com/kardianos/osext"
"github.com/kardianos/osext"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e_node/build"
)
)
// TODO(random-liu): Move this file to a separate package.
// TODO(random-liu): Move this file to a separate package.
...
@@ -194,10 +195,6 @@ func (es *e2eService) run() error {
...
@@ -194,10 +195,6 @@ func (es *e2eService) run() error {
}
}
func
(
es
*
e2eService
)
start
()
error
{
func
(
es
*
e2eService
)
start
()
error
{
if
_
,
err
:=
getK8sBin
(
"kubelet"
);
err
!=
nil
{
return
err
}
err
:=
es
.
startEtcd
()
err
:=
es
.
startEtcd
()
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -341,7 +338,7 @@ func (es *e2eService) startKubeletServer() (*server, error) {
...
@@ -341,7 +338,7 @@ func (es *e2eService) startKubeletServer() (*server, error) {
// Since kubelet will typically be run as a service it also makes more
// Since kubelet will typically be run as a service it also makes more
// sense to test it that way
// sense to test it that way
unitName
:=
fmt
.
Sprintf
(
"kubelet-%d.service"
,
rand
.
Int31
())
unitName
:=
fmt
.
Sprintf
(
"kubelet-%d.service"
,
rand
.
Int31
())
cmdArgs
=
append
(
cmdArgs
,
systemdRun
,
"--unit="
+
unitName
,
"--remain-after-exit"
,
g
etKubeletServerBin
())
cmdArgs
=
append
(
cmdArgs
,
systemdRun
,
"--unit="
+
unitName
,
"--remain-after-exit"
,
build
.
G
etKubeletServerBin
())
killCommand
=
exec
.
Command
(
"sudo"
,
"systemctl"
,
"kill"
,
unitName
)
killCommand
=
exec
.
Command
(
"sudo"
,
"systemctl"
,
"kill"
,
unitName
)
restartCommand
=
exec
.
Command
(
"sudo"
,
"systemctl"
,
"restart"
,
unitName
)
restartCommand
=
exec
.
Command
(
"sudo"
,
"systemctl"
,
"restart"
,
unitName
)
es
.
logFiles
[
"kubelet.log"
]
=
logFileData
{
es
.
logFiles
[
"kubelet.log"
]
=
logFileData
{
...
@@ -349,7 +346,7 @@ func (es *e2eService) startKubeletServer() (*server, error) {
...
@@ -349,7 +346,7 @@ func (es *e2eService) startKubeletServer() (*server, error) {
}
}
framework
.
TestContext
.
EvictionHard
=
adjustConfigForSystemd
(
framework
.
TestContext
.
EvictionHard
)
framework
.
TestContext
.
EvictionHard
=
adjustConfigForSystemd
(
framework
.
TestContext
.
EvictionHard
)
}
else
{
}
else
{
cmdArgs
=
append
(
cmdArgs
,
g
etKubeletServerBin
())
cmdArgs
=
append
(
cmdArgs
,
build
.
G
etKubeletServerBin
())
cmdArgs
=
append
(
cmdArgs
,
cmdArgs
=
append
(
cmdArgs
,
"--runtime-cgroups=/docker-daemon"
,
"--runtime-cgroups=/docker-daemon"
,
"--kubelet-cgroups=/kubelet"
,
"--kubelet-cgroups=/kubelet"
,
...
@@ -387,7 +384,8 @@ func (es *e2eService) startKubeletServer() (*server, error) {
...
@@ -387,7 +384,8 @@ func (es *e2eService) startKubeletServer() (*server, error) {
}
}
cmdArgs
=
append
(
cmdArgs
,
cmdArgs
=
append
(
cmdArgs
,
"--network-plugin=kubenet"
,
"--network-plugin=kubenet"
,
"--network-plugin-dir"
,
filepath
.
Join
(
cwd
,
CNIDirectory
,
"bin"
))
// Enable kubenet
// TODO(random-liu): Make sure the cni directory name is the same with that in remote/remote.go
"--network-plugin-dir"
,
filepath
.
Join
(
cwd
,
"cni"
,
"bin"
))
// Enable kubenet
}
}
cmd
:=
exec
.
Command
(
"sudo"
,
cmdArgs
...
)
cmd
:=
exec
.
Command
(
"sudo"
,
cmdArgs
...
)
...
...
test/e2e_node/util.go
View file @
afb780d4
...
@@ -20,8 +20,8 @@ import (
...
@@ -20,8 +20,8 @@ import (
"flag"
"flag"
)
)
// TODO(random-liu): Get this automatically from kubelet flag.
var
kubeletAddress
=
flag
.
String
(
"kubelet-address"
,
"http://127.0.0.1:10255"
,
"Host and port of the kubelet"
)
var
kubeletAddress
=
flag
.
String
(
"kubelet-address"
,
"http://127.0.0.1:10255"
,
"Host and port of the kubelet"
)
var
buildServices
=
flag
.
Bool
(
"build-services"
,
true
,
"If true, build local executables"
)
var
startServices
=
flag
.
Bool
(
"start-services"
,
true
,
"If true, start local node services"
)
var
startServices
=
flag
.
Bool
(
"start-services"
,
true
,
"If true, start local node services"
)
var
stopServices
=
flag
.
Bool
(
"stop-services"
,
true
,
"If true, stop local node services after running tests"
)
var
stopServices
=
flag
.
Bool
(
"stop-services"
,
true
,
"If true, stop local node services after running tests"
)
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