---
# Playbook to perform integration testing on Celos
#
# Uploads sample workflows to the Celos master node and verifies that
# the result of the /celos/workflow-list servlet lists the workflows.

- hosts: hadoop_masters
  gather_facts: no
  vars:
    local_celos: ..
    celos_port: 8080
    celos_workflows_dir: /etc/celos/workflows
    celos_db_dir: /var/lib/celos/db

  tasks:

  - name: Remove old files, if any
    shell: sudo rm -rf {{celos_workflows_dir}}/* {{celos_db_dir}}/*
      && sudo mkdir -p {{celos_workflows_dir}}
      && sudo mkdir -p {{celos_db_dir}}

  - name: Testing servlet /celos/workflow-list
    local_action: shell curl {{inventory_hostname}}:8080/celos/workflow-list | diff - test_files/empty_workflow_list.json

---
# Playbook to perform integration testing on Celos
#
# Uploads sample workflows to the Celos master node and verifies that
# the result of the /celos/workflow-list servlet lists the workflows.

- hosts: hadoop_masters
  gather_facts: no
  vars:
    local_celos: ..
    celos_port: 8080
    celos_workflows_dir: /etc/celos/workflows
    celos_db_dir: /var/lib/celos/db
    celos_user: ubuntu

  tasks:

  - name: Prepare configuration dir
    shell: sudo rm -rf {{celos_workflows_dir}}/* && sudo mkdir -p {{celos_workflows_dir}}
      && sudo chown {{celos_user}}:{{celos_user}} {{celos_workflows_dir}}

  - name: Prepare database dir
    shell: sudo rm -rf {{celos_db_dir}}/* && sudo mkdir -p {{celos_db_dir}}
      && sudo chown {{celos_user}}:{{celos_user}} {{celos_db_dir}}

  - name: Testing servlet /celos/workflow-list
    local_action: shell curl {{inventory_hostname}}:8080/celos/workflow-list | diff - test_files/empty_workflow_list.json

Make /etc/celos/workflows/ and /var/lib/celos/db writable by Celos user (currently ubuntu).
Make /etc/celos/workflows/ and /var/lib/celos/db writable by Celos user (currently ubuntu).
