From f52fba6b8c062337708bfd429fbb845487f3d4c9 Mon Sep 17 00:00:00 2001 From: Yujun Zhang Date: Mon, 17 Apr 2017 10:37:19 +0800 Subject: Add testapi setup task Change-Id: I7b4d3186afd724ec5a30cf630baee79875e426bb Signed-off-by: Yujun Zhang --- tests/integration/fixtures/case.json | 14 ++++++++++++++ tests/integration/fixtures/pod.json | 6 ++++++ tests/integration/fixtures/project.json | 4 ++++ tests/integration/group_vars/all | 1 + tests/integration/host_vars/localhost | 7 +++++++ tests/integration/setup.yaml | 22 ++++++++++++++++++++++ 6 files changed, 54 insertions(+) create mode 100644 tests/integration/fixtures/case.json create mode 100644 tests/integration/fixtures/pod.json create mode 100644 tests/integration/fixtures/project.json create mode 100644 tests/integration/host_vars/localhost (limited to 'tests') diff --git a/tests/integration/fixtures/case.json b/tests/integration/fixtures/case.json new file mode 100644 index 00000000..22abc40f --- /dev/null +++ b/tests/integration/fixtures/case.json @@ -0,0 +1,14 @@ +{ + "run": "", + "name": "compute", + "ci_loop": "", + "tags": "", + "url": "", + "domains": "", + "dependencies": "", + "version": "", + "criteria": "", + "tier": "", + "blocking": "", + "description": "" +} \ No newline at end of file diff --git a/tests/integration/fixtures/pod.json b/tests/integration/fixtures/pod.json new file mode 100644 index 00000000..8c2863ba --- /dev/null +++ b/tests/integration/fixtures/pod.json @@ -0,0 +1,6 @@ +{ + "details": "", + "role": "", + "name": "internal", + "mode": "" +} \ No newline at end of file diff --git a/tests/integration/fixtures/project.json b/tests/integration/fixtures/project.json new file mode 100644 index 00000000..ecd03e83 --- /dev/null +++ b/tests/integration/fixtures/project.json @@ -0,0 +1,4 @@ +{ + "name": "qtip", + "description": "Platform Performance Benchmarking" +} \ No newline at end of file diff --git a/tests/integration/group_vars/all b/tests/integration/group_vars/all index 7c56f570..16a93f46 100644 --- a/tests/integration/group_vars/all +++ b/tests/integration/group_vars/all @@ -1,2 +1,3 @@ qtip_resources: ../../resources qtip_reports: ./reports +qtip_fixtures: ./fixtures diff --git a/tests/integration/host_vars/localhost b/tests/integration/host_vars/localhost new file mode 100644 index 00000000..18d764cc --- /dev/null +++ b/tests/integration/host_vars/localhost @@ -0,0 +1,7 @@ +testapi_url: http://localhost:8000/api/v1 +project_name: qtip +case_name: compute +pod_name: internal +installer: fuel +version: master +scenario: demo diff --git a/tests/integration/setup.yaml b/tests/integration/setup.yaml index 4af9a129..8d055c23 100644 --- a/tests/integration/setup.yaml +++ b/tests/integration/setup.yaml @@ -19,3 +19,25 @@ - name: update ssh.cfg file template: src={{ qtip_resources }}/template/ssh.cfg.j2 dest=./ssh.cfg delegate_to: localhost + +# Initialize testapi database +- hosts: localhost + tasks: + - name: create project and pod + uri: + url: "{{ testapi_url }}/{{item}}s" + method: POST + body: "{{ lookup('file', '{}/{}.json'.format(qtip_fixtures, item)) }}" + status_code: [200, 403] + body_format: json + with_items: + - project + - pod + - name: create cases + uri: + url: "{{ testapi_url }}/projects/qtip/cases" + method: POST + body: "{{ lookup('file', '{}/case.json'.format(qtip_fixtures)) }}" + status_code: [200, 403] + body_format: json + tags: [testapi] -- cgit 1.2.3-korg