Digital Ocean Integration tests (#29960)

* Digital Ocean Integration tests
pull/49239/head
Patrick Marques 6 years ago committed by John R Barker
parent bc3e7bbeba
commit d9a17e098c

@ -44,6 +44,11 @@ amazon_cleanup:
azure_cleanup:
python cleanup_azure.py -y --match="^$(CLOUD_RESOURCE_PREFIX)"
digital_ocean: $(CREDENTIALS_FILE)
ansible-playbook digital_ocean.yml -i $(INVENTORY) -e @$(VARS_FILE) $(CREDENTIALS_ARG) -v $(TEST_FLAGS) ; \
RC=$$? ; \
exit $$RC;
gce_setup:
python setup_gce.py "$(CLOUD_RESOURCE_PREFIX)"

@ -22,3 +22,5 @@ azure_cert_path: "{{ lookup('env', 'AZURE_CERT_PATH') }}"
cloudflare_api_token:
cloudflare_email:
cloudflare_zone:
digitalocean_oauth_token: "{{ lookup('env', 'DO_API_TOKEN') }}"

@ -0,0 +1,9 @@
- hosts: localhost
connection: local
gather_facts: no
tags:
- test_digital_ocean
vars:
dummy_ssh_pub_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzTSH4WVqnK2kUgtbs2VryNUXBaox7SoXPmV4yMP4INPAndrtPTS3BRzBPrJwQSwjsT7y3kBLNIHGppxLFMoQTEL03WlMDfM1TthMT7Y5B65wOUMxdwbSn9zlblAqbbRg7XU/UgNZb+B2kBPepPRJlh1ap4CPTNrbzdKlmwqS4X3+hX/WM3Gt3S09eNxUKDBK18Fbf/yKvhXP4bGtD0cxYNKL4qoGjEZTkjiYQyC4TvfuZaUtOFpiMLPAt0V7ao2S2bKr8hAgxl9MtrJpa2q1FueAjljMSBWUhOjFgmO0SpWDcBu157vMtscmtUC2cMpQwAY2HQyMJAYs0HOa59dpUKtxBR3LwjXyZvL+RbjEbzZjp4JQSer/bB/jekrxHAIABCwdFmx6qBGNVqDdfT7o+OcEJaAvk4gKEFI24OU8k6WF4ss97VfxlvIT6Bq2p04oUsxN0qh9aSjRVfqJmhkSocf+1iGWGfa4DMFpeQAXCzUkhJS5ecYXSDmyMHGtl7OfhLnncUDHVRjhsmrCFb5kkHHVfNd601ixixydInlssUhQRRzhnJ+ciTh/x7ARDfwMendHTTHCj5sO1IvnOJdCcX4FTMKp1GLo6eaK738o9w4rWL0bs3kWJfxWg91QegwZW0r8xSJBtga7HyQafxivhwEN8knN8HuD47iBuAL+VTw==
roles:
- { role: test_digital_ocean, tags: test_digital_ocean }

@ -0,0 +1,38 @@
---
- name: "Make sure that the Floating IP is absent"
digital_ocean_floating_ip:
state: absent
ip: "8.8.8.8"
oauth_token: "{{ digitalocean_oauth_token }}"
register: result
- name: Verify that the Floating IP didn't change
assert:
that:
- "not result.changed"
- name: "Create a Floating IP"
digital_ocean_floating_ip:
state: present
region: "lon1"
oauth_token: "{{ digitalocean_oauth_token }}"
register: result
- name: Verify that a Floating IP was created
assert:
that:
- "result.changed"
- name: "Destroy Floating IP"
digital_ocean_floating_ip:
state: absent
ip: "{{ result.data.floating_ip.ip }}"
region: "lon1"
oauth_token: "{{ digitalocean_oauth_token }}"
register: result
- name: Verify that a Floating IP was deleted
assert:
that:
- " result.changed"

@ -0,0 +1,4 @@
- name: SSH Key module tests
include: tasks/sshkey.yml
- name: Floating IPs module tests
include: tasks/floating_ip.yml

@ -0,0 +1,25 @@
---
- name: Create ssh key
digital_ocean_sshkey:
name: test-key1
ssh_pub_key: "{{ dummy_ssh_pub_key }}"
oauth_token: "{{ digitalocean_oauth_token }}"
register: result
- name: Verify that SSH key was created
assert:
that:
- "result.changed"
- name: "Delete ssh key"
digital_ocean_sshkey:
state: "absent"
fingerprint: "{{ result.data.ssh_key.fingerprint }}"
oauth_token: "{{ digitalocean_oauth_token }}"
register: result
- name: Verify that SSH key was deleted
assert:
that:
- "result.changed"
Loading…
Cancel
Save