Skip to content

Commit

Permalink
e2e:httpd-example: Check data returned by webserver
Browse files Browse the repository at this point in the history
This commit adds a check for the data returned by the httpd webserver.
This is useful to be 100% sure we connect to our application webserver,
and not to an unrelated one which happened to be running at the address
we tried to connect to.
This is a bit more involved than expected as the clicumber machinery
apparently needs a \n at the end of the data returned by the webserver,
otherwise it thinks stdout was empty, and thus the checks for stdout
content fail.
I did not manage to add \n when using --from-literal, so I had to use a
separate file instead.
  • Loading branch information
cfergeau authored and praveenkumar committed Jun 16, 2022
1 parent 3a0cf44 commit c86b2d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/e2e/features/story_health.feature
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,23 @@ Feature: End-to-end health check
"""
And stdout should contain "You can add applications to this project with the 'new-app' command."

@darwin @linux @windows
@darwin @linux @windows @testdata
Scenario: Create and test app
When executing "oc create deployment httpd-example --image=registry.access.redhat.com/ubi8/httpd-24 --port=8080" succeeds
Then stdout should contain "deployment.apps/httpd-example created"
When executing "oc rollout status deployment httpd-example" succeeds
Then stdout should contain "successfully rolled out"
When executing "oc create configmap www-content --from-literal=index.html=" succeeds
When executing "oc create configmap www-content --from-file=index.html=httpd-example-index.html" succeeds
Then stdout should contain "configmap/www-content created"
When executing "oc set volume deployment/httpd-example --add --type configmap --configmap-name www-content --name www --mount-path /var/www/html" succeeds
Then stdout should contain "deployment.apps/httpd-example volume updated"
When executing "oc expose deployment httpd-example --port 8080" succeeds
Then stdout should contain "httpd-example exposed"
When executing "oc expose svc httpd-example" succeeds
Then stdout should contain "httpd-example exposed"
And with up to "20" retries with wait period of "5s" http response from "http://httpd-example-testproj.apps-crc.testing" has status code "200"
When with up to "20" retries with wait period of "5s" http response from "http://httpd-example-testproj.apps-crc.testing" has status code "200"
Then executing "curl -s http://httpd-example-testproj.apps-crc.testing" succeeds
And stdout should contain "Hello CRC!"

@darwin @linux @windows @startstop
Scenario: Stop and start CRC, then check app still runs
Expand All @@ -64,6 +66,8 @@ Feature: End-to-end health check
When starting CRC with default bundle succeeds
Then checking that CRC is running
And with up to "4" retries with wait period of "1m" http response from "http://httpd-example-testproj.apps-crc.testing" has status code "200"
Then executing "curl -s http://httpd-example-testproj.apps-crc.testing" succeeds
And stdout should contain "Hello CRC!"

@darwin @linux @windows
Scenario: Clean up project
Expand Down
2 changes: 2 additions & 0 deletions test/testdata/httpd-example-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Hello CRC!

0 comments on commit c86b2d8

Please sign in to comment.