run the golden suite against the CLI too, and pin every delta
Both engines now go through the same 68 cases. 31 produce byte-identical output; the rest have a recorded CLI expectation and a reason in DELTAS.md, the bulk of it being that the CLI does not shell out to a recursive make and calls compose once per project. Fixed while comparing: the CLI was missing the COMPOSE_FILE_* defaults, so overlays such as supabase.labels.yml would not have been loaded at all.
This commit is contained in:
+27
-2
@@ -1,8 +1,33 @@
|
||||
# Intentional differences between the legacy make engine and the bash CLI
|
||||
|
||||
Golden expectations in `expected/` are recorded from the legacy engine
|
||||
(`git tag legacy-1.0-beta`). When the CLI intentionally behaves differently,
|
||||
the case gets an override in `expected.cli/<case>.txt` and a line here.
|
||||
(git tag `legacy-1.0-beta`). When the CLI intentionally behaves differently the
|
||||
case gets an override in `expected.cli/<case>.txt` and a line here.
|
||||
`make test-golden MYOS_ENGINE=cli` checks the CLI against those overrides.
|
||||
|
||||
## Shape of the output
|
||||
|
||||
| what | legacy | cli |
|
||||
|---|---|---|
|
||||
| sub-make line | every command is preceded by the recursive `make ... docker-compose-up STACK=...` it re-enters | no recursion, so no such line |
|
||||
| compose invocation | `docker --log-level=error compose --ansi=auto -f ... -p ...` | `docker compose -f ... -p ... --project-directory <dir of the first file>` |
|
||||
| several stacks in one project | one `docker compose up` per stack, each with the full file list, so N stacks meant N identical calls | a single call per project |
|
||||
| network creation | `sh -c docker network create <n> >/dev/null 2>&1` on every up | `docker network create <n>`, only when the network is missing |
|
||||
| unknown command | prints a warning and exits 0 | prints an error and exits 2 |
|
||||
| unknown stack | silently resolves to nothing and exits 0 | exits 3 with the search path |
|
||||
|
||||
## Values
|
||||
|
||||
| what | legacy | cli | why |
|
||||
|---|---|---|---|
|
||||
| `APP` in wrapper mode | `myos`, the framework directory itself | the stack, or the directory being run | the legacy value described the framework, not the thing being deployed. The real `up` path already passed `APP_NAME=<stack>` to its sub-make, so the CLI matches what actually ran; only the `print-` target disagreed. |
|
||||
| `COMPOSE_PROJECT_NAME` for a catalogue stack in wrapper mode | `<user>-myos-<env>` for every stack | `<user>-<env>-<stack>` | same reason: two different stacks shared one project name when printed, but not when run |
|
||||
| `COMPOSE_PROJECT_NAME` default order | `<user>-<app>-<env>` | `<user>-<env>-<app>` | environments are shared across apps, so the environment reads better in the middle. `MYOS_PROJECT_FORMAT=user-app-env` restores the old order and is what `myos migrate pin` writes into existing deployments. |
|
||||
| compose files of the current directory | ignored in wrapper mode: only a `STACK` was ever loaded | loaded, as a stack named after the directory | this is the point of unifying the two modes |
|
||||
| overlay order for several suffixes | the order the `COMPOSE_FILE_*` variables happened to be declared in | sorted by suffix name | a compose overlay wins over the ones before it, so the order has to be predictable rather than depend on where a variable was set |
|
||||
| framework overlays | `stack/myos/*.yml` | `share/compose/*.yml` | the catalogue moved to myos-stacks; these files stay with the framework |
|
||||
|
||||
## Tag helpers
|
||||
|
||||
| case | delta | why |
|
||||
|---|---|---|
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
# name | fixture | args
|
||||
#
|
||||
# `help` is deliberately absent: it renders the comments of the Makefile, so it
|
||||
# would break on every edit to a dev target rather than on a change of behaviour.
|
||||
host-print-project | host-project | print-COMPOSE_PROJECT_NAME STACK=host/consul
|
||||
host-print-compose-file | host-project | print-COMPOSE_FILE STACK=host/consul
|
||||
host-print-stack-dir | host-project | print-STACK_DIR STACK=host/consul
|
||||
@@ -54,7 +57,6 @@ cat-nginx-www-dns | app-nogit | print-COMPOSE_FILE STACK=host/
|
||||
cat-nginx-project | app-nogit | print-COMPOSE_PROJECT_NAME STACK=host/nginx
|
||||
cat-unknown-stack | app-nogit | print-COMPOSE_FILE STACK=doesnotexist
|
||||
cat-unknown-target | app-nogit | doesnotexist
|
||||
misc-help | app-nogit | help
|
||||
inc-app-print-project | app-git | @make print-COMPOSE_PROJECT_NAME
|
||||
inc-app-print-compose-file | app-git | @make print-COMPOSE_FILE
|
||||
inc-app-print-app | app-git | @make print-APP
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
docker compose -f @WD@/docker-compose.yml -f @WD@/docker-compose.local.yml -f @WD@/docker/docker-compose.yml -f @MYOS@/share/compose/networks.yml -p tester-wd-local --project-directory @WD@ config
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
docker compose -f @WD@/docker-compose.yml -f @WD@/docker-compose.local.yml -f @WD@/docker/docker-compose.yml -f @MYOS@/share/compose/networks.yml -p tester-wd-local --project-directory @WD@ down
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
APP wd
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
COMPOSE_FILE @WD@/docker-compose.yml @WD@/docker-compose.local.yml @WD@/docker/docker-compose.yml @MYOS@/share/compose/networks.yml
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
COMPOSE_PROJECT_NAME tester-wd-local
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
DOCKER_REPOSITORY tester/wd/local
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
COMPOSE_SERVICE_NAME tester-wd-local
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
STACK ./
|
||||
[exit 0]
|
||||
@@ -0,0 +1,26 @@
|
||||
ERROR: unknown command: run
|
||||
Usage: myos [options] <command> [stack...] [VAR=value...] [-- args...]
|
||||
|
||||
Options:
|
||||
-C DIR work in DIR instead of the current directory
|
||||
-e ENV environment (default: local, or ENV from the config)
|
||||
-H HOSTS run on remote hosts instead (comma separated, or "all")
|
||||
-n, --dry-run print the commands instead of running them
|
||||
-v, --verbose show what myos does
|
||||
-d, --debug show every command
|
||||
-h, --help this help
|
||||
|
||||
Commands:
|
||||
up down start stop restart recreate manage the containers of a stack
|
||||
ps logs config exec run inspect and enter them
|
||||
ls [--groups] list the stacks myos can see
|
||||
env [VAR...] show resolved variables
|
||||
doctor check the installation
|
||||
version print the myos version
|
||||
|
||||
Stacks:
|
||||
myos up the stack of the current directory
|
||||
myos up host a group, expanded from host=... in a .env or .mk
|
||||
myos up host/fabio a single stack
|
||||
myos up postgres:9.6 a versioned stack
|
||||
[exit 2]
|
||||
@@ -0,0 +1,26 @@
|
||||
ERROR: unknown command: scale
|
||||
Usage: myos [options] <command> [stack...] [VAR=value...] [-- args...]
|
||||
|
||||
Options:
|
||||
-C DIR work in DIR instead of the current directory
|
||||
-e ENV environment (default: local, or ENV from the config)
|
||||
-H HOSTS run on remote hosts instead (comma separated, or "all")
|
||||
-n, --dry-run print the commands instead of running them
|
||||
-v, --verbose show what myos does
|
||||
-d, --debug show every command
|
||||
-h, --help this help
|
||||
|
||||
Commands:
|
||||
up down start stop restart recreate manage the containers of a stack
|
||||
ps logs config exec run inspect and enter them
|
||||
ls [--groups] list the stacks myos can see
|
||||
env [VAR...] show resolved variables
|
||||
doctor check the installation
|
||||
version print the myos version
|
||||
|
||||
Stacks:
|
||||
myos up the stack of the current directory
|
||||
myos up host a group, expanded from host=... in a .env or .mk
|
||||
myos up host/fabio a single stack
|
||||
myos up postgres:9.6 a versioned stack
|
||||
[exit 2]
|
||||
@@ -0,0 +1,4 @@
|
||||
docker network create tester-master
|
||||
docker network create testhost
|
||||
docker compose -f @WD@/docker-compose.yml -f @WD@/docker/docker-compose.yml -f @MYOS@/share/compose/networks.yml -p tester-wd-master --project-directory @WD@ up -d
|
||||
[exit 0]
|
||||
@@ -0,0 +1,4 @@
|
||||
docker network create tester-local
|
||||
docker network create testhost
|
||||
docker compose -f @WD@/docker-compose.yml -f @WD@/docker-compose.local.yml -f @WD@/docker/docker-compose.yml -f @MYOS@/share/compose/networks.yml -p tester-wd-local --project-directory @WD@ up -d
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
ENV_VARS
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
COMPOSE_FILE @HOME@/.local/share/myos/stack/drone/drone.yml @HOME@/.local/share/myos/stack/drone/drone.1.6.yml @MYOS@/share/compose/networks.yml
|
||||
[exit 0]
|
||||
@@ -0,0 +1,7 @@
|
||||
docker network create tester-local
|
||||
docker network create testhost
|
||||
docker compose -f @HOME@/.local/share/myos/stack/postgres/postgres.yml -f @HOME@/.local/share/myos/stack/postgres/postgres.local.yml -f @MYOS@/share/compose/networks.yml -p tester-postgres-local --project-directory @HOME@/.local/share/myos/stack/postgres up -d
|
||||
docker network create tester-local
|
||||
docker network create testhost
|
||||
docker compose -f @HOME@/.local/share/myos/stack/redis/redis.yml -f @MYOS@/share/compose/networks.yml -p tester-redis-local --project-directory @HOME@/.local/share/myos/stack/redis up -d
|
||||
[exit 0]
|
||||
@@ -0,0 +1,7 @@
|
||||
docker network create tester-local
|
||||
docker network create testhost
|
||||
docker compose -f @HOME@/.local/share/myos/stack/drone/drone.yml -f @MYOS@/share/compose/networks.yml -p tester-drone-local --project-directory @HOME@/.local/share/myos/stack/drone up -d
|
||||
docker network create tester-local
|
||||
docker network create testhost
|
||||
docker compose -f @HOME@/.local/share/myos/stack/redis/redis.yml -f @MYOS@/share/compose/networks.yml -p tester-redis-local --project-directory @HOME@/.local/share/myos/stack/redis up -d
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
COMPOSE_FILE @HOME@/.local/share/myos/stack/host/nginx.yml @HOME@/.local/share/myos/stack/host/nginx.dns.yml @HOME@/.local/share/myos/stack/host/nginx.www.yml @MYOS@/share/compose/networks.yml @MYOS@/share/compose/volumes.dns.local.yml @MYOS@/share/compose/volumes.www.local.yml
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
COMPOSE_PROJECT_NAME tester-postgres-local
|
||||
[exit 0]
|
||||
@@ -0,0 +1,4 @@
|
||||
docker network create tester-local
|
||||
docker network create testhost
|
||||
docker compose -f @HOME@/.local/share/myos/stack/postgres/postgres.yml -f @HOME@/.local/share/myos/stack/postgres/postgres.local.yml -f @MYOS@/share/compose/networks.yml -p tester-postgres-local --project-directory @HOME@/.local/share/myos/stack/postgres up -d
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
COMPOSE_FILE @HOME@/.local/share/myos/stack/postgres/postgres.yml @HOME@/.local/share/myos/stack/postgres/postgres.local.yml @HOME@/.local/share/myos/stack/postgres/postgres.9.6.yml @MYOS@/share/compose/networks.yml
|
||||
[exit 0]
|
||||
@@ -0,0 +1,26 @@
|
||||
ERROR: unknown command: doesnotexist
|
||||
Usage: myos [options] <command> [stack...] [VAR=value...] [-- args...]
|
||||
|
||||
Options:
|
||||
-C DIR work in DIR instead of the current directory
|
||||
-e ENV environment (default: local, or ENV from the config)
|
||||
-H HOSTS run on remote hosts instead (comma separated, or "all")
|
||||
-n, --dry-run print the commands instead of running them
|
||||
-v, --verbose show what myos does
|
||||
-d, --debug show every command
|
||||
-h, --help this help
|
||||
|
||||
Commands:
|
||||
up down start stop restart recreate manage the containers of a stack
|
||||
ps logs config exec run inspect and enter them
|
||||
ls [--groups] list the stacks myos can see
|
||||
env [VAR...] show resolved variables
|
||||
doctor check the installation
|
||||
version print the myos version
|
||||
|
||||
Stacks:
|
||||
myos up the stack of the current directory
|
||||
myos up host a group, expanded from host=... in a .env or .mk
|
||||
myos up host/fabio a single stack
|
||||
myos up postgres:9.6 a versioned stack
|
||||
[exit 2]
|
||||
@@ -0,0 +1,2 @@
|
||||
docker compose -f @WD@/stack/host/fabio.yml -f @MYOS@/share/compose/networks.yml -p testhost --project-directory @WD@/stack/host config
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
docker compose -f @WD@/stack/host/consul.yml -f @WD@/stack/host/fabio.yml -f @WD@/stack/host/registrator.yml -f @MYOS@/share/compose/networks.yml -p testhost --project-directory @WD@/stack/host down
|
||||
[exit 0]
|
||||
@@ -0,0 +1,26 @@
|
||||
ERROR: unknown command: exec
|
||||
Usage: myos [options] <command> [stack...] [VAR=value...] [-- args...]
|
||||
|
||||
Options:
|
||||
-C DIR work in DIR instead of the current directory
|
||||
-e ENV environment (default: local, or ENV from the config)
|
||||
-H HOSTS run on remote hosts instead (comma separated, or "all")
|
||||
-n, --dry-run print the commands instead of running them
|
||||
-v, --verbose show what myos does
|
||||
-d, --debug show every command
|
||||
-h, --help this help
|
||||
|
||||
Commands:
|
||||
up down start stop restart recreate manage the containers of a stack
|
||||
ps logs config exec run inspect and enter them
|
||||
ls [--groups] list the stacks myos can see
|
||||
env [VAR...] show resolved variables
|
||||
doctor check the installation
|
||||
version print the myos version
|
||||
|
||||
Stacks:
|
||||
myos up the stack of the current directory
|
||||
myos up host a group, expanded from host=... in a .env or .mk
|
||||
myos up host/fabio a single stack
|
||||
myos up postgres:9.6 a versioned stack
|
||||
[exit 2]
|
||||
@@ -0,0 +1,2 @@
|
||||
docker compose -f @WD@/stack/host/consul.yml -f @MYOS@/share/compose/networks.yml -p testhost --project-directory @WD@/stack/host logs --follow --tail=100
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
APP consul
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
ENV_VARS
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
STACK_DIR
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
docker compose -f @WD@/stack/host/consul.yml -f @MYOS@/share/compose/networks.yml -p testhost --project-directory @WD@/stack/host ps
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
docker compose -f @WD@/stack/host/consul.yml -f @WD@/stack/host/fabio.yml -f @WD@/stack/host/registrator.yml -f @MYOS@/share/compose/networks.yml -p testhost --project-directory @WD@/stack/host config
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
ERROR: no stack given, and no compose file in @WD@
|
||||
[exit 2]
|
||||
@@ -0,0 +1,4 @@
|
||||
docker network create tester-local
|
||||
docker network create testhost
|
||||
docker compose -f @WD@/stack/host/consul.yml -f @MYOS@/share/compose/networks.yml -p testhost --project-directory @WD@/stack/host up -d
|
||||
[exit 0]
|
||||
@@ -0,0 +1,4 @@
|
||||
docker network create tester-local
|
||||
docker network create testhost
|
||||
docker compose -f @WD@/stack/host/consul.yml -f @WD@/stack/host/fabio.yml -f @WD@/stack/host/registrator.yml -f @MYOS@/share/compose/networks.yml -p testhost --project-directory @WD@/stack/host up -d
|
||||
[exit 0]
|
||||
@@ -0,0 +1,4 @@
|
||||
docker network create tester-local
|
||||
docker network create testhost
|
||||
docker compose -f @WD@/stack/host/consul.yml -f @WD@/stack/host/fabio.yml -f @MYOS@/share/compose/networks.yml -p testhost --project-directory @WD@/stack/host up -d
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
APP wd
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
COMPOSE_PROJECT_NAME tester-wd-local
|
||||
[exit 0]
|
||||
@@ -0,0 +1,4 @@
|
||||
docker network create tester-local
|
||||
docker network create testhost
|
||||
docker compose -f @WD@/docker-compose.yml -f @MYOS@/share/compose/networks.yml -p tester-wd-local --project-directory @WD@ up -d
|
||||
[exit 0]
|
||||
@@ -1,52 +0,0 @@
|
||||
Usage:
|
||||
make [target]
|
||||
|
||||
Targets:
|
||||
test Run unit + golden tests
|
||||
test-unit Run unit tests only
|
||||
test-golden Run golden tests only (MYOS_ENGINE=legacy|cli)
|
||||
test-integration Run tests needing a real docker daemon
|
||||
golden-record Re-record golden expectations from the legacy engine
|
||||
lint shellcheck all shell sources
|
||||
help This help
|
||||
attach Attach to docker SERVICE
|
||||
bootstrap Configure system
|
||||
build Build application docker images
|
||||
clean Clean application and docker stuffs
|
||||
config View application docker compose file
|
||||
connect Connect to docker SERVICE
|
||||
deploy Deploy application dockers
|
||||
down Remove application dockers
|
||||
exec Exec command in docker SERVICE
|
||||
install Install application
|
||||
logs Display application dockers logs
|
||||
rebuild Rebuild application dockers images
|
||||
reinstall Reinstall application
|
||||
release Create release VERSION
|
||||
restart Restart application
|
||||
run Run a command in a new docker
|
||||
scale Scale SERVICE application to NUM dockers
|
||||
shutdown Shutdown all dockers
|
||||
start Start application dockers
|
||||
stop Stop application dockers
|
||||
tests Test application
|
||||
up Create application dockers
|
||||
update Update application files
|
||||
upgrade Upgrade application
|
||||
ssh Connect to first remote host
|
||||
|
||||
Context:
|
||||
ENV local
|
||||
ENV_PATH @WD@
|
||||
DOCKER_MACHINE x86_64
|
||||
DOCKER_SOCKET_LOCATION /var/run/docker.sock
|
||||
DOCKER_SYSTEM Linux
|
||||
DOMAIN example.test
|
||||
APP myos
|
||||
APPS @APPS@
|
||||
BRANCH @BRANCH@
|
||||
VERSION @VERSION@
|
||||
RELEASE
|
||||
COMPOSE_FILE @MYOS@/share/compose/networks.yml
|
||||
DOCKER_REPOSITORY tester/myos/local
|
||||
[exit 0]
|
||||
@@ -3,6 +3,7 @@
|
||||
# Usage: spec/golden/record.sh [case-name ...]
|
||||
set -u
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
# shellcheck source=spec/support/run.sh
|
||||
. "$here/../support/run.sh"
|
||||
MYOS_ROOT=${MYOS_ROOT:-$(cd "$here/../.." && pwd)}
|
||||
only="$*"
|
||||
|
||||
Reference in New Issue
Block a user