commit
05f9f74aa4
3
Makefile
3
Makefile
@ -22,6 +22,9 @@ test:
|
||||
@$(GO) test -short -race $(pkgs)
|
||||
|
||||
test-integration:
|
||||
GO_FLAGS="-race" ./build/build.sh
|
||||
go test -c github.com/google/cadvisor/integration/tests/api
|
||||
go test -c github.com/google/cadvisor/integration/tests/healthz
|
||||
@./build/integration.sh
|
||||
|
||||
test-runner:
|
||||
|
@ -14,21 +14,19 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
if [[ -n "${JENKINS_HOME}" ]]; then
|
||||
exec ./build/jenkins_e2e.sh
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
# Build the test binary.
|
||||
GO_FLAGS="-race" ./build/build.sh
|
||||
log_file="cadvisor.log"
|
||||
if [ "$#" -gt 0 ]; then
|
||||
log_file="$1"
|
||||
fi
|
||||
|
||||
TEST_PID=$$
|
||||
sudo printf "" # Refresh sudo credentials if necessary.
|
||||
printf "" # Refresh sudo credentials if necessary.
|
||||
function start {
|
||||
set +e # We want to handle errors if cAdvisor crashes.
|
||||
echo ">> starting cAdvisor locally"
|
||||
GORACE="halt_on_error=1" sudo -E ./cadvisor --docker_env_metadata_whitelist=TEST_VAR
|
||||
GORACE="halt_on_error=1" ./cadvisor --docker_env_metadata_whitelist=TEST_VAR --v=4 --logtostderr &> "$log_file"
|
||||
if [ $? != 0 ]; then
|
||||
echo "!! cAdvisor exited unexpectedly with Exit $?"
|
||||
kill $TEST_PID # cAdvisor crashed: abort testing.
|
||||
@ -40,7 +38,7 @@ RUNNER_PID=$!
|
||||
function cleanup {
|
||||
if pgrep cadvisor > /dev/null; then
|
||||
echo ">> stopping cAdvisor"
|
||||
sudo pkill -SIGINT cadvisor
|
||||
pkill -SIGINT cadvisor
|
||||
wait $RUNNER_PID
|
||||
fi
|
||||
}
|
||||
@ -58,4 +56,5 @@ while [ "$(curl -Gs http://localhost:8080/healthz)" != "ok" ]; do
|
||||
done
|
||||
|
||||
echo ">> running integration tests against local cAdvisor"
|
||||
go test github.com/google/cadvisor/integration/tests/... --vmodule=*=2
|
||||
./api.test --vmodule=*=2
|
||||
./healthz.test --vmodule=*=2
|
||||
|
@ -1,67 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2016 Google Inc. All rights reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
BUILDER=${BUILDER:-false} # Whether this is running a PR builder job.
|
||||
|
||||
export GO_FLAGS="-race"
|
||||
export GORACE="halt_on_error=1"
|
||||
|
||||
# Check whether assets need to be rebuilt.
|
||||
FORCE=true build/assets.sh
|
||||
if [[ ! -z "$(git diff --name-only pages)" ]]; then
|
||||
echo "Found changes to UI assets:"
|
||||
git diff --name-only pages
|
||||
echo "Run: `make assets FORCE=true`"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Build & test with go 1.8
|
||||
docker run --rm \
|
||||
-w "/go/src/github.com/google/cadvisor" \
|
||||
-v "${GOPATH}/src/github.com/google/cadvisor:/go/src/github.com/google/cadvisor" \
|
||||
golang:1.8 make all test-runner
|
||||
|
||||
# Nodes that are currently stable. When tests fail on a specific node, and the failure is not remedied within a week, that node will be removed from this list.
|
||||
golden_nodes=(
|
||||
e2e-cadvisor-ubuntu-trusty
|
||||
e2e-cadvisor-container-vm-v20151215
|
||||
e2e-cadvisor-container-vm-v20160127
|
||||
e2e-cadvisor-rhel-7
|
||||
)
|
||||
|
||||
# TODO: Add test on GCI
|
||||
|
||||
# TODO: Add test for kubernetes default image
|
||||
# e2e-cadvisor-container-vm-v20160321
|
||||
|
||||
# TODO: Temporarily disabled for #1344
|
||||
# e2e-cadvisor-coreos-beta
|
||||
|
||||
# TODO: enable when docker 1.10 is working
|
||||
# e2e-cadvisor-ubuntu-trusty-docker110
|
||||
|
||||
# TODO: Always fails with "Network tx and rx bytes should not be equal"
|
||||
# e2e-cadvisor-centos-v7
|
||||
|
||||
max_retries=8
|
||||
|
||||
./runner --logtostderr --test-retry-count=$max_retries \
|
||||
--test-retry-whitelist=integration/runner/retrywhitelist.txt \
|
||||
--ssh-options "-i /var/lib/jenkins/gce_keys/google_compute_engine -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o CheckHostIP=no -o StrictHostKeyChecking=no" \
|
||||
${golden_nodes[*]}
|
42
build/prow_e2e.sh
Executable file
42
build/prow_e2e.sh
Executable file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2018 Google Inc. All rights reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
BUILDER=${BUILDER:-false} # Whether this is running a PR builder job.
|
||||
|
||||
export GO_FLAGS="-race"
|
||||
export GORACE="halt_on_error=1"
|
||||
|
||||
# cd to cadvisor directory
|
||||
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
|
||||
cd "$parent_path/.."
|
||||
|
||||
# Check whether assets need to be rebuilt.
|
||||
FORCE=true build/assets.sh
|
||||
if [[ ! -z "$(git diff --name-only pages)" ]]; then
|
||||
echo "Found changes to UI assets:"
|
||||
git diff --name-only pages
|
||||
echo "Run: `make assets FORCE=true`"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
make all
|
||||
|
||||
# compile integration tests so they can be run without go installed
|
||||
go test -c github.com/google/cadvisor/integration/tests/api
|
||||
go test -c github.com/google/cadvisor/integration/tests/healthz
|
@ -193,15 +193,11 @@ func TestDockerContainerSpec(t *testing.T) {
|
||||
labels = map[string]string{"bar": "baz"}
|
||||
)
|
||||
|
||||
cpusetArg := "--cpuset"
|
||||
if getDockerMinorVersion(fm) >= 10 {
|
||||
cpusetArg = "--cpuset-cpus"
|
||||
}
|
||||
containerId := fm.Docker().Run(framework.DockerRunArgs{
|
||||
Image: image,
|
||||
Args: []string{
|
||||
"--cpu-shares", strconv.FormatUint(cpuShares, 10),
|
||||
cpusetArg, cpuMask,
|
||||
"--cpuset-cpus", cpuMask,
|
||||
"--memory", strconv.FormatUint(memoryLimit, 10),
|
||||
"--env", "TEST_VAR=FOO",
|
||||
"--label", "bar=baz",
|
||||
|
Loading…
Reference in New Issue
Block a user