add shellspec golden harness for the legacy make engine

- spec/golden/cases.txt: 69 black-box cases (CLI wrapper mode and make
  include mode) run in a hermetic sandbox with a mocked docker
- spec/golden/expected/*.txt recorded from this engine (baseline)
- make test / test-golden / golden-record / lint dev targets
This commit is contained in:
Yann Autissier
2026-09-03 14:35:58 +02:00
parent e2e34d813e
commit 1d44a2ff32
102 changed files with 632 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
make -o docker-stack-config MAKE_OLDFILE=docker-stack-config ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-config STACK=myos APP_NAME=myos
docker --log-level=error compose --ansi=auto -f @MYOS@/stack/myos/networks.yml -p tester-myos-local config
[exit 0]
+3
View File
@@ -0,0 +1,3 @@
make -o docker-stack-down MAKE_OLDFILE=docker-stack-down ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-down STACK=myos APP_NAME=myos
docker --log-level=error compose --ansi=auto -f @MYOS@/stack/myos/networks.yml -p tester-myos-local down
[exit 0]
+2
View File
@@ -0,0 +1,2 @@
APP myos
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_FILE @MYOS@/stack/myos/networks.yml
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_PROJECT_NAME tester-myos-local
[exit 0]
@@ -0,0 +1,2 @@
DOCKER_REPOSITORY tester/myos/local
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_SERVICE_NAME tester-myos-local
[exit 0]
+2
View File
@@ -0,0 +1,2 @@
STACK myos
[exit 0]
+2
View File
@@ -0,0 +1,2 @@
docker --log-level=error compose --ansi=auto -f @MYOS@/stack/myos/networks.yml -p tester-myos-local run --rm app id
[exit 0]
+3
View File
@@ -0,0 +1,3 @@
make -o docker-stack-scale MAKE_OLDFILE=docker-stack-scale ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-scale STACK=myos APP_NAME=myos
docker --log-level=error compose --ansi=auto -f @MYOS@/stack/myos/networks.yml -p tester-myos-local up -d --scale app=2
[exit 0]
@@ -0,0 +1,5 @@
make -o docker-stack-up MAKE_OLDFILE=docker-stack-up ENV=master DOCKER_COMPOSE=docker --log-level=error compose docker-compose-up STACK=myos APP_NAME=myos
sh -c docker network create tester-master >/dev/null 2>&1
sh -c docker network create testhost >/dev/null 2>&1
docker --log-level=error compose --ansi=auto -f @MYOS@/stack/myos/networks.yml -p tester-myos-master up -d
[exit 0]
+5
View File
@@ -0,0 +1,5 @@
make -o docker-stack-up MAKE_OLDFILE=docker-stack-up ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-up STACK=myos APP_NAME=myos
sh -c docker network create tester-local >/dev/null 2>&1
sh -c docker network create testhost >/dev/null 2>&1
docker --log-level=error compose --ansi=auto -f @MYOS@/stack/myos/networks.yml -p tester-myos-local up -d
[exit 0]
@@ -0,0 +1,2 @@
ENV_VARS DOCKER_NETWORK_DEFAULT DOCKER_NETWORK_PRIVATE DOCKER_NETWORK_PUBLIC DRONE_SERVER_HOST DRONE_VERSION
[exit 0]
@@ -0,0 +1,2 @@
make/apps/common.mk:54: *** multiple target patterns. Stop.
[exit 2]
@@ -0,0 +1,5 @@
make -o docker-stack-up MAKE_OLDFILE=docker-stack-up ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-up STACK=default APP_NAME=default
sh -c docker network create tester-local >/dev/null 2>&1
sh -c docker network create testhost >/dev/null 2>&1
docker --log-level=error compose --ansi=auto -f @HOME@/.local/share/myos/stack/postgres/postgres.yml -f @HOME@/.local/share/myos/stack/postgres/postgres.local.yml -f @HOME@/.local/share/myos/stack/redis/redis.yml -f @MYOS@/stack/myos/networks.yml -p tester-default-local up -d
[exit 0]
@@ -0,0 +1,5 @@
make -o docker-stack-up MAKE_OLDFILE=docker-stack-up ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-up STACK=testing APP_NAME=testing
sh -c docker network create tester-local >/dev/null 2>&1
sh -c docker network create testhost >/dev/null 2>&1
docker --log-level=error compose --ansi=auto -f @HOME@/.local/share/myos/stack/drone/drone.yml -f @HOME@/.local/share/myos/stack/redis/redis.yml -f @MYOS@/stack/myos/networks.yml -p tester-testing-local up -d
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_FILE @HOME@/.local/share/myos/stack/drone/drone.yml @HOME@/.local/share/myos/stack/redis/redis.yml @MYOS@/stack/myos/networks.yml
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_PROJECT_NAME testhost
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_FILE @HOME@/.local/share/myos/stack/host/nginx.yml @HOME@/.local/share/myos/stack/host/nginx.www.yml @HOME@/.local/share/myos/stack/host/nginx.dns.yml @MYOS@/stack/myos/networks.yml @MYOS@/stack/myos/volumes.www.local.yml @MYOS@/stack/myos/volumes.dns.local.yml
[exit 0]
+2
View File
@@ -0,0 +1,2 @@
COMPOSE_FILE @HOME@/.local/share/myos/stack/host/nginx.yml @HOME@/.local/share/myos/stack/host/nginx.www.yml @MYOS@/stack/myos/networks.yml @MYOS@/stack/myos/volumes.www.local.yml
[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 @MYOS@/stack/myos/networks.yml
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_FILE @HOME@/.local/share/myos/stack/postgres/postgres.yml @MYOS@/stack/myos/networks.yml
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_PROJECT_NAME tester-myos-local
[exit 0]
+5
View File
@@ -0,0 +1,5 @@
make -o docker-stack-up MAKE_OLDFILE=docker-stack-up ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-up STACK=postgres APP_NAME=postgres
sh -c docker network create tester-local >/dev/null 2>&1
sh -c docker network create testhost >/dev/null 2>&1
docker --log-level=error compose --ansi=auto -f @HOME@/.local/share/myos/stack/postgres/postgres.yml -f @HOME@/.local/share/myos/stack/postgres/postgres.local.yml -f @MYOS@/stack/myos/networks.yml -p tester-postgres-local up -d
[exit 0]
@@ -0,0 +1,2 @@
make/apps/common.mk:54: *** multiple target patterns. Stop.
[exit 2]
@@ -0,0 +1,2 @@
COMPOSE_FILE @MYOS@/stack/myos/networks.yml
[exit 0]
@@ -0,0 +1,2 @@
WARNING: myos[0] doesnotexist-rule-exists: target doesnotexist unavailable in app myos
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_FILE @HOME@/.local/share/myos/stack/User/User.yml @MYOS@/stack/myos/networks.yml
[exit 0]
@@ -0,0 +1,2 @@
DOCKER_NETWORK tester
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_PROJECT_NAME tester-example-test
[exit 0]
+3
View File
@@ -0,0 +1,3 @@
make -o docker-stack-config MAKE_OLDFILE=docker-stack-config ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-config STACK=host/fabio APP_NAME=host
docker --log-level=error compose --ansi=auto -f @WD@/stack/host/fabio.yml -f @MYOS@/stack/myos/networks.yml -p testhost config
[exit 0]
+3
View File
@@ -0,0 +1,3 @@
make -o docker-stack-down MAKE_OLDFILE=docker-stack-down ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-down STACK=host APP_NAME=host
docker --log-level=error compose --ansi=auto -f @WD@/stack/host/consul.yml -f @WD@/stack/host/fabio.yml -f @WD@/stack/host/registrator.yml -f @MYOS@/stack/myos/networks.yml -p testhost down
[exit 0]
+2
View File
@@ -0,0 +1,2 @@
COMPOSE_FILE @WD@/stack/host/consul.yml @MYOS@/stack/myos/networks.yml
[exit 0]
+5
View File
@@ -0,0 +1,5 @@
docker --log-level=error compose --ansi=auto -f @WD@/stack/host/consul.yml -f @MYOS@/stack/myos/networks.yml -p testhost exec -T consul sh -c consul members
/bin/bash: -c: line 0: syntax error near unexpected token `||'
/bin/bash: -c: line 0: `|| true'
make: *** [exec] Error 2
[exit 2]
+3
View File
@@ -0,0 +1,3 @@
make -o docker-stack-logs MAKE_OLDFILE=docker-stack-logs ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-logs STACK=host/consul APP_NAME=host
docker --log-level=error compose --ansi=auto -f @WD@/stack/host/consul.yml -f @MYOS@/stack/myos/networks.yml -p testhost logs --follow --tail=100
[exit 0]
+2
View File
@@ -0,0 +1,2 @@
APP myos
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_FILE @WD@/stack/host/consul.yml @MYOS@/stack/myos/networks.yml
[exit 0]
@@ -0,0 +1,2 @@
ENV_VARS DOCKER_NETWORK_DEFAULT DOCKER_NETWORK_PRIVATE DOCKER_NETWORK_PUBLIC DRONE_SERVER_HOST HOST_COMPOSE_PROJECT_NAME HOST_CONSUL_HTTP_TOKEN
[exit 0]
@@ -0,0 +1,2 @@
HOST_STACK host
[exit 0]
@@ -0,0 +1,2 @@
DOCKER_NETWORK_DEFAULT _testhost
[exit 0]
@@ -0,0 +1,2 @@
DOCKER_NETWORK_PRIVATE tester-local
[exit 0]
@@ -0,0 +1,2 @@
DOCKER_NETWORK_PUBLIC testhost
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_PROJECT_NAME testhost
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_PROJECT_NAME testhost
[exit 0]
@@ -0,0 +1,2 @@
STACK_DIR @MYOS@/stack @HOME@/.local/share/myos/stack @WD@/stack
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_FILE_SUFFIX app labels networks ssh volumes
[exit 0]
+3
View File
@@ -0,0 +1,3 @@
make -o docker-stack-ps MAKE_OLDFILE=docker-stack-ps ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-ps STACK=host/consul APP_NAME=host
docker --log-level=error compose --ansi=auto -f @WD@/stack/host/consul.yml -f @MYOS@/stack/myos/networks.yml -p testhost ps
[exit 0]
@@ -0,0 +1,4 @@
make -o stack-host-config MAKE_OLDFILE=stack-host-config ENV=local DOCKER_COMPOSE=docker --log-level=error compose COMPOSE_IGNORE_ORPHANS=true host=host/consul host/fabio host/registrator config STACK=host
make -o stack-host-config MAKE_OLDFILE=stack-host-config ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-config STACK=host APP_NAME=host
docker --log-level=error compose --ansi=auto -f @WD@/stack/host/consul.yml -f @WD@/stack/host/fabio.yml -f @WD@/stack/host/registrator.yml -f @MYOS@/stack/myos/networks.yml -p testhost config
[exit 0]
+14
View File
@@ -0,0 +1,14 @@
make -o host MAKE_OLDFILE=host ENV=local DOCKER_COMPOSE=docker --log-level=error compose up STACK=host/consul host/fabio host/registrator
make -o host MAKE_OLDFILE=host ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-up STACK=host/consul APP_NAME=host
sh -c docker network create tester-local >/dev/null 2>&1
sh -c docker network create testhost >/dev/null 2>&1
docker --log-level=error compose --ansi=auto -f @WD@/stack/host/consul.yml -f @MYOS@/stack/myos/networks.yml -p testhost up -d
make -o host MAKE_OLDFILE=host ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-up STACK=host/fabio APP_NAME=host
sh -c docker network create tester-local >/dev/null 2>&1
sh -c docker network create testhost >/dev/null 2>&1
docker --log-level=error compose --ansi=auto -f @WD@/stack/host/fabio.yml -f @MYOS@/stack/myos/networks.yml -p testhost up -d
make -o host MAKE_OLDFILE=host ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-up STACK=host/registrator APP_NAME=host
sh -c docker network create tester-local >/dev/null 2>&1
sh -c docker network create testhost >/dev/null 2>&1
docker --log-level=error compose --ansi=auto -f @WD@/stack/host/registrator.yml -f @MYOS@/stack/myos/networks.yml -p testhost up -d
[exit 0]
+5
View File
@@ -0,0 +1,5 @@
make -o docker-stack-up MAKE_OLDFILE=docker-stack-up ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-up STACK=host/consul APP_NAME=host
sh -c docker network create tester-local >/dev/null 2>&1
sh -c docker network create testhost >/dev/null 2>&1
docker --log-level=error compose --ansi=auto -f @WD@/stack/host/consul.yml -f @MYOS@/stack/myos/networks.yml -p testhost up -d
[exit 0]
+5
View File
@@ -0,0 +1,5 @@
make -o docker-stack-up MAKE_OLDFILE=docker-stack-up ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-up STACK=host APP_NAME=host
sh -c docker network create tester-local >/dev/null 2>&1
sh -c docker network create testhost >/dev/null 2>&1
docker --log-level=error compose --ansi=auto -f @WD@/stack/host/consul.yml -f @WD@/stack/host/fabio.yml -f @WD@/stack/host/registrator.yml -f @MYOS@/stack/myos/networks.yml -p testhost up -d
[exit 0]
+9
View File
@@ -0,0 +1,9 @@
make -o docker-stack-up MAKE_OLDFILE=docker-stack-up ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-up STACK=host/consul APP_NAME=host
sh -c docker network create tester-local >/dev/null 2>&1
sh -c docker network create testhost >/dev/null 2>&1
docker --log-level=error compose --ansi=auto -f @WD@/stack/host/consul.yml -f @WD@/stack/host/fabio.yml -f @MYOS@/stack/myos/networks.yml -p testhost up -d
make -o docker-stack-up MAKE_OLDFILE=docker-stack-up ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-up STACK=host/fabio APP_NAME=host
sh -c docker network create tester-local >/dev/null 2>&1
sh -c docker network create testhost >/dev/null 2>&1
docker --log-level=error compose --ansi=auto -f @WD@/stack/host/consul.yml -f @WD@/stack/host/fabio.yml -f @MYOS@/stack/myos/networks.yml -p testhost up -d
[exit 0]
+3
View File
@@ -0,0 +1,3 @@
make -o docker-stack-config MAKE_OLDFILE=docker-stack-config ENV=local DOCKER_COMPOSE=docker --log-level=error compose app-wd-config
docker --log-level=error compose --ansi=auto -f ././docker-compose.yml -f ././docker-compose.local.yml -f ./docker/docker-compose.yml -p tester-wd-local config
[exit 0]
+3
View File
@@ -0,0 +1,3 @@
make -o docker-stack-down MAKE_OLDFILE=docker-stack-down ENV=local DOCKER_COMPOSE=docker --log-level=error compose app-wd-down
docker --log-level=error compose --ansi=auto -f ././docker-compose.yml -f ././docker-compose.local.yml -f ./docker/docker-compose.yml -p tester-wd-local down
[exit 0]
@@ -0,0 +1,2 @@
APP wd
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_FILE ./docker-compose.yml ./docker-compose.local.yml docker/docker-compose.yml
[exit 0]
@@ -0,0 +1,2 @@
ENV_VARS DOCKER_NETWORK_DEFAULT DOCKER_NETWORK_PRIVATE DOCKER_NETWORK_PUBLIC DRONE_SERVER_HOST
[exit 0]
@@ -0,0 +1,2 @@
DOCKER_NETWORK_DEFAULT _tester-wd-local
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_PROJECT_NAME tester-wd-local
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_SERVICE_NAME tester-wd-local
[exit 0]
+3
View File
@@ -0,0 +1,3 @@
make -o docker-stack-ps MAKE_OLDFILE=docker-stack-ps ENV=local DOCKER_COMPOSE=docker --log-level=error compose app-wd-ps
docker --log-level=error compose --ansi=auto -f ././docker-compose.yml -f ././docker-compose.local.yml -f ./docker/docker-compose.yml -p tester-wd-local ps
[exit 0]
@@ -0,0 +1,5 @@
make -o docker-stack-up MAKE_OLDFILE=docker-stack-up ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-up STACK=postgres APP_NAME=postgres
sh -c docker network create tester-local >/dev/null 2>&1
sh -c docker network create testhost >/dev/null 2>&1
docker --log-level=error compose --ansi=auto -f ./docker-compose.yml -f ./docker-compose.local.yml -f docker/docker-compose.yml -p tester-postgres-local up -d
[exit 0]
@@ -0,0 +1,2 @@
WARNING: wd[0] doesnotexist-rule-exists: target doesnotexist unavailable in app wd
[exit 0]
@@ -0,0 +1,3 @@
make -o docker-stack-up MAKE_OLDFILE=docker-stack-up ENV=master DOCKER_COMPOSE=docker --log-level=error compose app-wd-up
docker --log-level=error compose --ansi=auto -f ././docker-compose.yml -f ./docker/docker-compose.yml -p tester-wd-master up -d
[exit 0]
+3
View File
@@ -0,0 +1,3 @@
make -o docker-stack-up MAKE_OLDFILE=docker-stack-up ENV=local DOCKER_COMPOSE=docker --log-level=error compose app-wd-up
docker --log-level=error compose --ansi=auto -f ././docker-compose.yml -f ././docker-compose.local.yml -f ./docker/docker-compose.yml -p tester-wd-local up -d
[exit 0]
+52
View File
@@ -0,0 +1,52 @@
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 c411 dsh myos wbr wbr.old
BRANCH lightning
VERSION legacy-1.0-beta
RELEASE
COMPOSE_FILE @MYOS@/stack/myos/networks.yml
DOCKER_REPOSITORY tester/myos/local
[exit 0]
+2
View File
@@ -0,0 +1,2 @@
APP myos
[exit 0]
@@ -0,0 +1,2 @@
COMPOSE_PROJECT_NAME tester-myos-local
[exit 0]
+5
View File
@@ -0,0 +1,5 @@
make -o docker-stack-up MAKE_OLDFILE=docker-stack-up ENV=local DOCKER_COMPOSE=docker --log-level=error compose docker-compose-up STACK=myos APP_NAME=myos
sh -c docker network create tester-local >/dev/null 2>&1
sh -c docker network create testhost >/dev/null 2>&1
docker --log-level=error compose --ansi=auto -f @MYOS@/stack/myos/networks.yml -p tester-myos-local up -d
[exit 0]