summaryrefslogtreecommitdiffstats
path: root/controlloop/common/policy-yaml/src/test/resources
diff options
context:
space:
mode:
authormmis <michael.morris@ericsson.com>2018-02-12 11:54:51 +0000
committermmis <michael.morris@ericsson.com>2018-02-12 12:07:13 +0000
commit558b5a4779918ca76d6465754ae7650c6d9e2694 (patch)
treeb86860932ef626d971555fe96542aa69ebc18600 /controlloop/common/policy-yaml/src/test/resources
parentc735d07da356a21791abbf3d511e997c7d53b987 (diff)
Fix technical debt/JUnit on policy-yaml
Unit tests added and technical debt removed Issue-ID: POLICY-455 Change-Id: I31566f9386cb94d78e9af3d6261e31b9cad1cb53 Signed-off-by: mmis <michael.morris@ericsson.com>
Diffstat (limited to 'controlloop/common/policy-yaml/src/test/resources')
-rw-r--r--controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_control_loop_no_control_loop_name.yaml23
-rw-r--r--controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_connected_to_unknown_policy.yaml (renamed from controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policies_1.yaml)10
-rw-r--r--controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_exception_connected_to_unknown_policy.yaml23
-rw-r--r--controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_guard_connected_to_unknown_policy.yaml23
-rw-r--r--controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_retries_connected_to_unknown_policy.yaml23
-rw-r--r--controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_timeout_connected_to_unknown_policy.yaml23
-rw-r--r--controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_success_connected_to_unknown_policy.yaml23
-rw-r--r--controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_trigger_no_trigger_id.yaml21
-rw-r--r--controlloop/common/policy-yaml/src/test/resources/v1.0.0/empty.yaml0
-rw-r--r--controlloop/common/policy-yaml/src/test/resources/v1.0.0/test.yaml273
10 files changed, 404 insertions, 38 deletions
diff --git a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_control_loop_no_control_loop_name.yaml b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_control_loop_no_control_loop_name.yaml
new file mode 100644
index 000000000..ce51ff618
--- /dev/null
+++ b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_control_loop_no_control_loop_name.yaml
@@ -0,0 +1,23 @@
+controlLoop:
+ controlLoopName:
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+
diff --git a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policies_1.yaml b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_connected_to_unknown_policy.yaml
index f6ad68425..ad65dbfcf 100644
--- a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policies_1.yaml
+++ b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_connected_to_unknown_policy.yaml
@@ -15,11 +15,9 @@ policies:
description:
actor: APPC
recipe: Restart
- target: VM
+ target:
+ type: VM
+ resourceID: vm1
retry: 2
timeout: 300
- success: FINAL_FAILURE
- failure: unique-policy-id-3-rebuild
- failure_timeout: unique-policy-id-3-rebuild
- failure_retries: unique-policy-id-3-rebuild
- failure_exception: final_failure_exception
+ failure: unknown-policy
diff --git a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_exception_connected_to_unknown_policy.yaml b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_exception_connected_to_unknown_policy.yaml
new file mode 100644
index 000000000..334f2aa6e
--- /dev/null
+++ b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_exception_connected_to_unknown_policy.yaml
@@ -0,0 +1,23 @@
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure_exception: unknown-policy
diff --git a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_guard_connected_to_unknown_policy.yaml b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_guard_connected_to_unknown_policy.yaml
new file mode 100644
index 000000000..8d39ee86d
--- /dev/null
+++ b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_guard_connected_to_unknown_policy.yaml
@@ -0,0 +1,23 @@
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure_guard: unknown-policy
diff --git a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_retries_connected_to_unknown_policy.yaml b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_retries_connected_to_unknown_policy.yaml
new file mode 100644
index 000000000..4108369a5
--- /dev/null
+++ b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_retries_connected_to_unknown_policy.yaml
@@ -0,0 +1,23 @@
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure_retries: unknown-policy
diff --git a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_timeout_connected_to_unknown_policy.yaml b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_timeout_connected_to_unknown_policy.yaml
new file mode 100644
index 000000000..5dcc96a86
--- /dev/null
+++ b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_failure_timeout_connected_to_unknown_policy.yaml
@@ -0,0 +1,23 @@
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure_timeout: unknown-policy
diff --git a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_success_connected_to_unknown_policy.yaml b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_success_connected_to_unknown_policy.yaml
new file mode 100644
index 000000000..6df86e390
--- /dev/null
+++ b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_policy_success_connected_to_unknown_policy.yaml
@@ -0,0 +1,23 @@
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy: unique-policy-id-1-restart
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: unknown-policy
diff --git a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_trigger_no_trigger_id.yaml b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_trigger_no_trigger_id.yaml
new file mode 100644
index 000000000..8231b2498
--- /dev/null
+++ b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/bad_trigger_no_trigger_id.yaml
@@ -0,0 +1,21 @@
+controlLoop:
+ controlLoopName: ControlLoop-TEST-5dfa8fce-bd7a-4424-b60d-ee2ad2f254a3
+ version: 1.0.0
+ services:
+ - serviceName: Foo Service
+ resources:
+ - resourceName: Bar VNF
+ resourceType: VF
+ trigger_policy:
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-restart
+ name: Restart Policy for Trigger Event
+ description:
+ actor: APPC
+ recipe: Restart
+ target: VM
+ retry: 2
+ timeout: 300
+
diff --git a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/empty.yaml b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/empty.yaml
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/empty.yaml
diff --git a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/test.yaml b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/test.yaml
index b89a725cf..55caa0b9f 100644
--- a/controlloop/common/policy-yaml/src/test/resources/v1.0.0/test.yaml
+++ b/controlloop/common/policy-yaml/src/test/resources/v1.0.0/test.yaml
@@ -15,81 +15,290 @@ policies:
description:
actor: APPC
recipe: Restart
- target: VM
+ target:
+ type: VM
+ resourceID: vm1
retry: 2
timeout: 300
- success: unique-policy-id-2-healthcheck-restart
+ success: unique-policy-id-2-modifyconfig
failure: unique-policy-id-3-rebuild
failure_timeout: unique-policy-id-3-rebuild
failure_retries: unique-policy-id-3-rebuild
- failure_exception: final_failure_exception
+ failure_exception: unique-policy-id-7-modifyconfig-for-failure
+ failure_guard: unique-policy-id-7-modifyconfig-for-failure
- - id: unique-policy-id-2-healthcheck-restart
- name: HealthCheck Policy
+ - id: unique-policy-id-2-modifyconfig
+ name: ModifyConfig Policy
description:
actor: APPC
- recipe: HealthCheck
- target: VM
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
retry: 2
timeout: 300
- success: final_success
+ success: FINAL_SUCCESS
failure: unique-policy-id-3-rebuild
failure_timeout: unique-policy-id-3-rebuild
failure_retries: unique-policy-id-3-rebuild
- failure_exception: final_failure_exception
+ failure_exception: FINAL_FAILURE_EXCEPTION
- id: unique-policy-id-3-rebuild
name: Rebuild Policy
description:
actor: APPC
recipe: Rebuild
- target: VM
+ target:
+ type: VM
+ resourceID: vm1
retry: 0
timeout: 600
- success: unique-policy-id-4-healthcheck-rebuild
+ success: unique-policy-id-4-modifyconfig
failure: unique-policy-id-5-migrate
failure_timeout: unique-policy-id-5-migrate
failure_retries: unique-policy-id-5-migrate
- failure_exception: final_failure_exception
+ failure_exception: FINAL_FAILURE_EXCEPTION
- - id: unique-policy-id-4-healthcheck-rebuild
+ - id: unique-policy-id-4-modifyconfig
name: HealthCheck the Rebuild Policy
description:
actor: APPC
- recipe: HealthCheck
- target: VM
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
retry: 2
timeout: 300
- success: final_success
+ success: FINAL_SUCCESS
failure: unique-policy-id-5-migrate
failure_timeout: unique-policy-id-5-migrate
failure_retries: unique-policy-id-5-migrate
- failure_exception: final_failure_exception
+ failure_exception: FINAL_FAILURE_EXCEPTION
- id: unique-policy-id-5-migrate
name: Migrate Policy
description:
actor: APPC
recipe: Migrate
- target: VM
+ target:
+ type: VM
+ resourceID: vm1
retry: 0
timeout: 600
- success: unique-policy-id-6-healthcheck-migrate
- failure: final_failure
- failure_timeout: final_failure_timeout
- failure_retries: final_failure_retries
- failure_exception: final_failure_exception
+ success: unique-policy-id-6-modifyconfig
+ failure: FINAL_FAILURE
+ failure_timeout: FINAL_FAILURE_TIMEOUT
+ failure_retries: FINAL_FAILURE_RETRIES
+ failure_exception: FINAL_FAILURE_EXCEPTION
- - id: unique-policy-id-6-healthcheck-migrate
- name: Healthcheck the Migrate Policy
+ - id: unique-policy-id-6-modifyconfig
+ name: ModifyConfig after Migrate Policy
description:
actor: APPC
- recipe: HealthCheck
- target: VM
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
retry: 2
timeout: 300
- success: final_success
- failure: final_failure
- failure_timeout: final_failure_timeout
- failure_retries: final_failure_retries
- failure_exception: final_failure_exception
+ success: FINAL_SUCCESS
+ failure: FINAL_FAILURE
+ failure_timeout: FINAL_FAILURE_TIMEOUT
+ failure_retries: FINAL_FAILURE_RETRIES
+ failure_exception: FINAL_FAILURE_EXCEPTION
+
+ - id: unique-policy-id-7-modifyconfig-for-failure
+ name: ModifyConfig for Failure
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+ failure: FINAL_FAILURE
+ failure_timeout: FINAL_FAILURE_TIMEOUT
+ failure_retries: FINAL_FAILURE_RETRIES
+ failure_exception: FINAL_FAILURE_EXCEPTION
+
+ - id:
+ name: invalid policy - id is null
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+
+ - id: SUCCESS
+ name: invalid policy - id is a PolicyResult
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+
+ - id: FINAL_SUCCESS
+ name: invalid policy - id is a FinalResult
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+
+ - id: invalid-policy-null-actor
+ name: invalid policy - actor is null
+ description:
+ actor:
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+
+ - id: invalid-policy-unknown-actor
+ name: invalid policy - actor is unknown
+ description:
+ actor: UnknownActor
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+
+ - id: invalid-policy-null-receipe
+ name: invalid policy - receipe is null
+ description:
+ actor: APPC
+ recipe:
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+
+ - id: invalid-policy-unknown-receipe
+ name: invalid policy - unknown receipe
+ description:
+ actor: APPC
+ recipe: UnknownReceipe
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+
+ - id: invalid-policy-null-target
+ name: invalid policy - target is null
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+
+ - id: invalid-policy-null-target-type
+ name: invalid policy - target type is null
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type:
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_SUCCESS
+
+ - id: invalid-policy-invalid-success-policy
+ name: invalid policy - success policy is invalid
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ success: FINAL_FAILURE
+
+ - id: invalid-policy-invalid-failure-policy
+ name: invalid policy - failure policy is invalid
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure: FINAL_FAILURE_TIMEOUT
+
+ - id: invalid-policy-invalid-failure-timeout-policy
+ name: invalid policy - failure timeout policy is invalid
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure_timeout: FINAL_FAILURE_RETRIES
+
+ - id: invalid-policy-invalid-failure-retries-policy
+ name: invalid policy - failure retries policy is invalid
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure_retries: FINAL_FAILURE_EXCEPTION
+
+ - id: invalid-policy-invalid-failure-exception-policy
+ name: invalid policy - failure exception policy is invalid
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure_exception: FINAL_FAILURE_GUARD
+
+ - id: invalid-policy-invalid-failure-guard-policy
+ name: invalid policy - failure guard policy is invalid
+ description:
+ actor: APPC
+ recipe: ModifyConfig
+ target:
+ type: VM
+ resourceID: vm1
+ retry: 2
+ timeout: 300
+ failure_guard: FINAL_SUCCESS
+
+