-
Notifications
You must be signed in to change notification settings - Fork 223
WIP POC MicroShift e2e using robot framework #1635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
82c7752
microshift specific tests
pmtk 99693da
fast hello-microshift pod deletion
pmtk 5f931d7
remove references to gcloud, expect some exported functions
pmtk 3919930
update router & lb smoke tests
pmtk 30d1f0f
don't use VARs which might override local env
pmtk 9065200
greenboot
pmtk b4317ec
move busybox check script, other fixes
pmtk d67d0d3
fix IP var
pmtk e550e74
PS4 with time, firewall:: rework
pmtk 75a816f
add cluster-debug-info to e2e
pmtk 4ce8a6e
python test runner
pmtk 5b738f6
change printing to satisfy older python?
pmtk 2258e91
loadbalancer - fix port
pmtk 9b92950
bring back bash test runner
pmtk 1b995a6
move "inner" greenboot test to separate file
pmtk e4f8da7
fix inner greenboot test path
pmtk c94e5f1
don't duplicate files, move files back to orig loc
pmtk 820db7d
cluster-debug-info.sh: use default kubeconfig if unset
pmtk 2c2f932
use trap to remove kubeconfig
pmtk c5f8666
forward output to files
pmtk 5b060da
smoke tests - don't fail, capture exit code
pmtk 64d3a3d
health summary via ssh
pmtk 44bd599
reuse list()
pmtk 83bf1fb
e2e-reboot
pmtk f8be940
more bash sanity to router and lb tests
pmtk d0bc6fe
log duration of test itself and preparations
pmtk e531113
consistent top level var naming
pmtk 3af9abd
reboot: allow for ssh exit 0 or 255
pmtk a72e23c
reboot: don't workaround pod security
pmtk 4a7cc58
test-runner: change logs
pmtk 1be578f
create output dir only on run
pmtk 47dce1a
test runner: use different 'set's
pmtk afd53de
just warn about firewall::*_port funcs
pmtk 7f2baf5
usage
pmtk 1c60b7b
add ssh and sudo checks
pmtk 0366f16
linter fixes
pmtk 9e0dedc
remove timestamps when running greenboot check
pmtk a67a2be
'typo' :)
pmtk 5903582
e2e in robot framework
pmtk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -6,3 +6,4 @@ _output/* | |
| _output | ||
| sshfile | ||
| ansible/*.txt | ||
| **/.venv/ | ||
This file contains hidden or 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,38 @@ | ||
|
|
||
| .PHONY: setup dry-run with-filter with-tag all | ||
|
|
||
| setup: | ||
| python3 -m venv .venv && \ | ||
| .venv/bin/python3 -m pip install -r requirements.txt | ||
|
|
||
| dry-run: | ||
| .venv/bin/robot \ | ||
| --dryrun \ | ||
| --outputdir ../_output/e2e-$$(date +'%Y%m%d-%H%M%S') \ | ||
| ./tests/microshift.robot | ||
|
|
||
| with-filter: | ||
| .venv/bin/robot \ | ||
| -v USHIFT_IP:$${USHIFT_IP} \ | ||
| -v USHIFT_USER:microshift \ | ||
| --test *router* \ | ||
| --outputdir ../_output/e2e-$$(date +'%Y%m%d-%H%M%S') \ | ||
| -x xunit.xml \ | ||
| ./tests/microshift.robot | ||
|
|
||
| with-tag: | ||
| .venv/bin/robot \ | ||
| -v USHIFT_IP:$${USHIFT_IP} \ | ||
| -v USHIFT_USER:microshift \ | ||
| --include smoke \ | ||
| --outputdir ../_output/e2e-$$(date +'%Y%m%d-%H%M%S') \ | ||
| -x xunit.xml \ | ||
| ./tests/microshift.robot | ||
|
|
||
| all: | ||
| .venv/bin/robot \ | ||
| -v USHIFT_IP:$${USHIFT_IP} \ | ||
| -v USHIFT_USER:microshift \ | ||
| --outputdir ../_output/e2e-$$(date +'%Y%m%d-%H%M%S') \ | ||
| -x xunit.xml \ | ||
| ./tests/microshift.robot |
This file contains hidden or 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,27 @@ | ||
| bcrypt==4.0.1 | ||
| certifi==2022.12.7 | ||
| cffi==1.15.1 | ||
| charset-normalizer==3.1.0 | ||
| click==8.1.3 | ||
| colorama==0.4.6 | ||
| cryptography==40.0.1 | ||
| idna==3.4 | ||
| Jinja2==3.1.2 | ||
| markdown-it-py==2.2.0 | ||
| MarkupSafe==2.1.2 | ||
| mdurl==0.1.2 | ||
| paramiko==3.1.0 | ||
| pathspec==0.11.1 | ||
| pycparser==2.21 | ||
| Pygments==2.14.0 | ||
| PyNaCl==1.5.0 | ||
| requests==2.28.2 | ||
| rich==13.3.3 | ||
| rich-click==1.4 | ||
| robotframework==6.0.2 | ||
| robotframework-requests==0.9.4 | ||
| robotframework-sshlibrary==3.8.0 | ||
| robotframework-tidy==4.0.1 | ||
| scp==0.14.5 | ||
| tomli==2.0.1 | ||
| urllib3==1.26.15 |
This file contains hidden or 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,167 @@ | ||
| *** Settings *** | ||
| Documentation MicroShift e2e test suite | ||
|
|
||
| Library SSHLibrary | ||
| Library String | ||
| Library OperatingSystem | ||
| Library Process | ||
| Library RequestsLibrary | ||
|
|
||
| Suite Setup Get Kubeconfig | ||
| Suite Teardown Remove Kubeconfig | ||
|
|
||
|
|
||
| *** Variables *** | ||
| ${USHIFT_IP} ${EMPTY} | ||
| ${USHIFT_USER} ${EMPTY} | ||
|
|
||
|
|
||
| *** Test Cases *** | ||
| Router Smoke Test | ||
| [Documentation] Verify that Router correctly exposes HTTP service | ||
| [Tags] smoke | ||
| [Setup] Run Keywords | ||
| ... Create Hello MicroShift Pod AND | ||
| ... Expose Hello MicroShift Pod Via Router AND | ||
| ... Open Port 80 tcp | ||
|
|
||
| Wait Until Keyword Succeeds 3x 3s Access Hello Microshift via Router | ||
|
|
||
| [Teardown] Run Keywords | ||
| ... Delete Hello MicroShift Pod Route And Service AND | ||
| ... Close Port 80 tcp | ||
|
|
||
| Load Balancer Smoke Test | ||
| [Documentation] Verify that Load Balancer correctly exposes HTTP service | ||
| [Tags] smoke | ||
| [Setup] Run Keywords | ||
| ... Create Hello MicroShift Pod AND | ||
| ... Expose Hello MicroShift Pod Via LB AND | ||
| ... Open Port 5678 tcp | ||
|
|
||
| Wait Until Keyword Succeeds 3x 3s Access Hello Microshift via LB | ||
|
|
||
| [Teardown] Run Keywords | ||
| ... Delete Hello MicroShift Pod Route And Service AND | ||
| ... Close Port 5678 tcp | ||
|
|
||
| Reboot Test | ||
| [Documentation] Verify that MicroShift starts successfully after reboot | ||
| [Setup] Run Keywords Create Pod With PVC | ||
|
|
||
| Open Connection ${USHIFT_IP} | ||
| Login ${USHIFT_USER} allow_agent=True | ||
| Execute Command reboot now sudo=True | ||
| Close Connection | ||
|
|
||
| Sleep 15s | ||
|
|
||
| Open Connection ${USHIFT_IP} | ||
| Set Client Configuration timeout=600s | ||
| Wait Until Keyword Succeeds 10x 10s Login ${USHIFT_USER} allow_agent=True | ||
|
|
||
| Wait Until Keyword Succeeds | ||
| ... 10x | ||
| ... 10s | ||
| ... Execute Command | ||
| ... [ $(systemctl show -p SubState --value microshift) = "running" ] | ||
| ... timeout=10s return_stdout=True return_stderr=True | ||
|
|
||
| ${stdout} ${rc}= Execute Command | ||
| ... /etc/greenboot/check/required.d/40_microshift_running_check.sh | tee /tmp/asd.log | ||
| ... sudo=True | ||
| ... timeout=600s | ||
| ... return_stdout=True | ||
| ... return_rc=True | ||
| Log ${stdout} | ||
| Should Be Equal As Integers ${rc} 0 | ||
| Close Connection | ||
|
|
||
| Run With Kubeconfig oc wait --for=condition=Ready --timeout=120s pod/test-pod | ||
|
|
||
| [Teardown] Delete Pod With PVC | ||
|
|
||
| Failed Test | ||
| Fail Let's see how it looks in Prow | ||
|
|
||
|
|
||
| *** Keywords *** | ||
| Get Kubeconfig | ||
| [Documentation] X | ||
| Open Connection ${USHIFT_IP} | ||
| Login ${USHIFT_USER} allow_agent=True | ||
| ${konfig}= Execute Command | ||
| ... cat /var/lib/microshift/resources/kubeadmin/${USHIFT_IP}/kubeconfig | ||
| ... sudo=True | ||
| Should Not Be Empty ${konfig} | ||
| ${rand}= Generate Random String | ||
| ${path}= Join Path /tmp ${rand} | ||
| Create File ${path} ${konfig} | ||
| Close Connection | ||
| Set Suite Variable \${KUBECONFIG} ${path} | ||
|
|
||
| Remove Kubeconfig | ||
| Remove File ${KUBECONFIG} | ||
|
|
||
| Access Hello Microshift via Router | ||
| ${result}= Run Process | ||
| ... curl -i http://hello-microshift.cluster.local --resolve "hello-microshift.cluster.local:80:${USHIFT_IP}" | ||
| ... shell=True timeout=15s | ||
| Check HTTP Response ${result} | ||
|
|
||
| Access Hello Microshift via LB | ||
| ${result}= Run Process curl -i ${USHIFT_IP}:5678 shell=True timeout=15s | ||
| Check HTTP Response ${result} | ||
|
|
||
| Check HTTP Response | ||
| [Arguments] ${result} | ||
| Log ${result.stdout} | ||
| Log ${result.stderr} | ||
| Should Be Equal As Integers ${result.rc} 0 | ||
| Should Match Regexp ${result.stdout} HTTP.*200 | ||
| Should Match ${result.stdout} *Hello MicroShift* | ||
|
|
||
| Create Pod With PVC | ||
| Run With Kubeconfig oc create -f ../e2e/tests/assets/pod-with-pvc.yaml | ||
| Run With Kubeconfig oc wait --for=condition=Ready --timeout=120s pod/test-pod | ||
|
|
||
| Delete Pod With PVC | ||
| Run With Kubeconfig oc delete -f ../e2e/tests/assets/pod-with-pvc.yaml True | ||
|
|
||
| Create Hello MicroShift Pod | ||
| Run With Kubeconfig oc create -f ../e2e/tests/assets/hello-microshift.yaml | ||
| Run With Kubeconfig oc wait pods -l app\=hello-microshift --for condition\=Ready --timeout\=60s | ||
|
|
||
| Expose Hello MicroShift Pod Via Router | ||
| Run With Kubeconfig oc expose pod hello-microshift | ||
| Run With Kubeconfig oc expose svc hello-microshift --hostname hello-microshift.cluster.local | ||
|
|
||
| Expose Hello MicroShift Pod Via LB | ||
| Run With Kubeconfig oc create service loadbalancer hello-microshift --tcp=5678:8080 | ||
|
|
||
| Delete Hello MicroShift Pod Route And Service | ||
| Run With Kubeconfig oc delete route hello-microshift True | ||
| Run With Kubeconfig oc delete service hello-microshift True | ||
| Run With Kubeconfig oc delete -f ../e2e/tests/assets/hello-microshift.yaml True | ||
|
|
||
| Run With Kubeconfig | ||
| [Arguments] ${cmd} ${allow_fail}=False | ||
| ${result}= Run Process ${cmd} env:KUBECONFIG=${KUBECONFIG} stderr=STDOUT shell=True | ||
| Log ${result.stdout} | ||
| IF ${allow_fail} == False | ||
| Should Be Equal As Integers ${result.rc} 0 | ||
| END | ||
|
|
||
| Open Port | ||
| [Arguments] ${number} ${protocol} | ||
| ${res}= Run Process bash -c | ||
| ... if declare -F firewall::open_port; then firewall::open_port ${number} ${protocol}; fi stderr=STDOUT | ||
| Log ${res.stdout} | ||
| Should Be Equal As Integers ${res.rc} 0 | ||
|
|
||
| Close Port | ||
| [Arguments] ${number} ${protocol} | ||
| ${res}= Run Process bash -c | ||
| ... if declare -F firewall::close_port; then firewall::close_port ${number} ${protocol}; fi stderr=STDOUT | ||
| Log ${res.stdout} | ||
| Should Be Equal As Integers ${res.rc} 0 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these paths relative to the directory where someone runs robot, or to the location of the
.robotfile?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's relative to current working dir which, when running
makeinsidee2e-robot, ise2e-robot/