Issue-ID: RIC-149
[it/test.git] / ric_robot_suite / helm / nanobot / configmap-src / public / resources / negative_appmgr_tests.robot
diff --git a/ric_robot_suite/helm/nanobot/configmap-src/public/resources/negative_appmgr_tests.robot b/ric_robot_suite/helm/nanobot/configmap-src/public/resources/negative_appmgr_tests.robot
new file mode 100644 (file)
index 0000000..3f69704
--- /dev/null
@@ -0,0 +1,38 @@
+*** settings ***
+Documentation     Negative tests for the AppMgr: ensure that AppMgr produces expected errors for a variety of invalid requests
+
+Library           Collections
+Library           UUID
+
+Resource          /robot/resources/global_properties.robot
+Resource          appmgr_interface.robot
+
+*** Keywords ***
+Deploy Duplicate XApp And Expect Error
+     [Documentation]      Ensure AppMgr produces an appropriate error when an already-running XApp is deployed
+     @{d} =               Get Deployed XApps
+     Should Not Be Empty  ${d}      No XApps currently deployed
+     @{names} =           Pluck     name  ${d}
+     ${xapp} =            Evaluate  random.choice(${names})  random
+     ${status}  ${u} =    Run Keyword And Ignore Error  Deploy XApp  ${xapp}
+     Should Be Equal As Strings  ${status}          FAIL
+
+Undeploy Nondeployed XApp And Expect Error
+     [Documentation]      Ensure AppMgr produces an appropriate error when an existing but non-running XApp is deleted
+     @{d} =               Get Deployed XApps
+     @{a} =               Get Deployable XApps
+     Should Not Be Empty  ${a}       No XApps available to deploy
+     @{dNames} =          Pluck      name     ${d}
+     @{a} =               Subtract From List  ${a}  ${dNames}
+     Should Not Be Empty  ${a}                No undeployed XApps
+     ${xapp} =            Evaluate            random.choice(${a})  random
+     ${status}  ${u} =    Run Keyword And Ignore Error  Undeploy XApp  ${xapp}
+     Should Be Equal As Strings               ${status}            FAIL
+
+Request Nonexistent XApp And Expect Error
+     [Documentation]    Ensure AppMgr produces an appropriate error when retrieving a nonexistent XApp
+     ${xapp} =          Generate UUID
+     ${status}  ${u} =  Run Keyword And Ignore Error  Get XApp By Name {$xapp}
+     Should Be Equal As Strings  ${status}   FAIL
+
+