-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TOSCA input replacement unit tests
- Test node's, artifact's, relationships' and capabilities' properties substitution - Default input replaced - Required input not in list - Not required input without default value - Empty input list See #41
- Loading branch information
1 parent
6507797
commit f1fb6ed
Showing
7 changed files
with
314 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/test/resources/tosca/inputs/tosca_inputs_default_replaced.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
tosca_definitions_version: tosca_simple_yaml_1_0 | ||
|
||
description: > | ||
TOSCA for testing a required input not given by the user | ||
topology_template: | ||
|
||
inputs: | ||
cpus: | ||
type: integer | ||
description: Number of CPUs for the server. | ||
constraints: | ||
- valid_values: [ 1, 2, 4, 8 ] | ||
required: false | ||
default: 8 | ||
|
||
node_templates: | ||
my_server: | ||
type: tosca.nodes.Compute | ||
capabilities: | ||
host: | ||
properties: | ||
num_cpus: { get_input: cpus } | ||
mem_size: 2048 MB | ||
disk_size: 10 GB |
16 changes: 16 additions & 0 deletions
16
src/test/resources/tosca/inputs/tosca_inputs_empty_input_list.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
tosca_definitions_version: tosca_simple_yaml_1_0 | ||
|
||
description: > | ||
TOSCA for testing a required input not given by the user | ||
topology_template: | ||
|
||
node_templates: | ||
my_server: | ||
type: tosca.nodes.Compute | ||
capabilities: | ||
host: | ||
properties: | ||
num_cpus: { get_input: cpus } | ||
mem_size: 2048 MB | ||
disk_size: 10 GB |
24 changes: 24 additions & 0 deletions
24
src/test/resources/tosca/inputs/tosca_inputs_not_required_without_default.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
tosca_definitions_version: tosca_simple_yaml_1_0 | ||
|
||
description: > | ||
TOSCA for testing a required input not given by the user | ||
topology_template: | ||
|
||
inputs: | ||
cpus: | ||
type: integer | ||
description: Number of CPUs for the server. | ||
constraints: | ||
- valid_values: [ 1, 2, 4, 8 ] | ||
required: false | ||
|
||
node_templates: | ||
my_server: | ||
type: tosca.nodes.Compute | ||
capabilities: | ||
host: | ||
properties: | ||
num_cpus: { get_input: cpus } | ||
mem_size: 2048 MB | ||
disk_size: 10 GB |
101 changes: 101 additions & 0 deletions
101
src/test/resources/tosca/inputs/tosca_inputs_replaced_all_types.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
tosca_definitions_version: tosca_simple_yaml_1_0 | ||
|
||
imports: | ||
- indigo_custom_types: https://raw.githubusercontent.com/indigo-dc/tosca-types/master/custom_types.yaml | ||
|
||
description: > | ||
TOSCA examples for specifying a Chronos Job that runs an application using the input stored at some URL and uploads the output data to an http(s) or ftp(s) or webdav(s) repository | ||
topology_template: | ||
|
||
inputs: | ||
input_urls: | ||
type: list | ||
description: List of input files that will be downloaded in the job sandbox (archives will be automatically uncompressed) | ||
entry_schema: | ||
type: string | ||
required: yes | ||
|
||
output_filenames: | ||
type: list | ||
description: List of filenames generated by the application run | ||
entry_schema: | ||
type: string | ||
required: yes | ||
|
||
command: | ||
type: string | ||
description: Command to execute | ||
default: 'env' | ||
required: no | ||
|
||
cpus: | ||
type: float | ||
description: Amount of CPUs for this job | ||
required: yes | ||
|
||
mem: | ||
type: scalar-unit.size | ||
description: Amount of Memory for this job | ||
required: yes | ||
|
||
docker_image: | ||
type: string | ||
description: Docker image to be used to run the container application | ||
required: yes | ||
|
||
node_templates: | ||
chronos_job: | ||
type: tosca.nodes.indigo.Container.Application.Docker.Chronos | ||
properties: | ||
schedule: 'R0/2015-12-25T17:22:00Z/PT1M' | ||
description: 'Execute Application' | ||
command: { get_input: command } | ||
uris: { get_input: input_urls} | ||
retries: 3 | ||
environment_variables: | ||
OUTPUT_FILENAMES: { get_input: output_filenames } | ||
artifacts: | ||
image: | ||
file: { get_input: docker_image } | ||
type: tosca.artifacts.Deployment.Image.Container.Docker | ||
requirements: | ||
- host: docker_runtime1 | ||
|
||
|
||
chronos_job_upload: | ||
type: tosca.nodes.indigo.Container.Application.Docker.Chronos | ||
properties: | ||
description: 'Upload output data' | ||
command: 'echo \"I will upload something...\"' | ||
retries: 3 | ||
artifacts: | ||
image: | ||
file: libmesos/ubuntu | ||
type: tosca.artifacts.Deployment.Image.Container.Docker | ||
requirements: | ||
- host: docker_runtime2 | ||
- parent_job: | ||
node: chronos_job | ||
#relationship: | ||
# type: DependsOn | ||
# properties: | ||
# test: { get_input: cpus } | ||
|
||
|
||
docker_runtime1: | ||
type: tosca.nodes.indigo.Container.Runtime.Docker | ||
capabilities: | ||
host: | ||
properties: | ||
num_cpus: { get_input: cpus } | ||
mem_size: { get_input: mem } | ||
|
||
|
||
docker_runtime2: | ||
type: tosca.nodes.indigo.Container.Runtime.Docker | ||
capabilities: | ||
host: | ||
properties: | ||
num_cpus: 1.0 | ||
mem_size: 1024 MB |
Oops, something went wrong.