Skip to content

Commit 460b9df

Browse files
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # influxdb2_test/base_test.py
2 parents 232a5b5 + b3bc371 commit 460b9df

File tree

7 files changed

+117
-14
lines changed

7 files changed

+117
-14
lines changed

.circleci/config.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
version: 2.1
2+
3+
commands:
4+
influxdb-restart:
5+
steps:
6+
- run:
7+
name: "Start InfluxDB service"
8+
command: ./scripts/influxdb-restart.sh
9+
prepare:
10+
description: "Prepare environment to tests"
11+
steps:
12+
- checkout
13+
- influxdb-restart
14+
client-test:
15+
description: "Run tests"
16+
parameters:
17+
python-version:
18+
type: string
19+
default: &default-python-version "3"
20+
steps:
21+
- restore_cache:
22+
name: Restoring Pip Cache
23+
keys:
24+
- &cache-key pip-cache-v2-<< parameters.python-version >>-{{ checksum "requirements.txt" }}-{{ checksum "test-requirements.txt" }}
25+
- pip-cache-v2-<< parameters.python-version >>-
26+
- run:
27+
name: "Running tests"
28+
command: |
29+
docker run -it --rm \
30+
--volume ${PWD}:/usr/src/project \
31+
--volume ${PWD}/.cache:/root/.cache/pip/ \
32+
--workdir /usr/src/project \
33+
--network influx_network \
34+
--env INFLUXDB_IP=192.168.0.2 \
35+
python:<< parameters.python-version >> /bin/bash -c "./scripts/ci-test.sh"
36+
- save_cache:
37+
name: Saving Pip Cache
38+
key: *cache-key
39+
paths:
40+
- ./cache
41+
when: always
42+
jobs:
43+
tests-python-3:
44+
machine: true
45+
steps:
46+
- prepare
47+
- client-test:
48+
python-version: *default-python-version
49+
- store_test_results:
50+
path: test-reports
51+
- run:
52+
name: "Collecting coverage reports"
53+
command: bash <(curl -s https://codecov.io/bash) -f ./coverage.xml || echo "Codecov did not collect coverage reports"
54+
55+
workflows:
56+
version: 2
57+
build:
58+
jobs:
59+
- tests-python-3
60+
61+
nightly:
62+
triggers:
63+
- schedule:
64+
cron: "0 0 * * *"
65+
filters:
66+
branches:
67+
only:
68+
- master
69+
jobs:
70+
- tests-python-3

.codecov.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ignore:
2+
- "influxdb2/domain/*.py"
3+
- "influxdb2/service/*.py"
4+
- "influxdb2_test/*.py"

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@
1010
### Bugs
1111
1. [#3](https://github.com/bonitoo-io/influxdb-client-python/issues/3): The management API correctly supports inheritance defined in Influx API
1212
1. [#7](https://github.com/bonitoo-io/influxdb-client-python/issues/7): Drop NaN and infinity values from fields when writing to InfluxDB
13+
14+
### CI
15+
1. [#11](https://github.com/bonitoo-io/influxdb-client-python/pull/11): Switch CI to CircleCI
16+
1. [#12](https://github.com/bonitoo-io/influxdb-client-python/pull/12): CI generate code coverage report on CircleCI

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# influxdb-client-python
22

3-
[![Build Status](https://travis-ci.org/bonitoo-io/influxdb-client-python.svg?branch=master)](https://travis-ci.org/bonitoo-io/influxdb-client-python)
3+
[![CircleCI](https://circleci.com/gh/bonitoo-io/influxdb-client-python.svg?style=svg)](https://circleci.com/gh/bonitoo-io/influxdb-client-python)
4+
[![codecov](https://codecov.io/gh/bonitoo-io/influxdb-client-python/branch/master/graph/badge.svg)](https://codecov.io/gh/bonitoo-io/influxdb-client-python)
45

56
InfluxDB 2.0 python client library. TODO...
67

influxdb2_test/test_gzip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def test_gzip_enabled(self):
129129
def test_write_query_gzip(self):
130130
httpretty.disable()
131131

132-
self.client = InfluxDBClient("http://localhost:9999/api/v2", token="my-token", org="my-org", debug=False,
132+
self.client = InfluxDBClient(self.host, token="my-token", org="my-org", debug=False,
133133
enable_gzip=True)
134134
self.api_client = self.client.api_client
135135
self.buckets_client = self.client.buckets_api()

scripts/ci-test.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
#
6+
# Install requirements
7+
#
8+
python --version
9+
pip install -r requirements.txt
10+
pip install -r test-requirements.txt
11+
pip install pytest pytest-cov
12+
13+
#
14+
# Prepare for test results
15+
#
16+
mkdir test-reports || true
17+
18+
#
19+
# Test
20+
#
21+
pytest influxdb2_test --junitxml=test-reports/junit.xml --cov=./ --cov-report xml:coverage.xml
22+

scripts/influxdb-restart.sh

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ INFLUXDB_V2_IMAGE=${DOCKER_REGISTRY}influx:${INFLUXDB_V2_VERSION}
3232

3333
SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
3434

35+
docker kill influxdb_v2 || true
36+
docker rm influxdb_v2 || true
37+
docker network rm influx_network || true
38+
docker network create -d bridge influx_network --subnet 192.168.0.0/24 --gateway 192.168.0.1
3539

3640
#
3741
# InfluxDB 2.0
@@ -40,12 +44,11 @@ echo
4044
echo "Restarting InfluxDB 2.0 [${INFLUXDB_V2_IMAGE}] ... "
4145
echo
4246

43-
docker kill my-influxdb2 || true
44-
docker rm my-influxdb2 || true
4547
docker pull ${INFLUXDB_V2_IMAGE} || true
4648
docker run \
4749
--detach \
48-
--name my-influxdb2 \
50+
--name influxdb_v2 \
51+
--network influx_network \
4952
--publish 9999:9999 \
5053
${INFLUXDB_V2_IMAGE}
5154

@@ -55,12 +58,11 @@ wget -S --spider --tries=20 --retry-connrefused --waitretry=5 http://localhost:9
5558
echo
5659
echo "Post onBoarding request, to setup initial user (my-user@my-password), org (my-org) and bucketSetup (my-bucket)"
5760
echo
58-
59-
docker exec -it my-influxdb2 influx setup --username my-user --password my-password \
60-
--token my-token --org my-org --bucket my-bucket --retention 48 --force
61-
62-
## show created orgId
63-
ORGID=`docker exec -it my-influxdb2 influx org find | grep my-org | awk '{ print $1 }'`
64-
echo "orgId="${ORGID}
65-
66-
61+
curl -i -X POST http://localhost:9999/api/v2/setup -H 'accept: application/json' \
62+
-d '{
63+
"username": "my-user",
64+
"password": "my-password",
65+
"org": "my-org",
66+
"bucket": "my-bucket",
67+
"token": "my-token"
68+
}'

0 commit comments

Comments
 (0)