This commit is contained in:
Thomas Sileo 2019-04-12 21:39:21 +02:00
parent db52b26999
commit 3d74c5ff7e
4 changed files with 18 additions and 11 deletions

View file

@ -1,9 +1,10 @@
--- ---
priviliged: true priviliged: true # Needed for Docker in Docker
kind: pipeline kind: pipeline
name: default name: default
steps: steps:
- name: test # Run Mypy/Flake8/black linters before any further work is done
- name: lint
image: python:3 image: python:3
commands: commands:
- pip install -U pip - pip install -U pip
@ -12,7 +13,8 @@ steps:
- flake8 activitypub.py - flake8 activitypub.py
- mypy --ignore-missing-imports . - mypy --ignore-missing-imports .
- name: build # Build the container images we need for the test suite
- name: build_containers
image: docker:dind image: docker:dind
environment: environment:
DOCKER_HOST: tcp://docker:2375 DOCKER_HOST: tcp://docker:2375
@ -23,7 +25,8 @@ steps:
- docker pull mongo - docker pull mongo
- docker build . -t microblogpub:latest - docker build . -t microblogpub:latest
- name: poussetaches # Run poussetaches (will be shared by the two microblog.pub instances) "in the background"
- name: run_poussetaches
image: docker:dind image: docker:dind
detach: true detach: true
environment: environment:
@ -32,7 +35,8 @@ steps:
commands: commands:
- docker run -p 7991:7991 --net fede -e POUSSETACHES_AUTH_KEY --name poussetaches poussetaches - docker run -p 7991:7991 --net fede -e POUSSETACHES_AUTH_KEY --name poussetaches poussetaches
- name: mongo # Run MongoDB (will be shared by the two microblog.pub instances) "in the background"
- name: run_mongodb
image: docker:dind image: docker:dind
detach: true detach: true
environment: environment:
@ -40,6 +44,7 @@ steps:
commands: commands:
- docker run -p 27017:27017 --net fede --name mongo mongo - docker run -p 27017:27017 --net fede --name mongo mongo
# Run a first microblog.pub instance "in the background"
- name: microblogpub_instance1 - name: microblogpub_instance1
image: docker:dind image: docker:dind
detach: true detach: true
@ -54,6 +59,7 @@ steps:
- sleep 5 - sleep 5
- 'docker run -p 5006:5005 --net fede -v "`pwd`/tests/fixtures/instance1/config:/app/config" -e MICROBLOGPUB_DEBUG -e MICROBLOGPUB_INTERNAL_HOST -e MICROBLOGPUB_MONGODB_HOST -e MICROBLOGPUB_POUSSETACHES_HOST -e POUSSETACHES_AUTH_KEY --name instance1_web microblogpub' - 'docker run -p 5006:5005 --net fede -v "`pwd`/tests/fixtures/instance1/config:/app/config" -e MICROBLOGPUB_DEBUG -e MICROBLOGPUB_INTERNAL_HOST -e MICROBLOGPUB_MONGODB_HOST -e MICROBLOGPUB_POUSSETACHES_HOST -e POUSSETACHES_AUTH_KEY --name instance1_web microblogpub'
# Run the second microblog.pub instance "in the background"
- name: microblogpub_instance2 - name: microblogpub_instance2
image: docker:dind image: docker:dind
detach: true detach: true
@ -67,8 +73,8 @@ steps:
commands: commands:
- 'docker run -p 5007:5005 --net fede -v "`pwd`/tests/fixtures/instance2/config:/app/config" -e MICROBLOGPUB_DEBUG -e MICROBLOGPUB_INTERNAL_HOST -e MICROBLOGPUB_MONGODB_HOST -e MICROBLOGPUB_POUSSETACHES_HOST -e POUSSETACHES_AUTH_KEY --name instance2_web microblogpub' - 'docker run -p 5007:5005 --net fede -v "`pwd`/tests/fixtures/instance2/config:/app/config" -e MICROBLOGPUB_DEBUG -e MICROBLOGPUB_INTERNAL_HOST -e MICROBLOGPUB_MONGODB_HOST -e MICROBLOGPUB_POUSSETACHES_HOST -e POUSSETACHES_AUTH_KEY --name instance2_web microblogpub'
# Run some tests against the two instances to ensure federation is working
- name: integration_test - name: federation_test
image: python:3 image: python:3
commands: commands:
- pip install -U pip - pip install -U pip
@ -76,12 +82,13 @@ steps:
# Federation tests (with two local instances) # Federation tests (with two local instances)
- python -m pytest -v -s --ignore data -k federatio - python -m pytest -v -s --ignore data -k federatio
# Setup the services needed to do some "Docker in Docker" (or dind)
services: services:
- name: docker - name: docker
image: docker:dind image: docker:dind
privileged: true privileged: true
--- ---
kind: signature kind: signature
hmac: e9e0af1e17c84ff087d83fbdd00ba132327cca9365b9805486d5a295443a5bd3 hmac: a29b3d3699c86cf0fb857e3b412353230ba64544356a9b42b37c5a83e36f5170
... ...

View file

@ -19,7 +19,7 @@ class Instance(object):
def __init__(self, name, host_url, docker_url=None): def __init__(self, name, host_url, docker_url=None):
self.host_url = host_url self.host_url = host_url
self.docker_url = docker_url or host_url self.docker_url = docker_url or host_url
self._create_delay = 24 self._create_delay = 10
with open( with open(
os.path.join( os.path.join(
os.path.dirname(os.path.abspath(__file__)), os.path.dirname(os.path.abspath(__file__)),

View file

@ -1,7 +1,7 @@
username: 'instance1' username: 'instance1'
name: 'Instance 1' name: 'Instance 1'
icon_url: 'https://sos-ch-dk-2.exo.io/microblogpub/microblobpub.png' icon_url: 'https://sos-ch-dk-2.exo.io/microblogpub/microblobpub.png'
domain: 'instance1_web_1:5005' domain: 'instance1_web:5005'
summary: 'instance1 summary' summary: 'instance1 summary'
pass: '$2b$12$nEgJMgaYbXSPOvgnqM4jSeYnleKhXqsFgv/o3hg12x79uEdsR4cUy' # hello pass: '$2b$12$nEgJMgaYbXSPOvgnqM4jSeYnleKhXqsFgv/o3hg12x79uEdsR4cUy' # hello
https: false https: false

View file

@ -1,7 +1,7 @@
username: 'instance2' username: 'instance2'
name: 'Instance 2' name: 'Instance 2'
icon_url: 'https://sos-ch-dk-2.exo.io/microblogpub/microblobpub.png' icon_url: 'https://sos-ch-dk-2.exo.io/microblogpub/microblobpub.png'
domain: 'instance2_web_1:5005' domain: 'instance2_web:5005'
summary: 'instance2 summary' summary: 'instance2 summary'
pass: '$2b$12$nEgJMgaYbXSPOvgnqM4jSeYnleKhXqsFgv/o3hg12x79uEdsR4cUy' # hello pass: '$2b$12$nEgJMgaYbXSPOvgnqM4jSeYnleKhXqsFgv/o3hg12x79uEdsR4cUy' # hello
https: false https: false