Skip to content
This repository has been archived by the owner on May 30, 2020. It is now read-only.

Commit

Permalink
setup travis.
Browse files Browse the repository at this point in the history
  • Loading branch information
zongzw committed Feb 13, 2020
1 parent dc94c7b commit 0bb982a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 6 deletions.
14 changes: 8 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,25 @@ services:
- docker

env:
- DOCKER_COMPOSE_VERSION=1.25.2
- DOCKER_COMPOSE_VERSION=v1.25.2

before_install:
- sudo rm /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
- sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose


install:
install: # install from requirements.txt

script:
# clone
# run start-all.sh

- ./scripts/start-all.sh
- docker ps
- set -ex
- for n in `ls test/travis/*.py`; do python $n; done
- set +x

test:
# docker exec CTRLBOX python /root/workdir/test/send-to-fluentd/20001-fake-1-logging.py


Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requests==2.22.0
16 changes: 16 additions & 0 deletions test/travis/01.kibana-01-curl-ready.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import requests
import sys

kibana_uri = 'http://localhost:5601/app/kibana'

try:
resp = requests.get(kibana_uri)
except Exception as e:
print("Failed to get %s: %s" % (kibana_uri, e.message))
sys.exit(1)
else:
if resp.status_code == 200:
sys.exit(0)
else:
print("kibana response with: %s" % resp.reason)
sys.exit(1)
23 changes: 23 additions & 0 deletions test/travis/01.kibana-02-dashboards-imported.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import requests
import sys
import json

kibana_uri = 'http://localhost:5601/api/saved_objects/_find?type=dashboard&fields=id&fields=title'

try:
resp = requests.get(kibana_uri)
except Exception as e:
print("Failed to get %s: %s" % (kibana_uri, e.message))
sys.exit(1)
else:
if resp.status_code == 200:
jd = resp.json()
if (jd['total'] != 0):
print("total dashboards: %d" % jd['total'])
sys.exit(0)
else:
print("kibana response with 0 dashboards: %s" % json.dumps(jd))
sys.exit(1)
else:
print("kibana response with: %s" % resp.reason)
sys.exit(1)

0 comments on commit 0bb982a

Please sign in to comment.