Fix featuresBoot parameter in nitrogen tests 57/59657/6
authorPeter Gubka <pgubka@cisco.com>
Thu, 29 Jun 2017 08:51:29 +0000 (10:51 +0200)
committerVratko Polák <vrpolak@cisco.com>
Thu, 29 Jun 2017 13:59:16 +0000 (13:59 +0000)
Change-Id: I2c627ae22d5dfd7c25ad757f7785f1d820eab60b
Signed-off-by: Peter Gubka <pgubka@cisco.com>
csit/libraries/CompareStream.robot
csit/suites/controller/akka_upgrade/1node.robot

index 74fdd2aa5a3e41d9363b454c0eef7ef2bdd46c5c..d6166426478ad9ffef4039f6141c4c291049353f 100644 (file)
@@ -53,6 +53,12 @@ Set_Variable_If_At_Least_Carbon
     ...    return ${value_if_false} otherwise.
     BuiltIn.Run_Keyword_And_Return    Set_Variable_If_At_Least    carbon    ${value_if_true}    ${value_if_false}
 
+Set_Variable_If_At_Least_Nitrogen
+    [Arguments]    ${value_if_true}    ${value_if_false}
+    [Documentation]    Compare nitrogen to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at least nitrogen,
+    ...    return ${value_if_false} otherwise.
+    BuiltIn.Run_Keyword_And_Return    Set_Variable_If_At_Least    nitrogen    ${value_if_true}    ${value_if_false}
+
 Set_Variable_If_At_Most_Helium
     [Arguments]    ${value_if_true}    ${value_if_false}
     [Documentation]    Compare stable-helium to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at most stable-helium,
@@ -83,6 +89,12 @@ Set_Variable_If_At_Most_Carbon
     ...    return ${value_if_false} otherwise.
     BuiltIn.Run_Keyword_And_Return    Set_Variable_If_At_Most    carbon    ${value_if_true}    ${value_if_false}
 
+Set_Variable_If_At_Most_Nitrogen
+    [Arguments]    ${value_if_true}    ${value_if_false}
+    [Documentation]    Compare nitrogen to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at most nitrogen,
+    ...    return ${value_if_false} otherwise.
+    BuiltIn.Run_Keyword_And_Return    Set_Variable_If_At_Most    nitrogen    ${value_if_true}    ${value_if_false}
+
 CompareStream__Convert_Input
     [Arguments]    @{arguments}
     [Documentation]    Splits arguments into args and kwargs is used in Run_Keyword_If_At_Least_Else and Run_Keyword_If_At_Most_Else.
@@ -192,6 +204,12 @@ Run_Keyword_If_At_Least_Carbon
     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_At_Least    carbon    ${kw_name}    @{varargs}    &{kwargs}
 
+Run_Keyword_If_At_Least_Nitrogen
+    [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
+    [Documentation]    Compare nitrogen to ${ODL_STREAM} and in case ${ODL_STREAM} is at least nitrogen,
+    ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
+    BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_At_Least    nitrogen    ${kw_name}    @{varargs}    &{kwargs}
+
 Run_Keyword_If_At_Most_Helium
     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
     [Documentation]    Compare stable-helium to ${ODL_STREAM} and in case ${ODL_STREAM} is at most stable-helium,
@@ -222,6 +240,12 @@ Run_Keyword_If_At_Most_Carbon
     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_At_Most    carbon    ${kw_name}    @{varargs}    &{kwargs}
 
+Run_Keyword_If_At_Most_Nitrogen
+    [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
+    [Documentation]    Compare nitrogen to ${ODL_STREAM} and in case ${ODL_STREAM} is at most nitrogen,
+    ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
+    BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_At_Most    nitrogen    ${kw_name}    @{varargs}    &{kwargs}
+
 Run_Keyword_If_More_Than_Helium
     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
     [Documentation]    Compare stable-helium to ${ODL_STREAM} and in case ${ODL_STREAM} is more than stable-helium,
@@ -281,3 +305,15 @@ Run_Keyword_If_Less_Than_Carbon
     [Documentation]    Compare carbon to ${ODL_STREAM} and in case ${ODL_STREAM} is less than carbon,
     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_Less_Than    carbon    ${kw_name}    @{varargs}    &{kwargs}
+
+Run_Keyword_If_More_Than_Nitrogen
+    [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
+    [Documentation]    Compare nitrogen to ${ODL_STREAM} and in case ${ODL_STREAM} is more than nitrogen,
+    ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
+    BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_More_Than    nitrogen    ${kw_name}    @{varargs}    &{kwargs}
+
+Run_Keyword_If_Less_Than_Nitrogen
+    [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
+    [Documentation]    Compare nitrogen to ${ODL_STREAM} and in case ${ODL_STREAM} is less than nitrogen,
+    ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
+    BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_Less_Than    nitrogen    ${kw_name}    @{varargs}    &{kwargs}
index 72263c2d92e141409f065eee7a1221ed27963f17..42d96f1b6a2a3fdb2dae427456e75105677fbea7 100644 (file)
@@ -42,7 +42,9 @@ Suite Setup       Setup_Suite
 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
 Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
 Default Tags      1node    carpeople    critical
+Library           String
 Library           SSHLibrary
+Resource          ${CURDIR}/../../../libraries/CompareStream.robot
 Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
 Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
 Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
@@ -81,12 +83,15 @@ Install_Older_Odl
     ${cfg_newer} =    BuiltIn.Set_Variable    ${WORKSPACE}/${BUNDLEFOLDER}/etc/${cfg_filename}
     ${vanilla_line} =    SSHKeywords.Execute_Command_Should_Pass    grep 'featuresBoot' "${cfg_older}" | grep -v 'featuresBootAsynchronous'
     ${csit_line} =    SSHKeywords.Execute_Command_Should_Pass    grep 'featuresBoot' "${cfg_newer}" | grep -v 'featuresBootAsynchronous'
+    ${karaf4_features} =    Extract_Karaf4_Boot_Features    ${csit_line}
+    # TODO: this works only if old odl is karaf3. Once old and new odl both are e.g. karaf4 this will create invalid line.
+    ${new_csit_line} =    CompareStream.Set_Variable_If_At_Least_Nitrogen    ${vanilla_line},${karaf4_features}    ${csit_line}
     # Replace the vanilla line.
-    SSHKeywords.Execute_Command_Should_Pass    sed -i 's/${vanilla_line}/${csit_line}/g' "${cfg_older}"
+    SSHKeywords.Execute_Command_Should_Pass    sed -i 's/${vanilla_line}/${new_csit_line}/g' "${cfg_older}"
     # Verify the replaced line.
     ${updated_line} =    SSHKeywords.Execute_Command_Should_Pass    grep 'featuresBoot' "${cfg_older}" | grep -v 'featuresBootAsynchronous'
     BuiltIn.Should_Not_Be_Equal    ${vanilla_line}    ${updated_line}
-    BuiltIn.Should_Be_Equal    ${csit_line}    ${updated_line}
+    BuiltIn.Should_Be_Equal    ${new_csit_line}    ${updated_line}
 
 Start_Older_Odl
     [Documentation]    Start older ODL on background.
@@ -153,3 +158,11 @@ Check_Restored_Data
     ...    This has to be a separate keyword, as it is run under WUKS.
     ${data_after} =    TemplatedRequests.Get_As_Json_Templated    folder=${CAR_VAR_DIR}    verify=False
     BuiltIn.Should_Be_Equal    ${data_before}    ${data_after}
+
+Extract_Karaf4_Boot_Features
+    [Arguments]    ${csit_line}
+    [Documentation]    Extract boot features. It is used for the 1st line of karaf4 featuresBoot parameter from org.apache.karaf.features.cfg.
+    ${bfeatures}    String.Replace_String    ${csit_line}    ${Space}    ${Empty}
+    ${bfeatures}    String.Replace_String    ${bfeatures}    featuresBoot=    ${Empty}
+    ${bfeatures}    String.Replace_String    ${bfeatures}    ,\\    ${Empty}
+    BuiltIn.Return_From_Keyword    ${bfeatures}