Skip to content

Commit

Permalink
Satellite-populate nailgun entity examples for issue SatelliteQE#64
Browse files Browse the repository at this point in the history
  • Loading branch information
chbrown13 committed Aug 18, 2017
1 parent 28388a4 commit c1e3201
Show file tree
Hide file tree
Showing 32 changed files with 1,227 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ lint: ## check style with flake8
test: lint ## run tests quickly with the default Python
py.test


test-all: ## run tests on every Python version with tox
tox

test-entities: ## run satellite-populate examples for nailgun entities
for f in examples/satellite/*.yaml; do satellite-populate $$f; done

coverage: ## check code coverage quickly with the default Python
coverage run --source satellite_populate -m pytest

Expand Down Expand Up @@ -89,3 +91,4 @@ install: clean ## install the package to the active Python's site-packages

bump: test
bumpversion patch --config-file=setup.cfg

35 changes: 35 additions & 0 deletions examples/satellite/abstract_compute_resource_docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Testing nailgun entities

vars:
name: AbsCompResDock
desc: Nailgun test
update_desc: Updated

actions:

- model: AbstractComputeResource
register: test_entity
data:
name: "{{ name }}"
description: "{{ desc }}"
provider: Docker

- action: update
register: test_entity
model: AbstractComputeResource
data:
description: "{{ update_desc }}"
search_query:
name: "{{ entity_name }}"

- action: assertion
operation: eq
data:
- from_registry: test_entity.description
- "{{ update_desc }}"

- action: delete
model: AbstractComputeResource
search_query:
name: "{{ entity_name }}"

34 changes: 34 additions & 0 deletions examples/satellite/abstract_compute_resource_libvirt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Testing nailgun entities

vars:
name: AbsCompResLib
desc: Nailgun test
update_desc: Updated

actions:

- model: AbstractComputeResource
register: test_entity
data:
name: "{{ name }}"
description: "{{ desc }}"
provider: Libvirt

- action: update
register: test_entity
model: AbstractComputeResource
data:
description: "{{ update_desc }}"
search_query:
name: "{{ entity_name }}"

- action: assertion
operation: eq
data:
- from_registry: test_entity.description
- "{{ update_desc }}"

- action: delete
model: AbstractComputeResource
search_query:
name: "{{ entity_name }}"
61 changes: 61 additions & 0 deletions examples/satellite/activation_key.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Testing nailgun entities

vars:
org_name: Activation Key Org
key_name: activate
update_name: Activate Key

actions:

# Setup
- model: Organization
register: key_org
data:
name: "{{ org_name }}"
label: label
description: Organization for testing activation keys

# Create
- model: ActivationKey
register: test_key
data:
name: "{{ key_name }}"
max_hosts: 10
auto_attach: True
unlimited_hosts: False
description: Test activation key
organization:
from_registry: key_org

# Update
- action: update
register: test_key
model: ActivationKey
data:
name: "{{ update_name }}"
search_query:
name: "{{ key_name }}"
organization:
from_registry: key_org

# Assert
- action: assertion
log: Checking that Activation Key name was updated
operation: eq
data:
- from_registry: test_key.name
- "{{ update_name }}"

# Delete
- action: delete
model: ActivationKey
search_query:
name: "{{ update_name }}"
organization:
from_registry: key_org

# Cleanup
- action: delete
model: Organization
search_query:
name: "{{ org_name }}"
37 changes: 37 additions & 0 deletions examples/satellite/architecture.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Testing nailtun entities

vars:
arch_name: x172-128
update_name: x43-32

actions:

# Create
- model: Architecture
register: default_arch
data:
name: "{{ arch_name }}"

# Update
- action: update
register: default_arch
model: Architecture
data:
name: "{{ update_name }}"
search_query:
name: "{{ arch_name }}"

# Assert
- action: assertion
log: Checking that Architecture name was updated
operation: eq
data:
- from_registry: default_arch.name
- "{{ update_name }}"

# Delete
- action: delete
model: Architecture
search_query:
name: "{{ update_name }}"

38 changes: 38 additions & 0 deletions examples/satellite/bookmark.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Testing nailgun entities

vars:
book_name: Mark
book_query: last_report and status.enabled = true

actions:

# Create
- model: Bookmark
register: test_book
data:
name: "{{ book_name }}"
public: True
query: last_report
controller: job_invocations

# Update
- action: update
register: test_book
model: Bookmark
data:
query: "{{ book_query }}"
search_query:
name: "{{ book_name }}"

# Assert
- action: assertion
operation: eq
data:
- from_registry: test_book.query
- "{{ book_query }}"

# Delete
- action: delete
model: Bookmark
search_query:
name: "{{ book_name }}"
37 changes: 37 additions & 0 deletions examples/satellite/common_parameter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Testing nailgun entities

vars:
param_name: parameter
value: test_value
new_value: 100

actions:

# Create
- model: CommonParameter
register: test_comm_param
data:
name: "{{ param_name }}"
value: "{{ value }}"

# Update
- action: update
register: test_comm_param
model: CommonParameter
data:
value: "{{ new_value }}"
search_query:
name: "{{ param_name }}"

# Assert
- action: assertion
operation: eq
data:
- from_registry: test_comm_param.value
- "{{ new_value }}"

# Delete
- action: delete
model: CommonParameter
search_query:
name: "{{ param_name }}"
36 changes: 36 additions & 0 deletions examples/satellite/config_group.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Testing nailgun entities

vars:
name: config_grp
new_name: config_grp2

actions:

# Create
- model: ConfigGroup
register: test_group
data:
name: "{{ name }}"

# Update
- action: update
register: test_group
model: ConfigGroup
data:
name: "{{ new_name }}"
search_query:
name: "{{ name }}"

# Assert
- action: assertion
operation: eq
data:
- from_registry: test_group.name
- "{{ new_name }}"

# Delete
# No attribute delete
# - action: delete
# model: ConfigGroup
# search_query:
# name: "{{ new_name }}"
43 changes: 43 additions & 0 deletions examples/satellite/config_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Testing nailgun entities

vars:
name: config_temp
comment: auditing
new_comment: audit done

actions:

# Create
- model: ConfigTemplate
register: test_cfg_tmp
data:
name: "{{ name }}"
audit_comment: "{{ comment }}"
snippet: 'true'
template: temp
template_combinations:
- 1
- 2
- 3

# Update
- action: update
register: test_cfg_tmp
model: ConfigTemplate
data:
audit_comment: "{{ new_comment }}"
search_query:
name: "{{ name }}"

# Assert
- action: assertion
operation: eq
data:
- from_registry: test_cfg_tmp.audit_comment
- audit done

# Delete
- action: delete
model: ConfigTemplate
search_query:
name: "{{ name }}"
37 changes: 37 additions & 0 deletions examples/satellite/content_view.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Testing nailgun entities

vars:
name: test content view
composite_name: composite content view

actions:

- model: ContentView
register: test_view
data:
name: "{{ name }}"
composite: False
description: satellite-populate content view test
label: test
next_version: 2
content_host_count: 0
last_published: 07/28/2017

- action: update
register: test_view
model: ContentView
data:
composite: True
search_query:
name: "{{ name }}"

- action: assertion
operation: eq
data:
- from_registry: test_view.composite
- True

- action: delete
model: ContentView
search_query:
name: "{{ name }}"
Loading

0 comments on commit c1e3201

Please sign in to comment.