Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
82c7752
microshift specific tests
pmtk Mar 23, 2023
99693da
fast hello-microshift pod deletion
pmtk Mar 30, 2023
5f931d7
remove references to gcloud, expect some exported functions
pmtk Mar 30, 2023
3919930
update router & lb smoke tests
pmtk Mar 30, 2023
30d1f0f
don't use VARs which might override local env
pmtk Mar 30, 2023
9065200
greenboot
pmtk Mar 30, 2023
b4317ec
move busybox check script, other fixes
pmtk Mar 30, 2023
d67d0d3
fix IP var
pmtk Mar 31, 2023
e550e74
PS4 with time, firewall:: rework
pmtk Apr 1, 2023
75a816f
add cluster-debug-info to e2e
pmtk Apr 1, 2023
4ce8a6e
python test runner
pmtk Apr 1, 2023
5b738f6
change printing to satisfy older python?
pmtk Apr 1, 2023
2258e91
loadbalancer - fix port
pmtk Apr 1, 2023
9b92950
bring back bash test runner
pmtk Apr 3, 2023
1b995a6
move "inner" greenboot test to separate file
pmtk Apr 3, 2023
e4f8da7
fix inner greenboot test path
pmtk Apr 4, 2023
c94e5f1
don't duplicate files, move files back to orig loc
pmtk Apr 4, 2023
820db7d
cluster-debug-info.sh: use default kubeconfig if unset
pmtk Apr 4, 2023
2c2f932
use trap to remove kubeconfig
pmtk Apr 4, 2023
c5f8666
forward output to files
pmtk Apr 4, 2023
5b060da
smoke tests - don't fail, capture exit code
pmtk Apr 5, 2023
64d3a3d
health summary via ssh
pmtk Apr 5, 2023
44bd599
reuse list()
pmtk Apr 5, 2023
83bf1fb
e2e-reboot
pmtk Apr 5, 2023
f8be940
more bash sanity to router and lb tests
pmtk Apr 6, 2023
d0bc6fe
log duration of test itself and preparations
pmtk Apr 6, 2023
e531113
consistent top level var naming
pmtk Apr 6, 2023
3af9abd
reboot: allow for ssh exit 0 or 255
pmtk Apr 6, 2023
a72e23c
reboot: don't workaround pod security
pmtk Apr 6, 2023
4a7cc58
test-runner: change logs
pmtk Apr 6, 2023
1be578f
create output dir only on run
pmtk Apr 6, 2023
47dce1a
test runner: use different 'set's
pmtk Apr 6, 2023
afd53de
just warn about firewall::*_port funcs
pmtk Apr 6, 2023
7f2baf5
usage
pmtk Apr 6, 2023
1c60b7b
add ssh and sudo checks
pmtk Apr 6, 2023
0366f16
linter fixes
pmtk Apr 6, 2023
9e0dedc
remove timestamps when running greenboot check
pmtk Apr 6, 2023
a67a2be
'typo' :)
pmtk Apr 7, 2023
5903582
e2e in robot framework
pmtk Apr 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ _output/*
_output
sshfile
ansible/*.txt
**/.venv/
38 changes: 38 additions & 0 deletions e2e-robot/Makefile
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
27 changes: 27 additions & 0 deletions e2e-robot/requirements.txt
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
167 changes: 167 additions & 0 deletions e2e-robot/tests/microshift.robot
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
Copy link
Contributor

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 .robot file?

Copy link
Member Author

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 make inside e2e-robot, is e2e-robot/

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
Loading