summaryrefslogtreecommitdiffstats
path: root/tests.sh
diff options
context:
space:
mode:
authorMatthewLi <matthew.lijun@huawei.com>2016-09-19 07:06:14 -0400
committerMatthewLi <matthew.lijun@huawei.com>2016-09-19 07:11:08 -0400
commitee420d4dfa926b9d5d2434b746c67e9a3ea20ee8 (patch)
tree4a627cda48728674f061289ac5ea622df52a8c69 /tests.sh
parent189733bcec49792d358e944616c2dbad313205ac (diff)
add flake8 check for python files
Change-Id: I6d8e4e1d007bdcce037cf1ae93324de8080640ec Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
Diffstat (limited to 'tests.sh')
-rwxr-xr-xtests.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests.sh b/tests.sh
new file mode 100755
index 00000000..1034466e
--- /dev/null
+++ b/tests.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+##############################################################################
+# Copyright (c) 2016 Huawei Tech and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+# Run flake8, unit, coverage test
+
+getopts ":f" FILE_OPTION
+
+run_flake8() {
+ echo "Running flake8 ... "
+ logfile=test_results.log
+ if [ $FILE_OPTION == "f" ]; then
+ flake8 bottlenecks > $logfile
+ else
+ flake8 bottlenecks
+ fi
+
+ if [ $? -ne 0 ]; then
+ echo "FAILED"
+ if [ $FILE_OPTION == "f" ]; then
+ echo "Results in $logfile"
+ fi
+ exit 1
+ else
+ echo "OK"
+ fi
+}
+
+run_tests() {
+ echo "Running unittest ... "
+ #will add future
+}
+
+run_coverage() {
+ echo "Running coverage ..."
+ #source tests/ci/cover.sh
+ #run_coverage_test
+ #will add future
+}
+
+run_flake8
+run_tests
+run_coverage
ht .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
##############################################################################
# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
# matthew.lijun@huawei.com
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

#! /usr/bin/env bash

set -e

THIS_DIR=`pwd`

OPENRC_PATH=/opt/
CREATE_INSTANCE_PATH=$THIS_DIR

INSTANCE_NUM=3
NET_ID=531c4557-7349-4984-8d5e-cceebb77205f
FLAVOR_TYPE=m1.small
IMAGE_ID=7c2f3e2b-cf6e-44ed-83ac-e87712167f9e
SEC_GROUP=default
INSTANCE_NAME=example_

source $OPENRC_PATH/admin-openrc.sh
cd $CREATE_INSTANCE_PATH
for((count=1;count<=$INSTANCE_NUM;count++))
do
   INSTANCE_NAME_TMP=${INSTANCE_NAME}${count}
   nova boot --nic net-id=${NET_ID} --flavor=${FLAVOR_TYPE} --image=${IMAGE_ID} --security_group=${SEC_GROUP} ${INSTANCE_NAME_TMP}
done