Skip to content

Commit

Permalink
but renderer tests need to live here because we want to test the pack…
Browse files Browse the repository at this point in the history
…aged CLI
  • Loading branch information
pirog committed Oct 17, 2023
1 parent 39d953e commit a982fa6
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pr-runtime-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
leia-test:
- examples/appname
- examples/global
- examples/renderer
- examples/v3
- examples/v4
steps:
Expand Down
48 changes: 48 additions & 0 deletions examples/renderer/.lando.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: lando-renderer
services:
appserver:
api: 3
type: lando
healthcheck: healthcheck
services:
image: php:8.2-fpm
command: docker-php-entrypoint sleep infinity
volumes:
- "./healthcheck.sh:/usr/local/bin/healthcheck"
nginx:
api: 3
type: lando
healthcheck: healthcheck
services:
image: nginx:1.22.1
command: /docker-entrypoint.sh nginx -g "daemon off;"
ports:
- 80
volumes:
- ./:/usr/share/nginx/html
- "./healthcheck.sh:/usr/local/bin/healthcheck"
run_as_root:
- echo "$(id)" > /run_as_root.txt
- ln -snf /usr/share/zoneinfo/America/New_York /etc/localtime
- echo "America/New_York" > /etc/timezone
overrides:
environment:
THING: STUFF
volumes:
- "./test.txt:/var/www/test.txt"
database:
api: 3
type: lando
healthcheck: healthcheck
services:
image: mariadb:10.4
command: docker-entrypoint.sh mysqld
environment:
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: da
MARIADB_MYSQL_LOCALHOST_USER: da
MARIADB_DATABASE: test
MARIADB_USER: test
MARIADB_PASSWORD: test
MARIADB_AUTO_UPGRADE: da
volumes:
- "./healthcheck.sh:/usr/local/bin/healthcheck"
39 changes: 39 additions & 0 deletions examples/renderer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Renderer Example
================

This example exists primarily to test the fallback non-TTY list renderer.

Start up tests
--------------

Run the following commands to get up and running with this example.

```bash
# Should start up successfully
lando poweroff
lando start
```

Verification commands
---------------------

Run the following commands to validate things are rolling as they should.

```bash
# Should not error using the default renderer while packaged up
LANDO_RENDERER_FORCE=1 lando start

# Should use the verbose renderer in a non-TTY environment
lando start | grep "\[COMPLETED\]" | wc -l | grep 5
```

Destroy tests
-------------

Run the following commands to trash this app like nothing ever happened.

```bash
# Should be destroyed with success
lando destroy -y
lando poweroff
```
21 changes: 21 additions & 0 deletions examples/renderer/healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -eo pipefail

rm -rf /healthy

main () {
local healthfile=/tmp/healthfile

# if healthcheck file does not exist then create it
if [ ! -f $healthfile ]; then
touch $healthfile
fi
# append an X to the healthfile
echo -n "X" >> $healthfile
# run our "healthcheck"
cat $healthfile | grep -w "XXXXX" && rm -rf $healthfile
}

main

touch /healthy
2 changes: 2 additions & 0 deletions examples/renderer/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>HAND ME DOWN!</h1>
<h2>or don't</h2>

0 comments on commit a982fa6

Please sign in to comment.