[fix-hyper-vendor] update hypercli in vendor

This commit is contained in:
Jimmy Xu
2018-01-05 12:32:03 +00:00
committed by Robbie Zhang
parent e050fea889
commit 0e123c783b
21 changed files with 726 additions and 3 deletions

View File

@@ -52,3 +52,7 @@
[[constraint]]
name = "github.com/gorilla/mux"
version = "1.6.0"
[[constraint]]
name = "github.com/hyperhq/hypercli"
revision = "3e4e4fa373cbf8672bded67688b4821cd30b37f9"

3
vendor/github.com/hyperhq/hypercli/.dockerignore generated vendored Normal file
View File

@@ -0,0 +1,3 @@
bundles
.gopath
vendor/pkg

42
vendor/github.com/hyperhq/hypercli/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,42 @@
# Docker project generated files to ignore
# if you want to ignore files created by your editor/tools,
# please consider a global .gitignore https://help.github.com/articles/ignoring-files
*.exe
*.exe~
*.orig
*.test
.*.swp
.DS_Store
.bashrc
.dotcloud
.flymake*
.git/
.gopath/
.hg/
.vagrant*
Vagrantfile
a.out
autogen/
bin
build_src
bundles/
docker/docker
hyper/hyper
dockerversion/version_autogen.go
docs/AWS_S3_BUCKET
docs/GITCOMMIT
docs/GIT_BRANCH
docs/VERSION
docs/_build
docs/_static
docs/_templates
docs/changed-files
# generated by man/md2man-all.sh
man/man1
man/man5
man/man8
pyenv
vendor/pkg/
*.yml
.idea
integration-cli/util.conf

171
vendor/github.com/hyperhq/hypercli/.mailmap generated vendored Normal file
View File

@@ -0,0 +1,171 @@
# Generate AUTHORS: hack/generate-authors.sh
# Tip for finding duplicates (besides scanning the output of AUTHORS for name
# duplicates that aren't also email duplicates): scan the output of:
# git log --format='%aE - %aN' | sort -uf
#
# For explanation on this file format: man git-shortlog
Patrick Stapleton <github@gdi2290.com>
Shishir Mahajan <shishir.mahajan@redhat.com> <smahajan@redhat.com>
Erwin van der Koogh <info@erronis.nl>
Ahmed Kamal <email.ahmedkamal@googlemail.com>
Tejesh Mehta <tejesh.mehta@gmail.com> <tj@init.me>
Cristian Staretu <cristian.staretu@gmail.com>
Cristian Staretu <cristian.staretu@gmail.com> <unclejacksons@gmail.com>
Cristian Staretu <cristian.staretu@gmail.com> <unclejack@users.noreply.github.com>
Marcus Linke <marcus.linke@gmx.de>
Aleksandrs Fadins <aleks@s-ko.net>
Christopher Latham <sudosurootdev@gmail.com>
Hu Keping <hukeping@huawei.com>
Wayne Chang <wayne@neverfear.org>
Chen Chao <cc272309126@gmail.com>
Daehyeok Mun <daehyeok@gmail.com>
<daehyeok@gmail.com> <daehyeok@daehyeokui-MacBook-Air.local>
<jt@yadutaf.fr> <admin@jtlebi.fr>
<jeff@docker.com> <jefferya@programmerq.net>
<charles.hooper@dotcloud.com> <chooper@plumata.com>
<daniel.mizyrycki@dotcloud.com> <daniel@dotcloud.com>
<daniel.mizyrycki@dotcloud.com> <mzdaniel@glidelink.net>
Guillaume J. Charmes <guillaume.charmes@docker.com> <charmes.guillaume@gmail.com>
<guillaume.charmes@docker.com> <guillaume@dotcloud.com>
<guillaume.charmes@docker.com> <guillaume@docker.com>
<guillaume.charmes@docker.com> <guillaume.charmes@dotcloud.com>
<guillaume.charmes@docker.com> <guillaume@charmes.net>
<kencochrane@gmail.com> <KenCochrane@gmail.com>
Thatcher Peskens <thatcher@docker.com>
Thatcher Peskens <thatcher@docker.com> <thatcher@dotcloud.com>
Thatcher Peskens <thatcher@docker.com> dhrp <thatcher@gmx.net>
Jérôme Petazzoni <jerome.petazzoni@dotcloud.com> jpetazzo <jerome.petazzoni@dotcloud.com>
Jérôme Petazzoni <jerome.petazzoni@dotcloud.com> <jp@enix.org>
Joffrey F <joffrey@docker.com>
Joffrey F <joffrey@docker.com> <joffrey@dotcloud.com>
Joffrey F <joffrey@docker.com> <f.joffrey@gmail.com>
Tim Terhorst <mynamewastaken+git@gmail.com>
Andy Smith <github@anarkystic.com>
<kalessin@kalessin.fr> <louis@dotcloud.com>
<victor.vieux@docker.com> <victor.vieux@dotcloud.com>
<victor.vieux@docker.com> <victor@dotcloud.com>
<victor.vieux@docker.com> <dev@vvieux.com>
<victor.vieux@docker.com> <victor@docker.com>
<victor.vieux@docker.com> <vieux@docker.com>
<victor.vieux@docker.com> <victorvieux@gmail.com>
<dominik@honnef.co> <dominikh@fork-bomb.org>
<ehanchrow@ine.com> <eric.hanchrow@gmail.com>
Walter Stanish <walter@pratyeka.org>
<daniel@gasienica.ch> <dgasienica@zynga.com>
Roberto Hashioka <roberto_hashioka@hotmail.com>
Konstantin Pelykh <kpelykh@zettaset.com>
David Sissitka <me@dsissitka.com>
Nolan Darilek <nolan@thewordnerd.info>
<mastahyeti@gmail.com> <mastahyeti@users.noreply.github.com>
Benoit Chesneau <bchesneau@gmail.com>
Jordan Arentsen <blissdev@gmail.com>
Daniel Garcia <daniel@danielgarcia.info>
Miguel Angel Fernández <elmendalerenda@gmail.com>
Bhiraj Butala <abhiraj.butala@gmail.com>
Faiz Khan <faizkhan00@gmail.com>
Victor Lyuboslavsky <victor@victoreda.com>
Jean-Baptiste Barth <jeanbaptiste.barth@gmail.com>
Matthew Mueller <mattmuelle@gmail.com>
<mosoni@ebay.com> <mohitsoni1989@gmail.com>
Shih-Yuan Lee <fourdollars@gmail.com>
Daniel Mizyrycki <daniel.mizyrycki@dotcloud.com> root <root@vagrant-ubuntu-12.10.vagrantup.com>
Jean-Baptiste Dalido <jeanbaptiste@appgratis.com>
<proppy@google.com> <proppy@aminche.com>
<michael@docker.com> <michael@crosbymichael.com>
<michael@docker.com> <crosby.michael@gmail.com>
<michael@docker.com> <crosbymichael@gmail.com>
<github@developersupport.net> <github@metaliveblog.com>
<brandon@ifup.org> <brandon@ifup.co>
<dano@spotify.com> <daniel.norberg@gmail.com>
<danny@codeaholics.org> <Danny.Yates@mailonline.co.uk>
<gurjeet@singh.im> <singh.gurjeet@gmail.com>
<shawn@churchofgit.com> <shawnlandden@gmail.com>
<sjoerd-github@linuxonly.nl> <sjoerd@byte.nl>
<solomon@docker.com> <solomon.hykes@dotcloud.com>
<solomon@docker.com> <solomon@dotcloud.com>
<solomon@docker.com> <s@docker.com>
Sven Dowideit <SvenDowideit@home.org.au>
Sven Dowideit <SvenDowideit@home.org.au> <SvenDowideit@fosiki.com>
Sven Dowideit <SvenDowideit@home.org.au> <SvenDowideit@docker.com>
Sven Dowideit <SvenDowideit@home.org.au> <¨SvenDowideit@home.org.au¨>
Sven Dowideit <SvenDowideit@home.org.au> <SvenDowideit@users.noreply.github.com>
Sven Dowideit <SvenDowideit@home.org.au> <sven@t440s.home.gateway>
<alexl@redhat.com> <alexander.larsson@gmail.com>
Alexandr Morozov <lk4d4math@gmail.com>
<git.nivoc@neverbox.com> <kuehnle@online.de>
O.S. Tezer <ostezer@gmail.com>
<ostezer@gmail.com> <ostezer@users.noreply.github.com>
Roberto G. Hashioka <roberto.hashioka@docker.com> <roberto_hashioka@hotmail.com>
<justin.p.simonelis@gmail.com> <justin.simonelis@PTS-JSIMON2.toronto.exclamation.com>
<taim@bosboot.org> <maztaim@users.noreply.github.com>
<viktor.vojnovski@amadeus.com> <vojnovski@gmail.com>
<vbatts@redhat.com> <vbatts@hashbangbash.com>
<altsysrq@gmail.com> <iamironbob@gmail.com>
Sridhar Ratnakumar <sridharr@activestate.com>
Sridhar Ratnakumar <sridharr@activestate.com> <github@srid.name>
Liang-Chi Hsieh <viirya@gmail.com>
Aleksa Sarai <cyphar@cyphar.com>
Will Weaver <monkey@buildingbananas.com>
Timothy Hobbs <timothyhobbs@seznam.cz>
Nathan LeClaire <nathan.leclaire@docker.com> <nathan.leclaire@gmail.com>
Nathan LeClaire <nathan.leclaire@docker.com> <nathanleclaire@gmail.com>
<github@hollensbe.org> <erik+github@hollensbe.org>
<github@albersweb.de> <albers@users.noreply.github.com>
<lsm5@fedoraproject.org> <lsm5@redhat.com>
<marc@marc-abramowitz.com> <msabramo@gmail.com>
Matthew Heon <mheon@redhat.com> <mheon@mheonlaptop.redhat.com>
<bernat@luffy.cx> <vincent@bernat.im>
<p@pwaller.net> <peter@scraperwiki.com>
<andrew.weiss@outlook.com> <andrew.weiss@microsoft.com>
Francisco Carriedo <fcarriedo@gmail.com>
<julienbordellier@gmail.com> <git@julienbordellier.com>
<ahmetb@microsoft.com> <ahmetalpbalkan@gmail.com>
<lk4d4@docker.com> <lk4d4math@gmail.com>
<arnaud.porterie@docker.com> <icecrime@gmail.com>
<baloo@gandi.net> <superbaloo+registrations.github@superbaloo.net>
Brian Goff <cpuguy83@gmail.com>
<cpuguy83@gmail.com> <bgoff@cpuguy83-mbp.home>
<ewindisch@docker.com> <eric@windisch.us>
<frank.rosquin+github@gmail.com> <frank.rosquin@gmail.com>
Hollie Teal <hollie@docker.com>
<hollie@docker.com> <hollie.teal@docker.com>
<hollie@docker.com> <hollietealok@users.noreply.github.com>
<huu@prismskylabs.com> <whoshuu@gmail.com>
Jessica Frazelle <jess@docker.com> Jessie Frazelle <jfrazelle@users.noreply.github.com>
<jess@docker.com> <jfrazelle@users.noreply.github.com>
<konrad.wilhelm.kleine@gmail.com> <kwk@users.noreply.github.com>
<tintypemolly@gmail.com> <tintypemolly@Ohui-MacBook-Pro.local>
<estesp@linux.vnet.ibm.com> <estesp@gmail.com>
<github@gone.nl> <thaJeztah@users.noreply.github.com>
Thomas LEVEIL <thomasleveil@gmail.com> Thomas LÉVEIL <thomasleveil@users.noreply.github.com>
<oi@truffles.me.uk> <timruffles@googlemail.com>
<Vincent.Bernat@exoscale.ch> <bernat@luffy.cx>
Antonio Murdaca <antonio.murdaca@gmail.com> <me@runcom.ninja>
Antonio Murdaca <antonio.murdaca@gmail.com> <runcom@linux.com>
Antonio Murdaca <antonio.murdaca@gmail.com> <runcom@users.noreply.github.com>
Darren Shepherd <darren.s.shepherd@gmail.com> <darren@rancher.com>
Deshi Xiao <dxiao@redhat.com> <dsxiao@dataman-inc.com>
Deshi Xiao <dxiao@redhat.com> <xiaods@gmail.com>
Doug Davis <dug@us.ibm.com> <duglin@users.noreply.github.com>
Jacob Atzen <jacob@jacobatzen.dk> <jatzen@gmail.com>
Jeff Nickoloff <jeff.nickoloff@gmail.com> <jeff@allingeek.com>
<jess@docker.com> <princess@docker.com>
John Howard (VM) <John.Howard@microsoft.com> John Howard <jhoward@microsoft.com>
Madhu Venugopal <madhu@socketplane.io> <madhu@docker.com>
Mary Anthony <mary.anthony@docker.com> <mary@docker.com>
Mary Anthony <mary.anthony@docker.com> moxiegirl <mary@docker.com>
Mary Anthony <mary.anthony@docker.com> <moxieandmore@gmail.com>
mattyw <mattyw@me.com> <gh@mattyw.net>
resouer <resouer@163.com> <resouer@gmail.com>
AJ Bowen <aj@gandi.net> soulshake <amy@gandi.net>
AJ Bowen <aj@gandi.net> soulshake <aj@gandi.net>
Tibor Vass <teabee89@gmail.com> <tibor@docker.com>
Tibor Vass <teabee89@gmail.com> <tiborvass@users.noreply.github.com>
Vincent Bernat <bernat@luffy.cx> <Vincent.Bernat@exoscale.ch>
Yestin Sun <sunyi0804@gmail.com> <yestin.sun@polyera.com>
bin liu <liubin0329@users.noreply.github.com> <liubin0329@gmail.com>
John Howard (VM) <John.Howard@microsoft.com> jhowardmsft <jhoward@microsoft.com>
Ankush Agarwal <ankushagarwal11@gmail.com> <ankushagarwal@users.noreply.github.com>
Tangi COLIN <tangicolin@gmail.com> tangicolin <tangicolin@gmail.com>

6
vendor/github.com/hyperhq/hypercli/api/client/trust.go generated vendored Normal file → Executable file
View File

@@ -114,7 +114,7 @@ func (cli *DockerCli) getNotaryRepository(repoInfo *registry.RepositoryInfo, aut
return nil, err
}
var cfg = tlsconfig.ClientDefault
var cfg = tlsconfig.ClientDefault()
cfg.InsecureSkipVerify = !repoInfo.Index.Secure
// Get certificate base directory
@@ -124,7 +124,7 @@ func (cli *DockerCli) getNotaryRepository(repoInfo *registry.RepositoryInfo, aut
}
logrus.Debugf("reading certificate directory: %s", certDir)
if err := registry.ReadCertsDirectory(&cfg, certDir); err != nil {
if err := registry.ReadCertsDirectory(cfg, certDir); err != nil {
return nil, err
}
@@ -136,7 +136,7 @@ func (cli *DockerCli) getNotaryRepository(repoInfo *registry.RepositoryInfo, aut
DualStack: true,
}).Dial,
TLSHandshakeTimeout: 10 * time.Second,
TLSClientConfig: &cfg,
TLSClientConfig: cfg,
DisableKeepAlives: true,
}

2
vendor/github.com/hyperhq/hypercli/hack/update-gofmt.sh generated vendored Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
find . -name "*.go" | grep -v Godeps |grep -v vendor | xargs gofmt -s -w

0
vendor/github.com/hyperhq/hypercli/integration-cli/README.md generated vendored Executable file → Normal file
View File

View File

@@ -0,0 +1,82 @@
FROM centos:7.3.1611
#This Dockerfile is used for autotest hypercli
#REF: integration-cli/README.md
###################################
## install common package ##
###################################
RUN yum install -y\
automake \
autoconf \
make \
gcc \
wget \
time \
git \
which \
screen &&\
yum clean all
########################################
## prepare java run env ##
########################################
RUN wget --no-check-certificate --no-cookies \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.rpm \
&& rpm -ivh jdk-8u141-linux-x64.rpm && rm -rf jdk-8u141-linux-x64.rpm
ENV JAVA_HOME /usr/java/jdk1.8.0_141
ENV PATH $PATH:$JAVA_HOME/bin
###########################
## install golang ##
###########################
ENV GO_VERSION 1.8.3
RUN wget http://golangtc.com/static/go/${GO_VERSION}/go${GO_VERSION}.linux-amd64.tar.gz
RUN tar -xzf go${GO_VERSION}.linux-amd64.tar.gz -C /usr/local
ENV GOROOT /usr/local/go
ENV PATH $GOROOT/bin:$PATH
##########################################
## prepare jenkins slave run env ##
##########################################
ENV HOME /home/jenkins
RUN groupadd -g 10000 jenkins
RUN useradd -c "Jenkins user" -d $HOME -u 10000 -g 10000 -m jenkins
RUN mkdir /home/jenkins/.tmp
VOLUME ["/home/jenkins"]
WORKDIR $HOME
USER root
################################
## prepare for build env ##
################################
## Env
ENV PATH /go/bin:/usr/local/go/bin:/usr/bin:/usr/local/bin:$PATH
ENV GOPATH /go:/go/src/github.com/hyperhq/hypercli/integration-cli/vendor:/go/src/github.com/hyperhq/hypercli/vendor
#TARGET_REGION could be: us-west-1|eu-central-1|RegionOne
ENV TARGET_REGION=${TARGET_REGION:-us-west-1}
ENV BRANCH=${BRANCH:-master}
ENV TEST_CASE_REG=${TEST_CASE_REG:-TestCli.*}
## hyper account for test
ENV ACCESS_KEY=
ENV SECRET_KEY=
## slack parameter
ENV SLACK_TOKEN=
ENV SLACK_CHANNEL_ID=
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
COPY script/slack.sh /usr/local/bin/slack.sh
COPY script/run.sh /usr/local/bin/run.sh
ENTRYPOINT ["entrypoint.sh"]
CMD ["run.sh"]

View File

@@ -0,0 +1,3 @@
#!/bin/bash
exec "$@"

View File

@@ -0,0 +1 @@
config

View File

@@ -0,0 +1,17 @@
TARGET_REGION="us-west-1"
BRANCH="master"
TEST_CASE_REG="TestCli.*Basic"
TIMEOUT="90m"
# hyper credentrial for test
ACCESS_KEY=""
SECRET_KEY=""
################################
# slack token
# https://api.slack.com/methods/workspace-tokens
# https://api.slack.com/docs/token-types
# https://api.slack.com/custom-integrations/legacy-tokens
################################
SLACK_TOKEN="xoxp-xxxxxxxxxxx"
SLACK_CHANNEL_ID="C7AB6M1NJ" #hykins-monitor

View File

@@ -0,0 +1,279 @@
#!/bin/bash
export HYPER_CONFIG=~/.hyper
export DOCKER_REMOTE_DAEMON=1
export DOCKER_CERT_PATH=fixtures/hyper_ssl
export DOCKER_TLS_VERIFY=
#check hyper credentrial
if [[ "${ACCESS_KEY}" == "" ]] || [[ "${SECRET_KEY}" == "" ]];then
echo "Error: Please set ACCESS_KEY and SECRET_KEY"
exit 1
fi
if [ "${TARGET_REGION}" = "eu-central-1" ]
then
#test eu1 with zl2 container
export TARGET_NAME="eu1"
export REGION="eu-central-1"
export DOCKER_HOST="tcp://${REGION}.hyper.sh:443"
elif [ "${TARGET_REGION}" = "us-west-1" ]
then
#test zl2 with eu1 container
export TARGET_NAME="zl2"
export REGION="us-west-1"
export DOCKER_HOST="tcp://${REGION}.hyper.sh:443"
elif [ "${TARGET_REGION}" = "RegionOne" ]
then
#test packet with zl2 container
export TARGET_NAME="pkt"
export REGION="RegionOne"
export DOCKER_HOST="tcp://147.75.195.39:6443"
else
echo "unknow TARGET_REGION:${TARGET_REGION}"
exit 1
fi
TITLE="*hypercli integration auto-test for \`${TARGET_NAME}\`* - ${BEGIN_TIME} *\`${TEST_CASE_REG}\`*"
# job url
JOB_URL="http://ci.hypercontainer.io:8080/job/${JOB_NAME}/${BUILD_NUMBER}/console"
echo "JOB_URL: ${JOB_URL}"
# branch url
PR_PRE=$(expr substr ${BRANCH} 1 1)
if [ "$PR_PRE" = "#" ]
then
PR_NUMBER=$(echo ${BRANCH} | awk '{print substr($1,2)}')
echo "========== Task: test PR ${PR_NUMBER} =========="
BRANCH_URL="https://github.com/hyperhq/hypercli/pull/${PR_NUMBER}/commits"
else
echo "========== Task: test BRANCH ${BRANCH} =========="
BRANCH_URL="https://github.com/hyperhq/hypercli/commits/${BRANCH}"
fi
echo "BRANCH_URL: ${BRANCH_URL}"
#ensure config for hyper cli
mkdir -p ${HYPER_CONFIG}
cat > ${HYPER_CONFIG}/config.json <<EOF
{
"clouds": {
"${DOCKER_HOST}": {
"accesskey": "${ACCESS_KEY}",
"secretkey": "${SECRET_KEY}",
"region": "${REGION}"
},
"tcp://*.hyper.sh:443": {
"accesskey": "${ACCESS_KEY}",
"secretkey": "${SECRET_KEY}",
"region": "${REGION}"
}
}
}
EOF
echo "========== config git proxy =========="
if [ "${http_proxy}" != "" ];then
git config --global http.proxy ${http_proxy}
fi
if [ "${https_proxy}" != "" ];then
git config --global https.proxy ${https_proxy}
fi
git config --list | grep proxy
echo "========== ping github.com =========="
ping -c 3 -W 10 github.com
echo "========== Clone hypercli repo =========="
mkdir -p /go/src/github.com/{hyperhq,docker}
cd /go/src/github.com/hyperhq
git clone https://github.com/hyperhq/hypercli.git
echo "========== Build hypercli =========="
cd /go/src/github.com/hyperhq/hypercli
if [[ "${PR_PRE}" == "#" ]];then
echo "checkout pr :#${PR_NUMBER}"
git fetch origin pull/${PR_NUMBER}/head:pr-${PR_NUMBER}
git checkout pr-${PR_NUMBER}
else
echo "checkout branch :${BRANCH}"
git checkout ${BRANCH}
fi
if [[ $? -ne 0 ]];then
echo "Branch ${BRANCH} not exist!"
exit 1
fi
./build.sh
if [ $? -ne 0 ];then
echo "Build hypercli failed"
exit 1
fi
ln -s /go/src/github.com/hyperhq/hypercli /go/src/github.com/docker/docker
ln -s /go/src/github.com/hyperhq/hypercli/hyper/hyper /usr/bin/hyper
echo alias hypercli=\"hyper --region \${DOCKER_HOST}\" >> ~/.bashrc
source ~/.bashrc
echo "##############################################################################################"
echo "## Welcome to integration test ##"
echo "##############################################################################################"
#show config for hyper cli
echo "Current hyper config: ${HYPER_CONFIG}/config.json"
echo "----------------------------------------------------------------------------------------------"
cat ${HYPER_CONFIG}/config.json \
| sed 's/"secretkey":.*/"secretkey": "******************************",/g' \
| sed 's/"auth":.*/"auth": "******************************"/g'
echo "----------------------------------------------------------------------------------------------"
## send begin message to slack
COMMIT_SHORT_ID=$(git rev-parse --short HEAD)
COMMIT_ID=$(git rev-parse HEAD)
COMMIT_URL="https://github.com/hyperhq/hypercli/commit/${COMMIT_ID}"
ATT_LINK="LINK: GITHUB(<${BRANCH_URL}|${BRANCH}> - <${COMMIT_URL}|${COMMIT_SHORT_ID}>) JOB(<${JOB_URL}|${BUILD_NUMBER}>)"
ATTACHMENT="[{'text':'$ATT_LINK'}]"
MESSAGE="[BEGIN] - $TITLE"
slack.sh "$MESSAGE" "$ATTACHMENT"
TEST_HOME="/go/src/github.com/hyperhq/hypercli/integration-cli"
cd /go/src/github.com/hyperhq/hypercli/integration-cli
cat <<EOF
##########################################
DOCKER_HOST: ${DOCKER_HOST}
REGION: ${REGION}
BRANCH: ${BRANCH}
TEST_HOME: ${TEST_HOME}
TEST_CASE_REG: ${TEST_CASE_REG}
SLACK_TOKEN: ${SLACK_TOKEN:0:15}-xxxxxxxxxxx
SLACK_CHANNEL_ID: ${SLACK_CHANNEL_ID}
##########################################
EOF
echo "========================================="
env
echo "========================================="
##############################################
# start test
##############################################
## first test
LOG="test1.log"
echo "====================first test(${TEST_CASE_REG} ${TIMEOUT} ${LOG})===================="
rm -rf $LOG >/dev/null 2>&1
script -ec "go test -check.f '${TEST_CASE_REG}' -timeout ${TIMEOUT:-90m}" | tee $LOG
ls -l $LOG
echo =========================
FAIL_COUNT1=`grep "^FAIL:" ${LOG} | wc -l`
TEST_RESULT1=`grep -E "^(OK:|OOPS:)" ${LOG}`
DURATION1=`grep -P "\tgithub.com/hyperhq/hypercli/integration-cli\t" ${LOG} | awk '{print $NF}'`
echo "----------get failed test case(1st)----------"
FAILED_FILE=failed1.log
cat ${LOG} | grep "^FAIL:" > ${FAILED_FILE}
FAILED_TEST_CASE1=`cat ${FAILED_FILE} | awk -F. '{if(NR==1){CASE=$NF}else{CASE=CASE"|"$NF}}END{printf CASE}'`
echo "-----------------------------------------"
echo "FAILED_TEST_CASE1: $FAILED_TEST_CASE1"
RETEST_CASE=""
RETEST_COUNT="0"
while read LINE
do
if [ "${TARGET_REGION}" = "RegionOne" ]
then
HAS_VOL=`echo ${LINE} | grep -i Volume 2>/dev/null | wc -l`
HAS_FIP=`echo ${LINE} | grep -i Fip 2>/dev/null | wc -l`
if [ $HAS_VOL -ne 0 -o $HAS_FIP -ne 0 ]
then
echo "[SKIP FOR PKT]: ${LINE}"
continue
fi
fi
CASE_NAME=`echo ${LINE} | awk -F. '{printf $NF}'`
if [ "${RETEST_CASE}" = "" ]
then
RETEST_CASE="$CASE_NAME"
else
RETEST_CASE="${RETEST_CASE}|$CASE_NAME"
fi
RETEST_COUNT=`expr $RETEST_COUNT + 1`
done < ${FAILED_FILE}
echo "-----------------------------------------"
echo "RETEST_CASE: ${RETEST_CASE}"
echo "-----------------------------------------"
if [ $RETEST_COUNT -ne 0 ];then
## second test
LOG="test2.log"
echo "====================second test(${RETEST_CASE} ${TIMEOUT} ${LOG})===================="
rm -rf $LOG >/dev/null 2>&1
script -ec "go test -check.f '${RETEST_CASE}' -timeout ${TIMEOUT:-90m}" | tee $LOG
ls -l $LOG
echo =========================
echo "----------get failed test case(2nd)----------"
FAILED_FILE=failed2.log
cat ${LOG} | grep "^FAIL:" > ${FAILED_FILE}
FAILED_TEST_CASE2=`cat ${FAILED_FILE} | awk -F. '{if(NR==1){CASE=$NF}else{CASE=CASE"|"$NF}}END{printf CASE}'`
echo "-----------------------------------------"
echo "FAILED_TEST_CASE2: $FAILED_TEST_CASE2"
FAIL_COUNT2=`grep "^FAIL:" ${LOG} | wc -l`
TEST_RESULT2=`grep -E "^(OK:|OOPS:)" ${LOG}`
DURATION2=`grep -P "\tgithub.com/hyperhq/hypercli/integration-cli\t" ${LOG} | awk '{print $NF}'`
END_TIME=`date "+%Y/%m/%d %H:%M:%S"`
if [ $FAIL_COUNT2 -ne 0 ];then
icon=":scream:"
if [ "${TEST_RESULT1}" = "" -o "${TEST_RESULT2}" = "" ];then
icon=":exclamation:"
fi
ATTACHMENT="[{'text':'${ATT_LINK}'},{'text':'DURATION(1st): ${DURATION1}'},{'text':'TEST_RESULT(1st): ${TEST_RESULT1}'},{'text':'RE_TEST_CASE(2nd): ${RETEST_CASE}'},{'text':'DURATION(2nd): ${DURATION2}'},{'text':'TEST_RESULT(2nd): ${TEST_RESULT2}'},{'text':'FAILED_TEST_CASE(2nd): $FAILED_TEST_CASE2'}]"
else
icon=":smile:"
ATTACHMENT="[{'text':'${ATT_LINK}'},{'text':'DURATION(1st): ${DURATION1}'},{'text':'TEST_RESULT(1st): ${TEST_RESULT1}'},{'text':'RE_TEST_CASE(2nd): ${RETEST_CASE}'},{'text':'DURATION(2nd): ${DURATION2}'},{'text':'TEST_RESULT(2nd): ${TEST_RESULT2}'}]"
fi
echo "ATTACHMENT(1):${ATTACHMENT}"
MESSAGE="[END] - ${TITLE} :${icon} - ${END_TIME}"
else
END_TIME=`date "+%Y/%m/%d %H:%M:%S"`
ATTACHMENT="[{'text':'${ATT_LINK}'},{'text':'DURATION: ${DURATION1}'},{'text':'TEST_RESULT: ${TEST_RESULT1}'}]"
icon=":smile:"
if [ "${TEST_RESULT1}" = "" ];then
icon=":exclamation:"
fi
if [ $FAIL_COUNT1 -ne 0 ];then
echo "first failed, second passed"
icon=":scream:"
ATTACHMENT="[{'text':'${ATT_LINK}'},{'text':'DURATION: ${DURATION1}'},{'text':'TEST_RESULT: ${TEST_RESULT1}'},{'text':'FAILED_TEST_CASE: $FAILED_TEST_CASE1'}]"
fi
echo "ATTACHMENT(2):${ATTACHMENT}"
MESSAGE="[END] - ${TITLE} :${icon} - ${END_TIME}"
fi
cat <<EOF
--------------------------------------
FAIL_COUNT1: ${FAIL_COUNT1}
DURATION1: ${DURATION1}
TEST_RESULT1: ${TEST_RESULT1}
FAILED_TEST_CASE1: ${FAILED_TEST_CASE1}
RETEST_COUNT: ${RETEST_COUNT}
RETEST_CASE: ${RETEST_CASE}
FAIL_COUNT2: ${FAIL_COUNT2}
DURATION2: ${DURATION2}
TEST_RESULT2: ${TEST_RESULT2}
FAILED_TEST_CASE2: ${FAILED_TEST_CASE2}
--------------------------------------
MESSAGE: ${MESSAGE}
ATTACHMENT: ${ATTACHMENT}
EOF
slack.sh "${MESSAGE}" "${ATTACHMENT}"

View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
if [ "${SLACK_TOKEN}" == "" -o "${SLACK_CHANNEL_ID}" == "" ];then
echo "SLACK_TOKEN or SLACK_CHANNEL_ID is unset, skip send slack message"
exit 0
fi
NICK="HykinsBot"
EMOJI=":jenkins:"
MESSAGE="$1"
ATTACHMENT="$2"
curl -X POST \
-F token=${SLACK_TOKEN} \
-F channel=${SLACK_CHANNEL_ID} \
-F "text=${MESSAGE}" \
-F username=$NICK \
-F "attachments=${ATTACHMENT}" \
-F "icon_emoji=${EMOJI}" \
https://slack.com/api/chat.postMessage
echo
if [ $? -eq 0 ];then
echo "send slack message OK :)"
else
echo "send slack message FAILED :("
fi

View File

@@ -0,0 +1,91 @@
#!/bin/bash
set -e
if [ ! -f etc/config ];then
cp etc/config.template etc/config
echo "please config etc/config first"
exit 1
fi
. etc/config
repo="hyperhq/hypercli-auto-test"
tag="auto"
image=${repo}:${tag}
function build(){
echo "starting build..."
echo "=============================================================="
docker build --build-arg http_proxy=${http_proxy} --build-arg https_proxy=${https_proxy} -t ${image} .
}
function push(){
echo -e "\nstarting push [${image}] ..."
echo "=============================================================="
docker push ${image}
}
function run(){
CONFIG_FILE=$1
if [ "${CONFIG_FILE}" != "" ];then
if [ ! -f "${CONFIG_FILE}" ];then
echo "${CONFIG_FILE} not found"
exit 1
else
echo "use config: ${CONFIG_FILE}"
. ${CONFIG_FILE}
fi
else
echo "use default config: etc/config"
fi
docker run -it --rm \
-e http_proxy="$http_proxy" \
-e https_proxy="$https_proxy" \
-e TARGET_REGION="$TARGET_REGION" \
-e BRANCH="$BRANCH" \
-e TEST_CASE_REG="$TEST_CASE_REG" \
-e ACCESS_KEY="${ACCESS_KEY}" \
-e SECRET_KEY="${SECRET_KEY}" \
-e SLACK_TOKEN="${SLACK_TOKEN}" \
-e SLACK_CHANNEL_ID="${SLACK_CHANNEL_ID}" \
${image}
}
case "$1" in
"push")
build
push
;;
"build")
build
;;
"run")
run "$2"
;;
*)
cat <<EOF
usage:
./util.sh # show usage
./util.sh build # build only
./util.sh push # build and push
./util.sh run <config> # run docker container
example:
./util.sh run
./util.sh run etc/config
./util.sh run etc/config.zl2
./util.sh run etc/config.eu1
./util.sh run etc/config.pkt
EOF
exit 1
;;
esac
echo -e "\n=============================================================="
echo "Done!"

0
vendor/github.com/hyperhq/hypercli/integration-cli/hyper_api_stats_test.go generated vendored Normal file → Executable file
View File

0
vendor/github.com/hyperhq/hypercli/integration-cli/hyper_cli_config_test.go generated vendored Executable file → Normal file
View File

0
vendor/github.com/hyperhq/hypercli/integration-cli/hyper_cli_links_test.go generated vendored Executable file → Normal file
View File

0
vendor/github.com/hyperhq/hypercli/integration-cli/hyper_cli_load_local_test.go generated vendored Executable file → Normal file
View File

0
vendor/github.com/hyperhq/hypercli/integration-cli/hyper_cli_login_test.go generated vendored Executable file → Normal file
View File

0
vendor/github.com/hyperhq/hypercli/integration-cli/hyper_cli_run_test.go generated vendored Executable file → Normal file
View File

0
vendor/github.com/hyperhq/hypercli/integration-cli/hyper_cli_run_unix_test.go generated vendored Executable file → Normal file
View File