|
| 1 | +*** Variables *** |
| 2 | + |
| 3 | +*** Test Cases *** |
| 4 | +TEST:Verify load command works and is idempotent |
| 5 | + # Create two api keys |
| 6 | + ${result}= Run st2 apikey create |
| 7 | + Log To Console \nCREATE APIKEY:\n |
| 8 | + Log To Console \nRESULT:\n: ${result} |
| 9 | + Should Contain ${result} key |
| 10 | + Should Contain ${result} created_at |
| 11 | + |
| 12 | + ${result}= Run st2 apikey create |
| 13 | + Log To Console \nCREATE APIKEY:\n |
| 14 | + Log To Console \nRESULT:\n: ${result} |
| 15 | + Should Contain ${result} key |
| 16 | + Should Contain ${result} created_at |
| 17 | + |
| 18 | + # Dump the keys and load them twice - operation should be idempotent and existing keys should be updated |
| 19 | + ${result}= Run st2 apikey list -d --show-secrets -j > /tmp/apikeys.json |
| 20 | + |
| 21 | + ${result}= Run st2 apikey list | wc -l |
| 22 | + Set Suite Variable ${APIKEY COUNT} ${result} |
| 23 | + Log To Console \nKEY LIST COUNT:\n |
| 24 | + Log To Console \nRESULT:\n |
| 25 | + Log To Console \n${result} |
| 26 | + |
| 27 | + ${result}= Run st2 apikey load /tmp/apikeys.json |
| 28 | + Log To Console \nRUN st2 apikey load:\n |
| 29 | + Log To Console \nRESULT:\n |
| 30 | + Log To Console \n${result} |
| 31 | + |
| 32 | + # Verify count is correct / same after load |
| 33 | + ${result}= Run st2 apikey list | wc -l |
| 34 | + Should Be Equal As Integers ${result} ${APIKEY COUNT} |
| 35 | + |
| 36 | + ${result}= Run st2 apikey load /tmp/apikeys.json |
| 37 | + Log To Console \nRUN st2 apikey load:\n |
| 38 | + Log To Console \nRESULT:\n |
| 39 | + Log To Console \n${result} |
| 40 | + |
| 41 | + # Verify count is correct / same after load |
| 42 | + ${result}= Run st2 apikey list | wc -l |
| 43 | + Should Be Equal As Integers ${result} ${APIKEY COUNT} |
| 44 | + |
| 45 | +*** Settings *** |
| 46 | +Library Process |
| 47 | +Library String |
| 48 | +Library OperatingSystem |
| 49 | +Resource ../common/keywords.robot |
0 commit comments