Skip to content
Snippets Groups Projects
Commit 25ec1587 authored by Diego Giovane Pasqualin's avatar Diego Giovane Pasqualin
Browse files

Merge branch 'issue/13' into 'development'

Issue #13: implement initial end-to-end tests



See merge request !12
parents 31f73bd2 be28b077
No related branches found
No related tags found
2 merge requests!51Merge development to master,!12Issue #13: implement initial end-to-end tests
Pipeline #
...@@ -7,27 +7,32 @@ compile: ...@@ -7,27 +7,32 @@ compile:
artifacts: artifacts:
paths: paths:
- bin/ - bin/
- build/
tags: tags:
- build - regular
- debian - debian
script: script:
- echo "Estágio 'build'" - echo "Estágio 'build'"
- apt-get update && apt-get install -y build-essential && apt-get install -y cmake - apt-get update && apt-get install -y build-essential cmake git
- apt-get install -y git
- git submodule init - git submodule init
- git submodule update --init --recursive - git submodule update --init --recursive
- mkdir build - mkdir build
- cd build - cd build
- cmake .. - cmake -DPRINT_JSON=ON ..
- make - make
testDebian: testDebian:
stage: test stage: test
tags: tags:
- build - regular
- debian - debian
script: script:
- echo "It works debian:8" - apt-get update && apt-get install -y git jq
- git clone https://github.com/sstephenson/bats.git
- cd bats
- ./install.sh /usr
- cd ../test
- ./returnTest.bats
dependencies: dependencies:
- compile - compile
...@@ -35,7 +40,22 @@ testUbuntu: ...@@ -35,7 +40,22 @@ testUbuntu:
stage: test stage: test
tags: tags:
- ubuntu - ubuntu
- regular
script: script:
- echo "It works Ubuntu:16.04" - apt-get update && apt-get install -y bats jq
- cd test
- ./returnTest.bats
dependencies:
- compile
testOpensuse:
stage: test
tags:
- opensuse
script:
- zypper -n update
- zypper -n install bats && zypper -n install jq
- cd test
- ./returnTest.bats
dependencies: dependencies:
- compile - compile
#!/usr/bin/env bats
function amount_users() {
obj=$(cat export.json | jq -r '.data.amount_users')
[[ "$obj" -eq "$obj" ]] && [[ "$obj" != "null" ]]
}
function mac_address() {
obj=$(cat export.json | jq -r '.data.mac_address')
[[ "$obj" =~ ^(..:){5}..$ ]] && [[ "$obj" != "null" ]]
}
function machine_type() {
obj=$(cat export.json | jq -r '.data.machine_type')
[[ "$obj" != "null" ]]
}
function memory() {
obj=$(cat export.json | jq -r '.data.memory')
[[ "$obj" -eq "$obj" ]] && [[ "$obj" != "null" ]]
}
function os_distro() {
obj=$(cat export.json | jq -r '.data.os_distro')
[[ "$obj" != "null" ]]
}
function os_kernel() {
obj=$(cat export.json | jq -r '.data.os_kernel')
[[ "$obj" != "null" ]]
}
function os_type() {
obj=$(cat export.json | jq -r '.data.os_type')
[[ "$obj" != "null" ]]
}
function processor() {
obj=$(cat export.json | jq -r '.data.processor')
[[ "$obj" != "null" ]]
}
setup() {
./../bin/agent-v0.0 | head -n -2 > export.json
[ -s export.json ]
cat export.json
}
teardown() {
rm -f export.json
}
@test "Amount Users" {
run amount_users
[ "$status" -eq 0 ]
}
@test "MAC" {
run mac_address
[ "$status" -eq 0 ]
}
@test "Machine Type" {
run machine_type
[ "$status" -eq 0 ]
}
@test "Memory" {
skip
run memory
[ "$status" -eq 0 ]
}
@test "OS Distro" {
run os_distro
[ "$status" -eq 0 ]
}
@test "OS Kernel" {
run os_kernel
[ "$status" -eq 0 ]
}
@test "OS Type" {
run os_type
[ "$status" -eq 0 ]
}
@test "Processor" {
skip
run processor
[ "$status" -eq 0 ]
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment