]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
tests: add rgw_multisite functional test
authorGuillaume Abrioux <gabrioux@redhat.com>
Mon, 29 Oct 2018 12:30:59 +0000 (13:30 +0100)
committerSébastien Han <seb@redhat.com>
Tue, 30 Oct 2018 13:00:28 +0000 (14:00 +0100)
Add a playbook that will upload a file on the master then try to get
info from the secondary node, this way we can check if the replication
is ok.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
tests/functional/rgw_multisite.yml [new file with mode: 0644]
tox.ini

diff --git a/tests/functional/rgw_multisite.yml b/tests/functional/rgw_multisite.yml
new file mode 100644 (file)
index 0000000..27e55b3
--- /dev/null
@@ -0,0 +1,61 @@
+---
+- hosts: rgws
+  gather_facts: True
+  become: True
+  vars:
+    s3cmd_cmd: "s3cmd --no-ssl --access_key={{ system_access_key }} --secret_key={{ system_secret_key }} --host={{ rgw_multisite_endpoint_addr }}:8080 --host-bucket={{ rgw_multisite_endpoint_addr }}:8080"
+  tasks:
+
+    - name: check if it is Atomic host
+      stat: path=/run/ostree-booted
+      register: stat_ostree
+      check_mode: no
+
+    - name: set fact for using Atomic host
+      set_fact:
+        is_atomic: '{{ stat_ostree.stat.exists }}'
+
+    - name: install s3cmd
+      package:
+        name: s3cmd
+        state: present
+      when:
+        - not is_atomic
+
+    - name: generate and upload a random 10Mb file - containerized deployment
+      command: >
+        docker run --rm --name=rgw_multisite_test --entrypoint=/bin/bash {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} -c 'dd if=/dev/urandom of=/tmp/testinfra.img bs=1M count=10; {{ s3cmd_cmd }} mb s3://testinfra; {{ s3cmd_cmd }} put /tmp/testinfra.img s3://testinfra'
+      when:
+        - rgw_zonemaster
+        - containerized_deployment | default(False)
+
+    - name: generate and upload a random a 10Mb file - non containerized
+      shell: >
+        dd if=/dev/urandom of=/tmp/testinfra.img bs=1M count=10;
+        {{ s3cmd_cmd }} mb s3://testinfra;
+        {{ s3cmd_cmd }} put /tmp/testinfra.img s3://testinfra
+      when:
+        - rgw_zonemaster | default(False)
+        - not containerized_deployment | default(False)
+
+    - name: get info from replicated file - containerized deployment
+      command: >
+        docker run --rm --name=rgw_multisite_test --entrypoint=/bin/bash {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }} -c '{{ s3cmd_cmd }} info s3://testinfra/testinfra.img'
+      register: s3cmd_info_status
+      when:
+        - not rgw_zonemaster | default(False)
+        - containerized_deployment | default(False)
+      retries: 10
+      delay: 2
+      until: s3cmd_info_status.get('rc', 1) == 0
+
+    - name: get info from replicated file - non containerized
+      command: >
+        {{ s3cmd_cmd }} info s3://testinfra/testinfra.img
+      register: s3cmd_info_status
+      when:
+        - not rgw_zonemaster | default(False)
+        - not containerized_deployment | default(False)
+      retries: 10
+      delay: 2
+      until: s3cmd_info_status.get('rc', 1) == 0
diff --git a/tox.ini b/tox.ini
index a44a89269e8eda3c4cfba7d771117c8c8b6efd71..97b35abb10cd6aff6fda5910272bc8e510f69fa6 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -175,7 +175,9 @@ commands=
       ceph_dev_branch={env:CEPH_DEV_BRANCH:master} \
       ceph_dev_sha1={env:CEPH_DEV_SHA1:latest} \
       "
-      bash -c "cd {changedir}/secondary && vagrant destroy --force"
+  ansible-playbook -vv -i {changedir}/hosts {toxinidir}/tests/functional/rgw_multisite.yml --extra-vars "ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:docker.io} ceph_docker_image={env:CEPH_DOCKER_IMAGE:ceph/daemon} ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest}"
+  ansible-playbook -vv --ssh-extra-args='-F {changedir}/secondary/vagrant_ssh_config' -i {changedir}/secondary/hosts {toxinidir}/tests/functional/rgw_multisite.yml --extra-vars "ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:docker.io} ceph_docker_image={env:CEPH_DOCKER_IMAGE:ceph/daemon} ceph_docker_image_tag={env:CEPH_DOCKER_IMAGE_TAG:latest}"
+  bash -c "cd {changedir}/secondary && vagrant destroy --force"
 
 [testenv]
 whitelist_externals =