Compare commits

..

3 Commits

Author SHA1 Message Date
Brendan LE GLAUNEC d98d78cd73 v1.1.3 : Travis functional testing & minor changes 2016-11-23 08:49:19 +01:00
Brendan LE GLAUNEC e9ffb44b45 v1.1.2 : Travis build test integration & changes to docker deployment 2016-11-23 08:31:35 +01:00
Brendan LE GLAUNEC 9f85415d89 Added docker pulls badge to README.md 2016-11-14 13:40:54 +01:00
27 changed files with 261 additions and 181 deletions
+5 -1
View File
@@ -40,4 +40,8 @@ build/
# Deps
deps/boost/
deps/jsoncpp/
mysql-connector/
mysql-connector/
# Test
test/cameradartest.conf.json
test/cameradar_*_Debug_Linux.tar.gz
+58
View File
@@ -0,0 +1,58 @@
language: generic
sudo: required
dist: trusty
before_install:
- echo "Testing Docker Hub credentials"
- docker login -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD
- echo "Docker Hub credentials are working"
- sudo apt-get update -qq
- sudo apt-get install -y software-properties-common
- sudo add-apt-repository -y ppa:mc3man/trusty-media
- sudo add-apt-repository -y ppa:george-edison55/cmake-3.x
- sudo apt-get update -qq
- sudo apt-get install -y nmap
- sudo apt-get install -y ffmpeg
- sudo apt-get install -y cmake
- sudo apt-get install -y libboost-all-dev
- sudo apt-get install -y libgstreamer1.0-dev
- sudo apt-get install -y gstreamer1.0-plugins-base
- sudo apt-get install -y gstreamer1.0-plugins-good
- sudo apt-get install -y libcurl4-openssl-dev
- sudo apt-get install -y libmysqlclient18
- sudo apt-get install -y mysql-client
install:
- export DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- export PACKAGE_NAME="cameradar_*_Debug_Linux"
matrix:
include:
- os: linux
env: TEST_TYPE='BUILD' WORKDIR='deployment' COMPILER_NAME=gcc CXX=g++-5 CC=gcc-5 CMAKE_CXX_COMPILER=g++-5
addons:
apt:
packages:
- g++-5
sources: &sources
- ubuntu-toolchain-r-test
- os: linux
env: TEST_TYPE='TEST' WORKDIR='test' COMPILER_NAME=gcc CXX=g++-5 CC=gcc-5 CMAKE_CXX_COMPILER=g++-5
addons:
apt:
packages:
- g++-5
sources: &sources
- ubuntu-toolchain-r-test
script:
- cd ${WORKDIR}
- ./build_last_package.sh Debug
- tar xvf ${PACKAGE_NAME}.tar.gz
- find ${DEPS_DIR} -name "*.so*" -exec cp {} ${PACKAGE_NAME}/libraries \;
- tar -czvf ${PACKAGE_NAME}.tar.gz ${PACKAGE_NAME}
- if [[ "$TEST_TYPE" == "BUILD" ]]; then docker build -t cameradar . && docker run -v /tmp/thumbs:/tmp/thumbs cameradar; else ./test.sh ; fi
after_success:
- echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)"
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then echo -e "Push Container to Docker Hub" && docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD && docker tag cameradar $DOCKER_REPO:latest && docker push $DOCKER_REPO; fi
+26
View File
@@ -2,6 +2,32 @@
This file lists all versions of the repository and precises all changes.
## v1.1.3
#### Minor changes :
* Added automatic pushes to DockerHub to the travis integration
* Made travis configuration file better
* Changed the package generation scripts to make them report errors
* Removed old etix_rtsp_server binary from the test folder
#### Bugfixes :
* Fixed an issue that made it mandatory to launch tests at least once so that they can work the second time
* Fixed an issue that made the golang testing tool not compile in the testing script
* Fixed an issue that made the golang testing tool sometimes ignore some tests
* The previous known issue has been investigated and we don't know where it came from. However after a night of testing I have been unable to reproduce it, so I will consider it closed
## v1.1.2
#### Minor changes :
* Added travis integration
* Added default environment value for Docker deployment
* Updated docker image description with new easy usage
* Updated README badges style (replaced flat with square-flat)
* Build last package can now also generate a debug package if given the `Debug` command-line argument
#### Known issues :
* There is still the issue with Camera Emulation Server, see the [previous version's patchnote](#v1.1.1) for more information.
## v1.1.1
#### Minor changes :
+1 -2
View File
@@ -21,7 +21,7 @@ project (${PROJECT_NAME})
set (${PROJECT_NAME}_VERSION_MAJOR 1)
set (${PROJECT_NAME}_VERSION_MINOR 1)
set (${PROJECT_NAME}_VERSION_PATCH 1)
set (${PROJECT_NAME}_VERSION_PATCH 3)
set (${PROJECT_NAME}_VERSION "${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH}${${PROJECT_NAME}_SUFFIX}")
find_package(Git REQUIRED)
@@ -102,7 +102,6 @@ set (${CAMERADAR_LIBRARIES} "")
# Build cache managers
add_subdirectory (deps)
message ("Debug")
add_subdirectory (cameradar_standalone)
add_subdirectory (cache_managers)
+6 -6
View File
@@ -2,8 +2,10 @@
## An RTSP surveillance camera access multitool
[![cameradar License](https://img.shields.io/badge/license-Apache-blue.svg)](#license)
[![Latest release](https://img.shields.io/badge/release-1.1.1-green.svg)](https://github.com/EtixLabs/cameradar/releases/latest)
[![cameradar License](https://img.shields.io/badge/license-Apache-blue.svg?style=flat-square)](#license)
[![Docker Pulls](https://img.shields.io/docker/pulls/ullaakut/cameradar.svg?style=flat-square)](https://hub.docker.com/r/ullaakut/cameradar/)
[![Build](https://img.shields.io/travis/EtixLabs/cameradar/master.svg?style=flat-square)](https://travis-ci.org/EtixLabs/cameradar)
[![Latest release](https://img.shields.io/badge/release-1.1.3-green.svg?style=flat-square)](https://github.com/EtixLabs/cameradar/releases/latest)
#### Cameradar allows you to:
@@ -53,17 +55,15 @@ Run
```
docker run \
-v /tmp/thumbs/:/tmp/thumbs \
-e CACHE_MANAGER=your_manager \
-e CAMERAS_PORTS=your_ports \
-e CAMERAS_SUBNETWORKS=your_subnetwork \
ullaakut/cameradar:tag
```
* `your_subnetwork` can be a subnet (e.g.: `172.16.100.0/24`) or even an IP (e.g.: `172.16.100.10`).
* `your_ports` can be one port, multiple ports and even port ranges (e.g.: `554,8554,9000-9554`)
* `your_manager` can be either `dumb` or `mysql` but you probably want to use `dumb`. Check [Cameradar's readme on the Docker Hub](https://hub.docker.com/r/ullaakut/cameradar/) for more information.
* `tag` allows you to specify a specific version for camerada. If you don't specify any tag, you will use the latest version by default (recommended)
Check [Cameradar's readme on the Docker Hub](https://hub.docker.com/r/ullaakut/cameradar/) for more information and more command-line options.
The generated thumbnails will be in `/tmp/thumbs` on both your machine and the `cameradar` container.
For more complex use of the Docker image, see the `Environment variables` part of [Cameradar's readme on the Docker Hub](https://hub.docker.com/r/ullaakut/cameradar/).
+1
View File
@@ -25,6 +25,7 @@ size_t
write_data(void* buffer, size_t size, size_t nmemb, void* userp) {
// I'm sorry for this
// Forget you ever saw it
(void)userp;
if (not buffer || not size || not nmemb) return 0;
return size * nmemb;
+1 -2
View File
@@ -88,14 +88,13 @@ check_storage_path(const std::string& thumbnail_storage_path) {
int
main(int argc, char* argv[]) {
etix::tool::logger::get_instance("cameradar");
etix::tool::logger::get_instance("cameradar").set_level(etix::tool::loglevel::DEBUG);
auto args = parse_cmdline(argc, argv);
if (not args.first) return EXIT_FAILURE;
print_version();
if (not args.second.exist("-l")) {
etix::tool::logger::get_instance("cameradar").set_level(etix::tool::loglevel::DEBUG);
LOG_INFO_("No log level set, using log level 1", "main");
} else {
try {
+1 -2
View File
@@ -42,7 +42,6 @@ set (JSONCPP_INCLUDE_DIR "${SOURCE_DIR}/include" PARENT_SCOPE)
set (JSONCPP_LIBRARY_DIR "${SOURCE_DIR}/src/lib_json")
set (JSONCPP_LIBRARY_DIR ${JSONCPP_LIBRARY_DIR} PARENT_SCOPE)
file(GLOB JSONCPP_INSTALL_DEPENDENCIES "${JSONCPP_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}jsoncpp*${CMAKE_SHARED_LIBRARY_SUFFIX}*")
file(GLOB JSONCPP_INSTALL_DEPENDENCIES "${JSONCPP_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}jsoncpp${CMAKE_SHARED_LIBRARY_SUFFIX}*")
list (APPEND CAMERADAR_INSTALL_DEPENDENCIES ${JSONCPP_INSTALL_DEPENDENCIES})
set(CAMERADAR_INSTALL_DEPENDENCIES ${CAMERADAR_INSTALL_DEPENDENCIES} PARENT_SCOPE)
+2 -3
View File
@@ -44,8 +44,7 @@ set (MYSQL_CONNECTOR_LIBRARY_DIR "${MYSQL_CONNECTOR_PATH}/lib")
set (MYSQL_CONNECTOR_LIBRARY_DIR ${MYSQL_CONNECTOR_LIBRARY_DIR} PARENT_SCOPE)
# list all the hiredis libraries
file(GLOB MYSQL_CONNECTOR_INSTALL_DEPENDENCIES "${MYSQL_CONNECTOR_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}mysqlcppconn*${CMAKE_SHARED_LIBRARY_SUFFIX}*")
# list all the mysql libraries
file(GLOB MYSQL_CONNECTOR_INSTALL_DEPENDENCIES "${MYSQL_CONNECTOR_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}mysqlcppconn${CMAKE_SHARED_LIBRARY_SUFFIX}*")
list (APPEND CAMERADAR_INSTALL_DEPENDENCIES ${MYSQL_CONNECTOR_INSTALL_DEPENDENCIES})
set(CAMERADAR_INSTALL_DEPENDENCIES ${CAMERADAR_INSTALL_DEPENDENCIES} PARENT_SCOPE)
+42 -14
View File
@@ -5,23 +5,51 @@ COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"31;01m"
COL_GREEN=$ESC_SEQ"32;01m"
COL_YELLOW=$ESC_SEQ"33;01m"
COL_BLUE=$ESC_SEQ"34;01m"
COL_MAGENTA=$ESC_SEQ"35;01m"
COL_CYAN=$ESC_SEQ"36;01m"
echo -e $COL_YELLOW"Deleting old package ... "$COL_RESET
rm -f cameradar_*_Release_Linux.tar.gz
rm -f cameradar_*_${1:-"Release"}_Linux.tar.gz
echo -e $COL_GREEN"OK!"$COL_RESET
echo -e $COL_YELLOW"Creating package ... "$COL_RESET
{
cd ..
mkdir build
cd build
rm -f cameradar_*_Release_Linux.tar.gz
cmake .. -DCMAKE_BUILD_TYPE=Release
make package
cp cameradar_*_Release_Linux.tar.gz ../deployment
cd ../deployment
} &> /dev/null
cd ..
ret=$?
if [ "$ret" -ne "0" ]; then
echo -e $COL_RED"KO!"$COL_RESET;
exit 1;
fi
mkdir build
cd build
ret=$?
if [ "$ret" -ne "0" ]; then
echo -e $COL_RED"KO!"$COL_RESET;
exit 1;
fi
rm -f cameradar_*_${1:-"Release"}_Linux.tar.gz
cmake .. -DCMAKE_BUILD_TYPE=${1:-"Release"}
ret=$?
if [ "$ret" -ne "0" ]; then
echo -e $COL_RED"KO!"$COL_RESET;
exit 1;
fi
make package
ret=$?
if [ "$ret" -ne "0" ]; then
echo -e $COL_RED"KO!"$COL_RESET;
exit 1;
fi
cp cameradar_*_${1:-"Release"}_Linux.tar.gz ../deployment
cd ../deployment
ret=$?
if [ "$ret" -ne "0" ]; then
echo -e $COL_RED"KO!"$COL_RESET;
exit 1;
fi
echo -e $COL_GREEN"OK!"$COL_RESET
Binary file not shown.
Binary file not shown.
+13
View File
@@ -21,8 +21,21 @@ for arg; do
esac
done
if [ "$CACHE_MANAGER" == "" ]; then
export CACHE_MANAGER="dumb"
fi
if [ "$CAMERAS_SUBNETWORKS" == "" ]; then
export CAMERAS_SUBNETWORKS="0.0.0.0"
fi
if [ "$CAMERAS_PORTS" == "" ]; then
export CAMERAS_PORTS="554,8554"
fi
envsubst < /cameradar/conf/cameradar.tmpl.conf.json > /cameradar/conf/cameradar.conf.json
if [ "$CACHE_MANAGER" == "mysql" ] && [ "$1" = '/cameradar/bin/cameradar' -a -z "$wantHelp" ]; then
echo -n "Waiting for cameradar-database to be ready..."
while ! mysqladmin ping -h "cameradar-database" -P3306 --silent; do
+42 -14
View File
@@ -5,23 +5,51 @@ COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"31;01m"
COL_GREEN=$ESC_SEQ"32;01m"
COL_YELLOW=$ESC_SEQ"33;01m"
COL_BLUE=$ESC_SEQ"34;01m"
COL_MAGENTA=$ESC_SEQ"35;01m"
COL_CYAN=$ESC_SEQ"36;01m"
echo -e $COL_YELLOW"Deleting old package ... "$COL_RESET
rm -f cameradar_*_Debug_Linux.tar.gz
rm -f cameradar_*_${1:-"Release"}_Linux.tar.gz
echo -e $COL_GREEN"OK!"$COL_RESET
echo -e $COL_YELLOW"Creating package ... "$COL_RESET
{
cd ..
mkdir build
cd build
rm -f cameradar_*_Debug_Linux.tar.gz
cmake .. -DCMAKE_BUILD_TYPE=Debug
make package
cp cameradar_*_Debug_Linux.tar.gz ../test
cd ../test
} &> /dev/null
cd ..
ret=$?
if [ "$ret" -ne "0" ]; then
echo -e $COL_RED"KO!"$COL_RESET;
exit 1;
fi
mkdir build
cd build
ret=$?
if [ "$ret" -ne "0" ]; then
echo -e $COL_RED"KO!"$COL_RESET;
exit 1;
fi
rm -f cameradar_*_${1:-"Release"}_Linux.tar.gz
cmake .. -DCMAKE_BUILD_TYPE=${1:-"Release"}
ret=$?
if [ "$ret" -ne "0" ]; then
echo -e $COL_RED"KO!"$COL_RESET;
exit 1;
fi
make package
ret=$?
if [ "$ret" -ne "0" ]; then
echo -e $COL_RED"KO!"$COL_RESET;
exit 1;
fi
cp cameradar_*_${1:-"Release"}_Linux.tar.gz ../test
cd ../test
ret=$?
if [ "$ret" -ne "0" ]; then
echo -e $COL_RED"KO!"$COL_RESET;
exit 1;
fi
echo -e $COL_GREEN"OK!"$COL_RESET
Binary file not shown.
+6
View File
@@ -14,6 +14,12 @@ cp /tmp/tests/*.xml ./
# run test
./cameradartest /tmp/tests/cameradartest.conf.json
ret=$?
echo "Tests exited with code ${ret}"
cat *.xml
cp *.xml /tmp/tests/
exit $ret
+6 -1
View File
@@ -13,5 +13,10 @@ else
url="rtsp://$user:$passw@:$port/$route"
fi
./camera_emulation_server -u $2 -p $3 -r $4
if [ "$2" == "" && "$3" == "" ]; then
./camera_emulation_server -r $4
else
./camera_emulation_server -u $2 -p $3 -r $4
fi
echo "Stream started on ${url}"
Binary file not shown.
+1 -1
View File
@@ -43,7 +43,7 @@ func (t *Tester) dropDB() bool {
if err != nil {
fmt.Println(err)
}
fmt.Println("------ Dropped CCTV Database -------")
fmt.Println("------ Dropped Cameradar Database -------")
return true
}
-24
View File
@@ -1,24 +0,0 @@
package main
import (
"database/sql"
_ "github.com/go-sql-driver/mysql"
"fmt"
"strconv"
)
func (m *manager) dropDB() bool {
dsn := m.DB.User + ":" + m.DB.Password + "@" + "tcp(" + m.DB.Host + ":" + strconv.Itoa(m.DB.Port) + ")/" + m.DB.Db_name + "?charset=utf8"
db, err := sql.Open("mysql", dsn)
if err != nil {
fmt.Println(err)
}
defer db.Close()
q := "DROP DATABASE cctv;"
_, err = db.Exec(q)
if err != nil {
fmt.Println(err)
}
fmt.Println("------ Dropped CCTV Database -------")
return true
}
-24
View File
@@ -1,24 +0,0 @@
package main
import (
"encoding/json"
"fmt"
"os"
)
// Launch it via goroutine
// Start read log of service
func getResult(test *[]Result, resultPath string) bool {
// Load config
resultFile, err := os.Open(resultPath)
if err != nil {
fmt.Printf("\nCan't open result file: %s\n", err)
return false
}
dec := json.NewDecoder(resultFile)
if err = dec.Decode(&test); err != nil {
fmt.Printf("\nUnable to deserialize result file: %s\n", err)
return false
}
return true
}
+3 -1
View File
@@ -16,6 +16,7 @@ package main
import (
"fmt"
"os"
)
func main() {
@@ -38,7 +39,8 @@ func main() {
fmt.Println("--- Writing results... ---")
if !Tester.WriteResults(*(Tester.Result), Tester.Output) {
fmt.Println("-> Write results FAILED")
return
os.Exit(1)
}
fmt.Println("--- Writing results done ---")
os.Exit(0)
}
-55
View File
@@ -1,55 +0,0 @@
package main
import (
"fmt"
"sync"
)
type manager struct {
Config
Tests []Result
Result *TestCase
DB mysql_db
}
// Config needs refacto
type Config struct {
Cameradar Service `json:"Cameradar"`
Output string
}
func (m *manager) Init() bool {
fmt.Println("- Parsing")
if !m.parseConfig() {
return false
}
fmt.Println("- Cleaning content")
killService(&m.Config.Cameradar)
return true
}
func (m *manager) Run() bool {
var wg sync.WaitGroup
fmt.Println("\n- Launching all tests")
var newTest = new(TestCase)
newTest.expected = m.Tests
if m.generateConfig(m.Tests, &m.DB) {
m.dropDB()
wg.Add(1)
go m.invokeTestCase(newTest, &wg)
m.Result = newTest
}
wg.Wait()
fmt.Printf("All tests completed\n")
return true
}
func (m *manager) Stop() bool {
killService(&m.Config.Cameradar)
return true
}
+1 -1
View File
@@ -55,7 +55,7 @@ func getResult(test *[]Result, resultPath string) bool {
return true
}
func isValid(e Result, r Result) bool {
func isValid(e *Result, r Result) bool {
if e.Username != r.Username {
e.err = errors.New(e.Address + " had a different username than " + r.Username)
return false
+15 -8
View File
@@ -28,6 +28,13 @@ type Test struct {
time time.Duration
}
func removeResult(expected []Result, index int) []Result {
if len(expected) > 1 {
return append(expected[:index], expected[index+1:]...)
}
return []Result{}
}
// Invoke the test
// Wrap results in a TestResult object
func (t *Tester) invokeTestCase(testCase *Test, wg *sync.WaitGroup) {
@@ -55,14 +62,12 @@ func (t *Tester) runTestCase(test *Test) {
for _, r := range test.result {
r.Valid = true
for index, e := range test.expected {
if e.Address == r.Address && isValid(e, r) {
if e.Address == r.Address && isValid(&e, r) {
// _, err := os.Stat(r.Thumb)
// if err == nil) {
fmt.Println("The result of ", r.Address, " is valid and the thumbnails were generated by Cameradar.")
validResults = Extend(validResults, r)
if len(test.expected) > 1 {
test.expected = append(test.expected[:index], test.expected[index+1:]...)
}
test.expected = removeResult(test.expected, index)
break
// } else {
// e.err = error{"The result of " + e.Address + " seemed valid, but the thumbnails could not be generated by Cameradar : " + err.Error()}
@@ -70,15 +75,17 @@ func (t *Tester) runTestCase(test *Test) {
}
}
}
for index, e := range test.expected {
// This is in order to avoid checking the same values twice
copy := test.expected
for index, e := range copy {
if !e.Valid {
fmt.Println("The result of", e.Address, "successfully failed.")
validResults = Extend(validResults, e)
if len(test.expected) > 1 {
test.expected = append(test.expected[:index], test.expected[index+1:]...)
}
test.expected = removeResult(test.expected, index)
} else {
e.err = errors.New("The camera with the address " + e.Address + " was not found by cameradar")
test.expected = removeResult(test.expected, index)
test.expected = Extend(test.expected, e)
fmt.Println("Should have been valid but was not found : ", e.Address)
}
}
+25 -20
View File
@@ -17,6 +17,7 @@ package main
import (
"bytes"
"encoding/xml"
"errors"
"fmt"
"io"
"io/ioutil"
@@ -60,9 +61,6 @@ type JUnitFailure struct {
// WriteResults will output the results in the standard output as well as concatenate them in an XML JUnit report
func (t *Tester) WriteResults(result Test, output string) bool {
fmt.Printf("Displaying results...\n")
t.writeConsoleReport(result)
file, err := os.OpenFile(output, os.O_RDONLY|os.O_CREATE, 0644)
if err != nil {
fmt.Printf("Error opening XML: %s\n", err)
@@ -72,7 +70,7 @@ func (t *Tester) WriteResults(result Test, output string) bool {
err = t.writeJUnitReportXML(result, file, output)
if err != nil {
fmt.Printf("Error writing XML: %s\n", err)
fmt.Printf("The tests were unsuccessful: %s\n", err)
return false
}
fmt.Printf("-> JUnit XML report written: %s\n", output)
@@ -93,7 +91,7 @@ func (t *Tester) writeJUnitReportXML(result Test, rw io.ReadWriter, output strin
ts := JUnitTestSuite{
Tests: len(result.result) + len(result.expected),
Failures: 0,
Failures: len(result.expected),
Time: fmt.Sprintf("%.6f", result.time.Seconds()),
TestCases: []JUnitTestCase{},
}
@@ -103,7 +101,7 @@ func (t *Tester) writeJUnitReportXML(result Test, rw io.ReadWriter, output strin
Time: fmt.Sprintf("%.6f", result.time.Seconds()),
Failure: nil,
}
testCase.Message = "The stream " + r.Address + " could be accessed and its thumbnail was properly generated"
testCase.Message = "The stream " + r.Address + " had the expected result"
ts.TestCases = append(ts.TestCases, testCase)
}
@@ -118,6 +116,24 @@ func (t *Tester) writeJUnitReportXML(result Test, rw io.ReadWriter, output strin
Type: "",
}
}
ts.TestCases = append(ts.TestCases, testCase)
}
successCount := 0
failureCount := 0
for _, test := range ts.TestCases {
if test.Failure != nil {
failureCount++
} else {
successCount++
}
}
fmt.Println("--- Test summary ---")
if successCount > 0 {
fmt.Printf("Results: %d/%d (%d%%)\n", successCount, successCount+failureCount, successCount*100/(successCount+failureCount))
fmt.Printf("Time: %.6fs\n", result.time.Seconds())
} else {
fmt.Printf("No test in success\n")
}
suites.TestSuites = append(suites.TestSuites, ts)
@@ -134,19 +150,8 @@ func (t *Tester) writeJUnitReportXML(result Test, rw io.ReadWriter, output strin
}
writer := io.Writer(w)
writer.Write(bytes)
if failureCount > 0 {
return errors.New("Some cameras were not successfully accessed.")
}
return nil
}
func (t *Tester) writeConsoleReport(result Test) bool {
successCount := len(result.result)
failureCount := len(result.expected)
fmt.Println("--- Test summary ---")
if successCount > 0 {
fmt.Printf("Results: %d/%d (%d%%)\n", successCount, successCount+failureCount, successCount*100/(successCount+failureCount))
fmt.Printf("Time: %.6fs\n", result.time.Seconds())
} else {
fmt.Printf("No test in success\n")
}
return true
}
+6 -2
View File
@@ -32,9 +32,11 @@ function make_docker_command {
function start_test {
./docker/gen_cameras.sh start $1 ./docker/cameratest.conf.tmpl.json
eval $cmd
make_docker_command $1
eval $cmd
ret=$?
./docker/gen_cameras.sh stop
return $ret
}
# build images
@@ -50,9 +52,11 @@ echo "starting mysql"
docker pull mysql:5.7
docker run --name cameradar-database -e MYSQL_DATABASE=cmrdr -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7
start_test 1
start_test 5
ret=$?
echo "Tests returned ${ret}"
# stop mysql
echo "stopping mysql"
docker rm -f cameradar-database
exit $ret