Merge remote-tracking branch 'origin/master' into cn
* origin/master: (333 commits) chore(deps): bump gunicorn in /tests/apps/dockerfile-release chore(deps): bump importlib-metadata in /docs/_build chore(deps): bump soupsieve from 4.0.1 to 4.1 in /docs/_build chore(deps): bump gunicorn from 26.2.0 to 27.0.0 in /tests/apps/multi chore(deps): bump gunicorn in /tests/apps/python-flask chore: bump pack to 0.40.11 chore(deps): bump pymdown-extensions from 12.3 to 13.0 in /docs/_build chore(deps): bump rack chore(deps): bump sass from 1.108.0 to 1.108.1 in /tests/apps/multi chore(deps): bump mkdocs-material from 9.8.0 to 9.8.1 in /docs/_build chore(deps): bump click from 8.5.0 to 8.5.1 in /docs/_build chore(deps): bump github.com/dokku/dokku-datastore in /plugins/datastore chore(deps): bump golang.org/x/sync in /plugins/common chore(deps): bump sass from 1.107.1 to 1.108.0 in /tests/apps/multi chore(deps): update markdown requirement in /docs/_build chore(deps): bump watchdog from 7.0.0 to 7.1.0 in /docs/_build chore(deps): bump soupsieve from 3.0.4 to 4.0.1 in /docs/_build chore(deps): bump traefik in /plugins/traefik-vhosts fix: build plugins/common on windows chore: bump herokuish to 0.11.25 ... # Conflicts: # common.mk # contrib/dependencies.json
This commit is contained in:
commit
bb12ba0d8b
572 files changed
+25866
-4926
No files matched your search
Generated
+58
-94
@@ -28,18 +28,18 @@
|
||||
}
|
||||
},
|
||||
"node_modules/body-parser": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.3.0.tgz",
|
||||
"integrity": "sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw==",
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.4.0.tgz",
|
||||
"integrity": "sha512-Ifk1KcLrxaGt1occQagQNFNNOqRt1LFuehEnHHzB8Z6cRgIxRU1TBaiIsUiCdA+gy5PL7Y1IX31DNKkRmxtXjQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bytes": "^3.1.2",
|
||||
"content-type": "^2.0.0",
|
||||
"content-type": "^2.1.0",
|
||||
"debug": "^4.4.3",
|
||||
"http-errors": "^2.0.1",
|
||||
"iconv-lite": "^0.7.2",
|
||||
"iconv-lite": "^0.7.3",
|
||||
"on-finished": "^2.4.1",
|
||||
"qs": "^6.15.2",
|
||||
"qs": "^6.16.1",
|
||||
"raw-body": "^3.0.2",
|
||||
"type-is": "^2.1.0"
|
||||
},
|
||||
@@ -51,19 +51,6 @@
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/body-parser/node_modules/content-type": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-2.0.0.tgz",
|
||||
"integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/bytes": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
||||
@@ -103,24 +90,29 @@
|
||||
}
|
||||
},
|
||||
"node_modules/content-disposition": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.0.tgz",
|
||||
"integrity": "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==",
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-2.0.1.tgz",
|
||||
"integrity": "sha512-e+H0ZXHSWYrENhQzw1LPuP4oF5MzVKmDU6d3hxlvaPEYLLg62MxtQNPRx4SYSuYJSBUgnQIG4HIN2tEtNv7Dog==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safe-buffer": "5.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/content-type": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
|
||||
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz",
|
||||
"integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie": {
|
||||
@@ -214,9 +206,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/es-object-atoms": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
|
||||
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz",
|
||||
"integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0"
|
||||
@@ -241,15 +233,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/express": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz",
|
||||
"integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==",
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-5.3.0.tgz",
|
||||
"integrity": "sha512-qCqy1xSoaugxOD4IVHb1ZWdkvCF2W3aE2okKouWj8VwJ+ztskSiXoBnCSJqfKT+cVPJhuJqe9YLbY425+Zh00g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"accepts": "^2.0.0",
|
||||
"body-parser": "^2.2.1",
|
||||
"content-disposition": "^1.0.0",
|
||||
"content-type": "^1.0.5",
|
||||
"body-parser": "^2.3.0",
|
||||
"content-disposition": "^2.0.1",
|
||||
"content-type": "^2.0.0",
|
||||
"cookie": "^0.7.1",
|
||||
"cookie-signature": "^1.2.1",
|
||||
"debug": "^4.4.0",
|
||||
@@ -265,14 +257,14 @@
|
||||
"on-finished": "^2.4.1",
|
||||
"once": "^1.4.0",
|
||||
"parseurl": "^1.3.3",
|
||||
"proxy-addr": "^2.0.7",
|
||||
"qs": "^6.14.0",
|
||||
"proxy-addr": "^2.0.8",
|
||||
"qs": "^6.16.0",
|
||||
"range-parser": "^1.2.1",
|
||||
"router": "^2.2.0",
|
||||
"send": "^1.1.0",
|
||||
"serve-static": "^2.2.0",
|
||||
"statuses": "^2.0.1",
|
||||
"type-is": "^2.0.1",
|
||||
"type-is": "^2.1.0",
|
||||
"vary": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
@@ -389,9 +381,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/hasown": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
||||
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
|
||||
"integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
@@ -576,9 +568,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/proxy-addr": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
||||
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
|
||||
"version": "2.0.8",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz",
|
||||
"integrity": "sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"forwarded": "0.2.0",
|
||||
@@ -586,15 +578,20 @@
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.15.2",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.15.2.tgz",
|
||||
"integrity": "sha512-Rzq0KEyX/w/tEybncDgdkZrJgVUsUMk3xjh3t5bv3S1HTAtg+uOYt72+ZfwiQwKdysThkTBdL/rTi6HDmX9Ddw==",
|
||||
"version": "6.17.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.17.0.tgz",
|
||||
"integrity": "sha512-5LK5BZ2XDHMvcUJaf0CQ5HL3aVgKbpklvByC7qLSxYkfE8COEEbJg5xCHWCTqzqi0Gs4Jn5Mv5v3R38W6edscA==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"side-channel": "^1.1.0"
|
||||
"es-define-property": "^1.0.1",
|
||||
"side-channel": "^1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
@@ -643,26 +640,6 @@
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
@@ -713,14 +690,14 @@
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/side-channel": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
|
||||
"integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz",
|
||||
"integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"object-inspect": "^1.13.3",
|
||||
"side-channel-list": "^1.0.0",
|
||||
"object-inspect": "^1.13.4",
|
||||
"side-channel-list": "^1.0.1",
|
||||
"side-channel-map": "^1.0.1",
|
||||
"side-channel-weakmap": "^1.0.2"
|
||||
},
|
||||
@@ -732,13 +709,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-list": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz",
|
||||
"integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
|
||||
"integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"object-inspect": "^1.13.3"
|
||||
"object-inspect": "^1.13.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
@@ -820,19 +797,6 @@
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/type-is/node_modules/content-type": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-2.0.0.tgz",
|
||||
"integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "node-example",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"express": "5.2.x"
|
||||
"express": "5.3.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.2.x"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM ruby:4.0.6
|
||||
FROM ruby:4.0.9
|
||||
|
||||
RUN mkdir /app
|
||||
WORKDIR /app
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "node-example",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"express": "5.2.x"
|
||||
"express": "5.3.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.2.x"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "node-example",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"express": "5.2.x"
|
||||
"express": "5.3.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.2.x"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM python:3.15.0rc1-bookworm
|
||||
FROM python:3.15.0-bookworm
|
||||
|
||||
RUN pip install --user pipenv
|
||||
ENV PATH="${PATH}:/root/.local/bin"
|
||||
|
||||
+84
-101
@@ -18,11 +18,11 @@
|
||||
"default": {
|
||||
"asgiref": {
|
||||
"hashes": [
|
||||
"sha256:59dcb51c272ad209d59bed5708a64a333083e86017d7fcdd67498eeab7784340",
|
||||
"sha256:fe386d1c2bff7259ea95929266d12a8cf9a8b5a1c2598402967d8792e7a7c094"
|
||||
"sha256:034cc8cbf72d00553b4be256703ac545120b4e50af13b49dec99da899aeeecb4",
|
||||
"sha256:f9596a2434512686473d50f96ff6207fbba49ae1a785dfac614df4aeb085674d"
|
||||
],
|
||||
"markers": "python_version >= '3.10'",
|
||||
"version": "==3.12.1"
|
||||
"markers": "python_version >= '3.11'",
|
||||
"version": "==3.13.0"
|
||||
},
|
||||
"dj-database-url": {
|
||||
"hashes": [
|
||||
@@ -35,30 +35,30 @@
|
||||
},
|
||||
"django": {
|
||||
"hashes": [
|
||||
"sha256:9d4d93be539a18ab80d058eb515900e10951e04c537c5a6b394fc49528d3251f",
|
||||
"sha256:f04fb3b36ee119e1af4fa1d397d5fd6cf12700f49321e84d4f4c642c5b1973db"
|
||||
"sha256:5965d974a5218a2b68a11dd1276434707f23886525c23f0598eccedaf4f4ca00",
|
||||
"sha256:ad03d8abc51dbff95ebf34b27123cf0c26a3b62db7ba0cd520783686362533d1"
|
||||
],
|
||||
"index": "pypi",
|
||||
"markers": "python_version >= '3.10'",
|
||||
"version": "==5.2.17"
|
||||
"version": "==5.2.19"
|
||||
},
|
||||
"djangorestframework": {
|
||||
"hashes": [
|
||||
"sha256:2323a5111837e0b784dcb8323abc78ecc54fa2a5af7aff2677cf50cdd849477f",
|
||||
"sha256:381fc44d3249c9565c5f723850855b734e99030eb30957a49f506d3fe11d7dcb"
|
||||
"sha256:446a9b352e7eff630421ab3f2328bd2401b109a9470afa4a31189994911ed030",
|
||||
"sha256:8544bb674846731b1e3c9b309236ee1dc412905a0aa725be2ec193ca950a7d12"
|
||||
],
|
||||
"index": "pypi",
|
||||
"markers": "python_version >= '3.10'",
|
||||
"version": "==3.18.0"
|
||||
"version": "==3.18.3"
|
||||
},
|
||||
"gunicorn": {
|
||||
"hashes": [
|
||||
"sha256:1413d777bf99d31ebeb08acd354b01f1ecc44db0aa7b811ae7b86c669232e4f7",
|
||||
"sha256:9f45bcddec5e9dc7a25a3bdccb0c6832f11fd5d4739b1ee36c8d2fec25f1dc86"
|
||||
"sha256:1380f2f520abc3beb9e72cd2e728bd2d08a19b3ff6ac03ebd8da71d1798a4008",
|
||||
"sha256:88d52e7c60b3af07bc8db431fbb450a94780f2cbe7c420c7cf1891392661c591"
|
||||
],
|
||||
"index": "pypi",
|
||||
"markers": "python_version >= '3.10'",
|
||||
"version": "==26.1.0"
|
||||
"version": "==27.0.0"
|
||||
},
|
||||
"packaging": {
|
||||
"hashes": [
|
||||
@@ -70,102 +70,85 @@
|
||||
},
|
||||
"psycopg2-binary": {
|
||||
"hashes": [
|
||||
"sha256:00814e40fa23c2b37ef0a1e3c749d89982c73a9cb5046137f0752a22d432e82f",
|
||||
"sha256:049366c6d884bdcd65d66e6ca1fdbebe670b56c6c9ba46f164e6667e90881964",
|
||||
"sha256:0dc9228d47c46bda253d2ecd6bb93b56a9f2d7ad33b684a1fa3622bf74ffe30c",
|
||||
"sha256:1006fb62f0f0bc5ce256a832356c6262e91be43f5e4eb15b5eaf38079464caf2",
|
||||
"sha256:127467c6e476dd876634f17c3d870530e73ff454ff99bff73d36e80af28e1115",
|
||||
"sha256:1c8ad4c08e00f7679559eaed7aff1edfffc60c086b976f93972f686384a95e2c",
|
||||
"sha256:29d4d134bd0ab46ffb04e94aa3c5fa3ef582e9026609165e2f758ff76fc3a3be",
|
||||
"sha256:3471336e1acfd9c7fe507b8bad5af9317b6a89294f9eb37bd9a030bb7bebcdc6",
|
||||
"sha256:36512911ebb2b60a0c3e44d0bb5048c1980aced91235d133b7874f3d1d93487c",
|
||||
"sha256:398fcd4db988c7d7d3713e2b8e18939776fd3fb447052daae4f24fa39daede4c",
|
||||
"sha256:3d999bd982a723113c1a45b55a7a6a90d64d0ed2278020ed625c490ff7bef96c",
|
||||
"sha256:40e7b28b63aaf737cb3a1edc3a9bbc9a9f4ad3dcb7152e8c1130e4050eddcb7d",
|
||||
"sha256:411e85815652d13560fbe731878daa5d92378c4995a22302071890ec3397d019",
|
||||
"sha256:4413d0caef93c5cf50b96863df4c2efe8c269bf2267df353225595e7e15e8df7",
|
||||
"sha256:4766ab678563054d3f1d064a4db19cc4b5f9e3a8d9018592a8285cf200c248f3",
|
||||
"sha256:4dfcf8e45ebb0c663be34a3442f65e17311f3367089cd4e5e3a3e8e62c978777",
|
||||
"sha256:527e6342b3e44c2f0544f6b8e927d60de7f163f5723b8f1dfa7d2a84298738cd",
|
||||
"sha256:54a0dfecab1b48731f934e06139dfe11e24219fb6d0ceb32177cf0375f14c7b5",
|
||||
"sha256:5a0253224780c978746cb9be55a946bcdaf40fe3519c0f622924cdabdafe2c39",
|
||||
"sha256:5ac9444edc768c02a6b6a591f070b8aae28ff3a99be57560ac996001580f294c",
|
||||
"sha256:5c7cb4cbf894a1d36c720d713de507952c7c58f66d30834708f03dbe5c822ccf",
|
||||
"sha256:5c8ce6c61bd1b1f6b9c24ee32211599f6166af2c55abb19456090a21fd16554b",
|
||||
"sha256:5cdc05117180c5fa9c40eea8ea559ce64d73824c39d928b7da9fb5f6a9392433",
|
||||
"sha256:612b965daee295ae2da8f8218ce1d274645dc76ef3f1abf6a0a94fd57eff876d",
|
||||
"sha256:63a3ebbd543d3d1eda088ac99164e8c5bac15293ee91f20281fd17d050aee1c4",
|
||||
"sha256:66a7685d7e548f10fb4ce32fb01a7b7f4aa702134de92a292c7bd9e0d3dbd290",
|
||||
"sha256:6f3b3de8a74ef8db215f22edffb19e32dc6fa41340456de7ec99efdc8a7b3ec2",
|
||||
"sha256:6f9cae1f848779b5b01f417e762c40d026ea93eb0648249a604728cda991dde3",
|
||||
"sha256:718e1fc18edf573b02cb8aea868de8d8d33f99ce9620206aa9144b67b0985e94",
|
||||
"sha256:77b348775efd4cdab410ec6609d81ccecd1139c90265fa583a7255c8064bc03d",
|
||||
"sha256:7af18183109e23502c8b2ae7f6926c0882766f35b5175a4cd737ad825e4d7a1b",
|
||||
"sha256:7c729a73c7b1b84de3582f73cdd27d905121dc2c531f3d9a3c32a3011033b965",
|
||||
"sha256:83946ba43979ebfdc99a3cd0ee775c89f221df026984ba19d46133d8d75d3cd9",
|
||||
"sha256:840066105706cd2eb29b9a1c2329620056582a4bf3e8169dec5c447042d0869f",
|
||||
"sha256:863f5d12241ebe1c76a72a04c2113b6dc905f90b9cef0e9be0efd994affd9354",
|
||||
"sha256:864c261b3690e1207d14bbfe0a61e27567981b80c47a778561e49f676f7ce433",
|
||||
"sha256:89d19a9f7899e8eb0656a2b3a08e0da04c720a06db6e0033eab5928aabe60fa9",
|
||||
"sha256:8ffdb59fe88f99589e34354a130217aa1fd2d615612402d6edc8b3dbc7a44463",
|
||||
"sha256:96937c9c5d891f772430f418a7a8b4691a90c3e6b93cf72b5bd7cad8cbca32a5",
|
||||
"sha256:98062447aebc20ed20add1f547a364fd0ef8933640d5372ff1873f8deb9b61be",
|
||||
"sha256:995ce929eede89db6254b50827e2b7fd61e50d11f0b116b29fffe4a2e53c4580",
|
||||
"sha256:9b818ceff717f98851a64bffd4c5eb5b3059ae280276dcecc52ac658dcf006a4",
|
||||
"sha256:9fe06d93e72f1c048e731a2e3e7854a5bfaa58fc736068df90b352cefe66f03f",
|
||||
"sha256:a46fe069b65255df410f856d842bc235f90e22ffdf532dda625fd4213d3fd9b1",
|
||||
"sha256:a7e39a65b7d2a20e4ba2e0aaad1960b61cc2888d6ab047769f8347bd3c9ad915",
|
||||
"sha256:a99eaab34a9010f1a086b126de467466620a750634d114d20455f3a824aae033",
|
||||
"sha256:ab29414b25dcb698bf26bf213e3348abdcd07bbd5de032a5bec15bd75b298b03",
|
||||
"sha256:ace94261f43850e9e79f6c56636c5e0147978ab79eda5e5e5ebf13ae146fc8fe",
|
||||
"sha256:b4a9eaa6e7f4ff91bec10aa3fb296878e75187bced5cc4bafe17dc40915e1326",
|
||||
"sha256:b6937f5fe4e180aeee87de907a2fa982ded6f7f15d7218f78a083e4e1d68f2a0",
|
||||
"sha256:b9a339b79d37c1b45f3235265f07cdeb0cb5ad7acd2ac7720a5920989c17c24e",
|
||||
"sha256:ba3df2fc42a1cfa45b72cf096d4acb2b885937eedc61461081d53538d4a82a86",
|
||||
"sha256:c41321a14dd74aceb6a9a643b9253a334521babfa763fa873e33d89cfa122fb5",
|
||||
"sha256:c5ee5213445dd45312459029b8c4c0a695461eb517b753d2582315bd07995f5e",
|
||||
"sha256:c6528cefc8e50fcc6f4a107e27a672058b36cc5736d665476aeb413ba88dbb06",
|
||||
"sha256:cb4a1dacdd48077150dc762a9e5ddbf32c256d66cb46f80839391aa458774936",
|
||||
"sha256:cfa2517c94ea3af6deb46f81e1bbd884faa63e28481eb2f889989dd8d95e5f03",
|
||||
"sha256:d2fa0d7caca8635c56e373055094eeda3208d901d55dd0ff5abc1d4e47f82b56",
|
||||
"sha256:d3227a3bc228c10d21011a99245edca923e4e8bf461857e869a507d9a41fe9f6",
|
||||
"sha256:d6fcbba8c9fed08a73b8ac61ea79e4821e45b1e92bb466230c5e746bbf3d5256",
|
||||
"sha256:e4e184b1fb6072bf05388aa41c697e1b2d01b3473f107e7ec44f186a32cfd0b8",
|
||||
"sha256:ee2d84ef5eb6c04702d2e9c372ad557fb027f26a5d82804f749dfb14c7fdd2ab",
|
||||
"sha256:f12ae41fcafadb39b2785e64a40f9db05d6de2ac114077457e0e7c597f3af980",
|
||||
"sha256:f625abb7020e4af3432d95342daa1aa0db3fa369eed19807aa596367ba791b10",
|
||||
"sha256:f921f3cd87035ef7df233383011d7a53ea1d346224752c1385f1edfd790ceb6a",
|
||||
"sha256:fb1828cf3da68f99e45ebce1355d65d2d12b6a78fb5dfb16247aad6bdef5f5d2",
|
||||
"sha256:ffdd7dc5463ccd61845ac37b7012d0f35a1548df9febe14f8dd549be4a0bc81e"
|
||||
],
|
||||
"index": "pypi",
|
||||
"markers": "python_version >= '3.9'",
|
||||
"version": "==2.9.12"
|
||||
},
|
||||
"pytz": {
|
||||
"hashes": [
|
||||
"sha256:1d8ce29db189191fb55338ee6d0387d82ab59f3d00eac103412d64e0ebd0c588",
|
||||
"sha256:a151b3abb88eda1d4e34a9814df37de2a80e301e68ba0fd856fb9b46bfbbbffb"
|
||||
],
|
||||
"version": "==2023.3"
|
||||
},
|
||||
"setuptools": {
|
||||
"hashes": [
|
||||
"sha256:025bccbbf0fa05b6192bc64ae1e7b16e001fd6d6d4d5de03c97b1c1ade523bef",
|
||||
"sha256:29b23c360f22f414dc7336bb39178cc7bcbf6021ed2733cde173f09dba19abb3"
|
||||
"sha256:0405dd4d97720e7ab177aa02e493f524907c4cb3c445ac173e2627948d3d0528",
|
||||
"sha256:0463c00f946517f3e69192a59e6601e023ff9de45ad0a875eda3d6b1bebeb7ce",
|
||||
"sha256:07b7bd9f410650c34c3532162cc329f112368d78a3fc8668cb1ea9df61bc11bf",
|
||||
"sha256:086659ab083119f7ee87a779e31b94211cf162b708fc9a6bec771f75c73ac3e6",
|
||||
"sha256:08d3b81a6a91775c937abf97d4c58fc9142e8e35fb91c387d24f81d15c98e6cf",
|
||||
"sha256:0a6444ac48e2c04f691c2ddd542b38ba30c89463a2d446b3d74ec7d8fc90c964",
|
||||
"sha256:0ebcf3c4266a695df9d0ef51296155f60c86ac51cf82f0d0dd2e827255a891c5",
|
||||
"sha256:13d955f6054a705a19554364fe9888d0a6e8b0746dc7ebc08a447c7b4fd4145c",
|
||||
"sha256:1752b9821f1377404d65ac43af03d59a1eccc57fb2c1eb8305f9a3fe8eb7a8ba",
|
||||
"sha256:190c18b97d9ef72f2e88c451b6588af90d6bd7bf54cb94b963280dc86a2c7076",
|
||||
"sha256:1f4c7bdbafdf9dc018efbc29213b73f8308332888ba76a4cf503f560bfd21705",
|
||||
"sha256:202dedd5cadb3e5dfd4d0415ab2fc5d5b44f4208de5308938e3e74ae222b638e",
|
||||
"sha256:215777c62ce81c3b487cefdb6a41969944eb982309f91349ff3ca0323d6f17ed",
|
||||
"sha256:27e539b4cafd5e03dcd32921db1b12dd72fe549dd06bae6d4d2a5b5838465f24",
|
||||
"sha256:28eb30bf4a52c1117406f45771038faa96f882fdeeeb0ce43b960a1dbc6c1fd2",
|
||||
"sha256:2bf9f97a6df69a5d89d054b8cf5257a0916096c479800715fbfe7974dbcb3a26",
|
||||
"sha256:2ca263643ae37998ae04d18e431df34d0d61f12b47640dab585f14b6dbe00798",
|
||||
"sha256:31db6cba66df5231dfd91d9f69188bec3fe6c8baae384e93a0ce792067ee2d98",
|
||||
"sha256:32cd049095135d2b69e824aea9056745a4aaaa9115a9febbc65584793665d0d0",
|
||||
"sha256:33a6d3c47f9655b481b2cdc1b4bf71c235e054e55663d3066036b6ce5fbe5165",
|
||||
"sha256:376ebf7d8aee4b7386b2bac31fdc27911e7e57cd0a88f1e038b8b149398ac008",
|
||||
"sha256:38397def2d794ffde9db80f63d6820253e61b17483112652a318355f51a56f50",
|
||||
"sha256:3aea95340825f5ff236e7b40f0b5602c2c77a1e95943f71fae34909834043d29",
|
||||
"sha256:3dc3372b3731b3ef23407fe06b94f640ef87a2bda242fa386033d5589c87514a",
|
||||
"sha256:3e60b06ec7f9dc3e5f1106d12706514b6d6b92c3dc438fcdf4e43e65cc660d1b",
|
||||
"sha256:3f699a5225094a5c61402984e2fc1eca20e940223e76767c88189efb0c313f69",
|
||||
"sha256:41c2eb569ebd0e1b02d30d361a46932923b193fe1b5e641fb4d547c75e218955",
|
||||
"sha256:4c0214c7da18a28d108aa7108c8a3cca8035c7911ec97ef9ec0827569c9a2720",
|
||||
"sha256:4d66bfd44a46eb88cff0287929a4193fb45166b6c1f84bb1b233cc17ece0813c",
|
||||
"sha256:4e55357d1943673d491bbabb171c891704fc6a22441fea539e05a5c27a79ea3c",
|
||||
"sha256:4ff0f575cbb14f30445858dcfdd751e043486f5290915df78a9818bc74042eff",
|
||||
"sha256:5085f7ff7b1e890f279577cedeb8c628957869a340fa34a39f7f406500b3c916",
|
||||
"sha256:541a487a9ccd72b5e38f37f27b0ce78cb7eb3e336e7b5277d45463010c03a7a8",
|
||||
"sha256:562fe2a43b30e781848dce63d9080c15414c777c96df348c4342558338cc7bf3",
|
||||
"sha256:5d89e064bb12b40cad696cf4975e6da86f8c60f14cd06cb6c1bc0a7f5d01761f",
|
||||
"sha256:5f04ae99c9fbb94c3197ec88599ed7db921f6adcddfe83687a74c7ead4037c22",
|
||||
"sha256:691da68ae5dd7c3ac77514357d35ece7b1ba8b5f3e6c92735198aa6159c355c8",
|
||||
"sha256:6e696297891b56ff0115f0665de6ad774e1e301e4f60745b8d5024001ae7c2f6",
|
||||
"sha256:6ede8595767e19d30a7e8a84a7d47bfde6176d45d194fed08dbb68d1584a780b",
|
||||
"sha256:70d091f5c3a6177fac50c0da20181ce0e0c053f1e43c872d5f75bd6d9429c020",
|
||||
"sha256:7e2405196a8cfe6cd3e54172a54452dcf85c241eaf2e9dde7190d7469f7f5ef7",
|
||||
"sha256:81404c37e0344ebcf10aac127d33d35137e5dbab1daf9f3deee46188fd5879c2",
|
||||
"sha256:81682c227cc1849c4a6adf7b85274229073bb4c9d6ad5697222c695dcea5a8a7",
|
||||
"sha256:8cb734989420c18ca1b71a82da880e11988f5ff3fcdaadd669161de3e98794ac",
|
||||
"sha256:930e7e58b33a4f9c39e7532d7a40147925cf3372baed4229cbebe0cf3ba9ce6b",
|
||||
"sha256:aa37089795bd9701576edc2eb5849ce77a439eda9dfdfa47857449332cfa5292",
|
||||
"sha256:b6ae51708201f501a171b02419d0c30878a743c369c9054eb1289f0f8d5979e2",
|
||||
"sha256:c00ebe9a2f31151aade0db233dc1446513a95e92c39ce055ee097af0ae86be1c",
|
||||
"sha256:c24c98fe1a113db287dfb1958771eafca97b7db812f23b7897c2a12b6b904c22",
|
||||
"sha256:c519e406287085f43aa0d3061936edf1ba51286093532f215315c6ab8ba92c3b",
|
||||
"sha256:d19aec88857d2a52f99eefcefdbbb45921fb2f777bee5186a355a23d9cf8a0b9",
|
||||
"sha256:d2fc9342aad969b9a28490a4c3eaba94b35beb2d26e9a39b31d1430378aa71b2",
|
||||
"sha256:d79530b4c1af657d5620a1d21b8e39f2996aa06821d5564d05b22d6b8cd413d0",
|
||||
"sha256:db31cf7f617a51625f1473d8a66fc35dac159af8b28e80bc014ed3ee994a9fbf",
|
||||
"sha256:dddfe650e7dda464d676c27fbedb5061f1ad05e1604627f54c770d7f799d36e9",
|
||||
"sha256:dde942b46ce20f6c4464cdf551f3293207f803f4e4354454eb1f5599c3eb1fa1",
|
||||
"sha256:dff5c70ed9789ccb0d97ff4a7da51dc523a255c4ec95df188fa5d44adcae4ea8",
|
||||
"sha256:e324ecf60f952d21dd11413b8bbed0951bbd99579a06fd06f28bfc37737cd373",
|
||||
"sha256:e3861eba31f8ea8663fd876166b032fd89179e42aa63764d6feb281f13f9eb60",
|
||||
"sha256:f04ada42bcd537adbaf8b7f3140237a204e452a88d0c1831cfce69f7d2e59f4e",
|
||||
"sha256:f124954a32640dfb5c000d33028f48053930d7ff226bc74cde5fb316f9c6fcb6",
|
||||
"sha256:f28b5f2fa8154d0d97e97a664136f58d1639ca008d45d6e09e69fff24826abee",
|
||||
"sha256:f3088eb80f58ed933c62d87128741d31e786edc862e23266d3c286763d646de0",
|
||||
"sha256:f47f23db2d70db39cfb714b64fd5df76595b51b2ec0a669710a78f2dceb0c3f8",
|
||||
"sha256:f4cdfe41149dcc5583a3b7a2f0ad433f75bb3afd1c7a7332e63df89b05e34666",
|
||||
"sha256:f818161d2302b3b3e9c75d5a1d0a5c5679e92e45cfec6432b9d5432dde5ff1f1",
|
||||
"sha256:feb7b1856f6ca805cc0e08739858f6cdfed8ce903390126af30343c62899a389"
|
||||
],
|
||||
"index": "pypi",
|
||||
"markers": "python_version >= '3.10'",
|
||||
"version": "==83.0.0"
|
||||
"version": "==2.9.13"
|
||||
},
|
||||
"sqlparse": {
|
||||
"hashes": [
|
||||
"sha256:113c35c75365ab9cc9c7231d68c6428fb11c085fc8e9eb1ad659b7ddbf6cd2b9",
|
||||
"sha256:b861c0288ce2fa56209a9a6412d2e066ac664b3873b89c26c9d8415e8e32996f"
|
||||
"sha256:3be5a72d04c873d690d7c6dedd33d6fae2ef82759881ceec02fc2efd0cba564f",
|
||||
"sha256:ca722573f848ff2d30e40ea30f53a104b7dea7635ea9285891263eb2c58fb6e7"
|
||||
],
|
||||
"index": "pypi",
|
||||
"markers": "python_version >= '3.10'",
|
||||
"version": "==0.6.0"
|
||||
"version": "==0.6.1"
|
||||
},
|
||||
"whitenoise": {
|
||||
"hashes": [
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "node-example",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"express": "~5.2.1"
|
||||
"express": "~5.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.2.x"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.26.6
|
||||
FROM golang:1.27.3
|
||||
|
||||
EXPOSE 3000/tcp
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.26.6
|
||||
FROM golang:1.27.3
|
||||
|
||||
EXPOSE 3000/tcp
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.26.6
|
||||
FROM golang:1.27.3
|
||||
|
||||
RUN mkdir /app
|
||||
WORKDIR /app
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
module github.com/dokku/dokko/tests/apps/gorpc
|
||||
|
||||
go 1.26.2
|
||||
|
||||
require (
|
||||
golang.org/x/net v0.55.0 // indirect
|
||||
golang.org/x/sys v0.45.0 // indirect
|
||||
golang.org/x/text v0.37.0 // indirect
|
||||
google.golang.org/grpc v1.83.0
|
||||
)
|
||||
go 1.27.1
|
||||
|
||||
require (
|
||||
google.golang.org/grpc v1.85.0
|
||||
google.golang.org/grpc/examples v0.0.0-20240118175532-987df1309236
|
||||
google.golang.org/protobuf v1.36.12
|
||||
)
|
||||
|
||||
require google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect
|
||||
require (
|
||||
golang.org/x/net v0.60.0 // indirect
|
||||
golang.org/x/sys v0.48.0 // indirect
|
||||
golang.org/x/text v0.42.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260817212433-ac3dfec99bb1 // indirect
|
||||
)
|
||||
+10
-30
@@ -1,39 +1,19 @@
|
||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||
go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU=
|
||||
go.opentelemetry.io/otel v1.44.0/go.mod h1:BMgjTHL9WPRlRjL2oZCBTL4whCGtXch2H4BhOPIAyYc=
|
||||
go.opentelemetry.io/otel/metric v1.44.0 h1:1w0gILTcHdr3YI+ixLyjemwrVnsMURbTZFrSYCdDdmc=
|
||||
go.opentelemetry.io/otel/metric v1.44.0/go.mod h1:8O7hanEPBNgEMmybD3s2VBKcgWOCsA6tzHBPODAiquo=
|
||||
go.opentelemetry.io/otel/sdk v1.44.0 h1:nHYwb9lK+fJPU/dnT6s7W7Z8itMWyqrnVfbheVYrZ58=
|
||||
go.opentelemetry.io/otel/sdk v1.44.0/go.mod h1:Osuydd3Se74nqjAKxid74N5eC+jfEqfTegHRnq58oK0=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.44.0 h1:3LlKgI+VjbVsjNRFZJZAJ30WjXC5VkNRks6si09iEfI=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.44.0/go.mod h1:5B5pMARnXxKhltooO4xUuCBorl65a4EpnTalObqOigA=
|
||||
go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk=
|
||||
go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE=
|
||||
golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8=
|
||||
golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww=
|
||||
golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY=
|
||||
golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc=
|
||||
golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38=
|
||||
golang.org/x/net v0.60.0 h1:79p50tfZlm0J9YfoDsSi639qSXNGVwEzOPLCxM2FsYU=
|
||||
golang.org/x/net v0.60.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg=
|
||||
golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo=
|
||||
golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
|
||||
golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI=
|
||||
golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E=
|
||||
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
|
||||
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa h1:mZHHdPZl0dbGHCflZgAq/Q468DWVFcU2whhB2KAo8fk=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
|
||||
google.golang.org/grpc v1.83.0 h1:JeNZEKJFbQxArAMl+hiytHauacDNqJUllNfmIMmpqnQ=
|
||||
google.golang.org/grpc v1.83.0/go.mod h1:kDyl6SKsiHKt0uylY5gtn5cEjkrIOhQOGDgIc4JGwzQ=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260817212433-ac3dfec99bb1 h1:utmqiUzZAEINbLmRyAt1QjVkMyLQ+lvIwCpLaB1rZfw=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260817212433-ac3dfec99bb1/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
|
||||
google.golang.org/grpc v1.85.0 h1:BPBCfuVRQ1qvBhKDOq9uvQllMvO59rKsYhXpp7Dd8vw=
|
||||
google.golang.org/grpc v1.85.0/go.mod h1:0rQrOD58yjal/0EaVbGBANindixsCZNQPDV3VKtaKuQ=
|
||||
google.golang.org/grpc/examples v0.0.0-20240118175532-987df1309236 h1:wTUkwrodi4IuWD3kYkMUwCU8BhwFaqDywrXmsthCvQA=
|
||||
google.golang.org/grpc/examples v0.0.0-20240118175532-987df1309236/go.mod h1:j5uROIAAgi3YmtiETMt1LW0d/lHqQ7wwrIY4uGRXLQ4=
|
||||
google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
|
||||
|
||||
Generated
+7
-7
@@ -11,7 +11,7 @@
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"bootstrap": "^5.3.8",
|
||||
"sass": "^1.102.0"
|
||||
"sass": "^1.108.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "24.x.x",
|
||||
@@ -432,9 +432,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/sass": {
|
||||
"version": "1.102.0",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.102.0.tgz",
|
||||
"integrity": "sha512-NSOyTnaQF7rTAEOtI2fwb386vL+akyiQLBZu8Na7hXCb+umJy0GAqlcMIaqACZ6Z1VgTBS4K9PG6B3IdjHGJsw==",
|
||||
"version": "1.108.1",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.108.1.tgz",
|
||||
"integrity": "sha512-sIYgSvOPeD9wABwDS/ofNjHASSck+7h3jLkk7wG1NPFL3XeS6vOQjBlAFSmRV09kZr1yt/Tuayt6kKtBbLjHNQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"chokidar": "^5.0.0",
|
||||
@@ -452,9 +452,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
|
||||
"integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"author": "Al Johri",
|
||||
"dependencies": {
|
||||
"bootstrap": "^5.3.8",
|
||||
"sass": "^1.102.0"
|
||||
"sass": "^1.108.1"
|
||||
},
|
||||
"description": "Test application for heroku multi buildpack.",
|
||||
"engines": {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Flask==3.1.3
|
||||
gunicorn==26.1.0
|
||||
gunicorn==27.0.0
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "node-example",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"express": "5.2.x"
|
||||
"express": "5.3.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": "18.x.x"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "node-example",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"express": "5.2.x"
|
||||
"express": "5.3.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.2.x"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "node-example",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"express": "5.2.x"
|
||||
"express": "5.3.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": "18.x.x"
|
||||
|
||||
Generated
+25
-23
@@ -8,16 +8,16 @@
|
||||
"packages": [
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "3.10.0",
|
||||
"version": "3.12.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/monolog.git",
|
||||
"reference": "b321dd6749f0bf7189444158a3ce785cc16d69b0"
|
||||
"reference": "d7059e4c691d05ea1222b5124bed0f961be46e15"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/b321dd6749f0bf7189444158a3ce785cc16d69b0",
|
||||
"reference": "b321dd6749f0bf7189444158a3ce785cc16d69b0",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/d7059e4c691d05ea1222b5124bed0f961be46e15",
|
||||
"reference": "d7059e4c691d05ea1222b5124bed0f961be46e15",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -43,6 +43,7 @@
|
||||
"phpstan/phpstan-strict-rules": "^2",
|
||||
"phpunit/phpunit": "^10.5.17 || ^11.0.7",
|
||||
"predis/predis": "^1.1 || ^2",
|
||||
"psr/clock": "^1.0",
|
||||
"rollbar/rollbar": "^4.0",
|
||||
"ruflin/elastica": "^7 || ^8",
|
||||
"symfony/mailer": "^5.4 || ^6",
|
||||
@@ -61,6 +62,7 @@
|
||||
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
||||
"mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)",
|
||||
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
|
||||
"psr/clock": "Required to pass a clock to the Logger and control the timestamp of log records",
|
||||
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
||||
"ruflin/elastica": "Allow sending log messages to an Elastic Search server"
|
||||
},
|
||||
@@ -95,7 +97,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Seldaek/monolog/issues",
|
||||
"source": "https://github.com/Seldaek/monolog/tree/3.10.0"
|
||||
"source": "https://github.com/Seldaek/monolog/tree/3.12.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -107,20 +109,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-01-02T08:56:05+00:00"
|
||||
"time": "2026-09-29T19:21:12+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nikic/fast-route",
|
||||
"version": "v1.3.0",
|
||||
"version": "1.3.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nikic/FastRoute.git",
|
||||
"reference": "181d480e08d9476e61381e04a71b34dc0432e812"
|
||||
"reference": "7476684f39bb9124b3be69ed3d84b66723920298"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nikic/FastRoute/zipball/181d480e08d9476e61381e04a71b34dc0432e812",
|
||||
"reference": "181d480e08d9476e61381e04a71b34dc0432e812",
|
||||
"url": "https://api.github.com/repos/nikic/FastRoute/zipball/7476684f39bb9124b3be69ed3d84b66723920298",
|
||||
"reference": "7476684f39bb9124b3be69ed3d84b66723920298",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -155,9 +157,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/nikic/FastRoute/issues",
|
||||
"source": "https://github.com/nikic/FastRoute/tree/master"
|
||||
"source": "https://github.com/nikic/FastRoute/tree/1.3.1"
|
||||
},
|
||||
"time": "2018-02-13T20:26:39+00:00"
|
||||
"time": "2026-07-09T19:38:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
@@ -485,16 +487,16 @@
|
||||
},
|
||||
{
|
||||
"name": "slim/slim",
|
||||
"version": "4.15.2",
|
||||
"version": "4.15.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/slimphp/Slim.git",
|
||||
"reference": "e12cb05ca2a14e8f459d019e87a31dc915b80470"
|
||||
"reference": "3675bf6baac66b07032575b7bef4200b60b7974b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/slimphp/Slim/zipball/e12cb05ca2a14e8f459d019e87a31dc915b80470",
|
||||
"reference": "e12cb05ca2a14e8f459d019e87a31dc915b80470",
|
||||
"url": "https://api.github.com/repos/slimphp/Slim/zipball/3675bf6baac66b07032575b7bef4200b60b7974b",
|
||||
"reference": "3675bf6baac66b07032575b7bef4200b60b7974b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -597,22 +599,22 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-05-22T08:00:12+00:00"
|
||||
"time": "2026-09-01T17:11:05+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "heroku/heroku-buildpack-php",
|
||||
"version": "v294",
|
||||
"version": "v300",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/heroku/heroku-buildpack-php.git",
|
||||
"reference": "2a8f9567a34acc79b6ebc1118196cfeda031ca2a"
|
||||
"reference": "b52841c0eea8c9dadf4d7dc4dc0736d4ee3d2b29"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/heroku/heroku-buildpack-php/zipball/2a8f9567a34acc79b6ebc1118196cfeda031ca2a",
|
||||
"reference": "2a8f9567a34acc79b6ebc1118196cfeda031ca2a",
|
||||
"url": "https://api.github.com/repos/heroku/heroku-buildpack-php/zipball/b52841c0eea8c9dadf4d7dc4dc0736d4ee3d2b29",
|
||||
"reference": "b52841c0eea8c9dadf4d7dc4dc0736d4ee3d2b29",
|
||||
"shasum": ""
|
||||
},
|
||||
"bin": [
|
||||
@@ -642,9 +644,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/heroku/heroku-buildpack-php/issues",
|
||||
"source": "https://github.com/heroku/heroku-buildpack-php/tree/v294"
|
||||
"source": "https://github.com/heroku/heroku-buildpack-php/tree/v300"
|
||||
},
|
||||
"time": "2026-07-31T14:30:30+00:00"
|
||||
"time": "2026-10-29T18:03:00+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Flask==3.1.3
|
||||
Jinja2==3.1.6
|
||||
Werkzeug==3.1.8
|
||||
gunicorn==26.1.0
|
||||
Werkzeug==3.1.9
|
||||
gunicorn==27.0.0
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"healthchecks": {
|
||||
"web": [
|
||||
{
|
||||
"attempts": 1,
|
||||
"content": "this-content-does-not-exist",
|
||||
"name": "failing-check",
|
||||
"path": "/",
|
||||
"timeout": 2,
|
||||
"type": "startup",
|
||||
"wait": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
File renamed without changes.
@@ -0,0 +1,3 @@
|
||||
FROM alpine:3.20
|
||||
|
||||
RUN false
|
||||
@@ -7,7 +7,7 @@ GEM
|
||||
logger (1.7.0)
|
||||
mustermann (3.0.4)
|
||||
ruby2_keywords (~> 0.0.1)
|
||||
rack (3.2.6)
|
||||
rack (3.2.8)
|
||||
rack-protection (4.2.1)
|
||||
base64 (>= 0.1.0)
|
||||
logger (>= 1.6.0)
|
||||
@@ -44,7 +44,7 @@ CHECKSUMS
|
||||
eventmachine (1.2.7) sha256=994016e42aa041477ba9cff45cbe50de2047f25dd418eba003e84f0d16560972
|
||||
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
|
||||
mustermann (3.0.4) sha256=85fadcb6b3c6493a8b511b42426f904b7f27b282835502233dd154daab13aa22
|
||||
rack (3.2.6) sha256=5ed78e1f73b2e25679bec7d45ee2d4483cc4146eb1be0264fc4d94cb5ef212c2
|
||||
rack (3.2.8) sha256=1fecc85e463ebc7a2a945fff829ffcd549babeb1556384796fad946c28dc4ec7
|
||||
rack-protection (4.2.1) sha256=cf6e2842df8c55f5e4d1a4be015e603e19e9bc3a7178bae58949ccbb58558bac
|
||||
rack-session (2.1.2) sha256=595434f8c0c3473ae7d7ac56ecda6cc6dfd9d37c0b2b5255330aa1576967ffe8
|
||||
ruby2_keywords (0.0.5) sha256=ffd13740c573b7301cf7a2e61fc857b2a8e3d3aff32545d6f8300d8bae10e3ef
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module dokku.me/web
|
||||
|
||||
go 1.26.2
|
||||
go 1.27.1
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.26.6
|
||||
FROM golang:1.27.3
|
||||
|
||||
ADD . /go/src/github.com/dokku/apps/web
|
||||
WORKDIR /go/src/github.com/dokku/apps/web
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module dokku.me/web
|
||||
|
||||
go 1.26.2
|
||||
go 1.27.1
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.26.6
|
||||
FROM golang:1.27.3
|
||||
|
||||
ADD . /go/src/github.com/dokku/apps/web
|
||||
WORKDIR /go/src/github.com/dokku/apps/web
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module dokku.me/web
|
||||
|
||||
go 1.26.2
|
||||
go 1.27.1
|
||||
@@ -20,6 +20,12 @@ install_dependencies() {
|
||||
curl -L "https://packagecloud.io/dokku/dokku/packages/ubuntu/noble/docker-container-healthchecker_${DOCKER_CONTAINER_HEALTHCHECKER_VERSION}_amd64.deb/download.deb" -o "$ROOT_DIR/build/${DOCKER_CONTAINER_HEALTHCHECKER_PACKAGE_NAME}"
|
||||
fi
|
||||
|
||||
COREDNS_DOCKER_VERSION=$(jq -r --arg name coredns-docker '.dependencies[] | select(.name == $name) | .version' contrib/dependencies.json)
|
||||
COREDNS_DOCKER_PACKAGE_NAME="coredns-docker_${COREDNS_DOCKER_VERSION}_amd64.deb"
|
||||
if [[ ! -f "$ROOT_DIR/build/${COREDNS_DOCKER_PACKAGE_NAME}" ]]; then
|
||||
curl -L "https://packagecloud.io/dokku/dokku/packages/ubuntu/noble/coredns-docker_${COREDNS_DOCKER_VERSION}_amd64.deb/download.deb" -o "$ROOT_DIR/build/${COREDNS_DOCKER_PACKAGE_NAME}"
|
||||
fi
|
||||
|
||||
HEROKUISH_VERSION=$(jq -r --arg name herokuish '.recommendations[] | select(.name == $name) | .version' contrib/dependencies.json)
|
||||
HEROKUISH_PACKAGE_NAME="herokuish_${HEROKUISH_VERSION}_amd64.deb"
|
||||
if [[ ! -f "$ROOT_DIR/build/${HEROKUISH_PACKAGE_NAME}" ]]; then
|
||||
@@ -68,6 +74,7 @@ install_dependencies() {
|
||||
|
||||
ls -lah "${ROOT_DIR}/build/"
|
||||
sudo dpkg -i \
|
||||
"${ROOT_DIR}/build/$COREDNS_DOCKER_PACKAGE_NAME" \
|
||||
"${ROOT_DIR}/build/$DOCKER_CONTAINER_HEALTHCHECKER_PACKAGE_NAME" \
|
||||
"${ROOT_DIR}/build/$DOCKER_IMAGE_LABELER_PACKAGE_NAME" \
|
||||
"${ROOT_DIR}/build/$HEROKUISH_PACKAGE_NAME" \
|
||||
@@ -123,8 +130,13 @@ build_dokku_docker_image() {
|
||||
run_dokku_container() {
|
||||
echo "=====> run_dokku_container on CIRCLE_NODE_INDEX: $CIRCLE_NODE_INDEX"
|
||||
echo "redirect: https://github.com/dokku/dokku-redirect.git" | sudo tee /var/lib/dokku/plugin-list
|
||||
# DOKKU_HOST_ROOT / DOKKU_LIB_HOST_ROOT match the install docs: the host
|
||||
# mounts /var/lib/dokku at /mnt/dokku, and in-container /var/lib/dokku/{home,data}
|
||||
# are symlinks into that volume.
|
||||
docker run -d \
|
||||
--env DOKKU_HOSTNAME=dokku.me \
|
||||
--env DOKKU_HOST_ROOT=/var/lib/dokku/home/dokku \
|
||||
--env DOKKU_LIB_HOST_ROOT=/var/lib/dokku/var/lib/dokku \
|
||||
--name dokku \
|
||||
--publish 3022:22 \
|
||||
--publish 80:80 \
|
||||
|
||||
Executable
+112
@@ -0,0 +1,112 @@
|
||||
#!/usr/bin/env bash
|
||||
# Checks that the environment dokku forwards across its privilege drop survives the
|
||||
# local sudo implementation. sudo-rs, the default sudo on ubuntu 25.10 and later,
|
||||
# ignores -E and bare --preserve-env, so dokku names every variable it needs.
|
||||
set -eo pipefail
|
||||
|
||||
PLUGIN_CORE_AVAILABLE_PATH="${PLUGIN_CORE_AVAILABLE_PATH:-$(dirname "$0")/../../plugins}"
|
||||
export PLUGIN_CORE_AVAILABLE_PATH
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
FAILURES=0
|
||||
|
||||
fail() {
|
||||
declare desc="report a failed check"
|
||||
echo "not ok - $1" 1>&2
|
||||
FAILURES=$((FAILURES + 1))
|
||||
}
|
||||
|
||||
pass() {
|
||||
declare desc="report a passing check"
|
||||
echo "ok - $1"
|
||||
}
|
||||
|
||||
report-whole-environment-support() {
|
||||
declare desc="record whether this sudo honours -E, for the log"
|
||||
local warning
|
||||
|
||||
warning="$(DOKKU_TEST_CROSSING=1 sudo -E -u nobody true 2>&1 >/dev/null || true)"
|
||||
if [[ -n "$warning" ]]; then
|
||||
echo "# sudo -E is not supported here: $warning"
|
||||
else
|
||||
echo "# sudo -E is supported here"
|
||||
fi
|
||||
}
|
||||
|
||||
check-named-list-crosses() {
|
||||
declare desc="the named variables reach the target user"
|
||||
local flag output
|
||||
|
||||
flag="$(DOKKU_QUIET_OUTPUT=1 DOKKU_TRACE=1 SSH_USER=ci fn-sudo-preserve-env-flag DOKKU_QUIET_OUTPUT DOKKU_TRACE SSH_USER)"
|
||||
output="$(DOKKU_QUIET_OUTPUT=1 DOKKU_TRACE=1 SSH_USER=ci sudo "$flag" -u nobody /usr/bin/env)"
|
||||
|
||||
local name
|
||||
for name in DOKKU_QUIET_OUTPUT=1 DOKKU_TRACE=1 SSH_USER=ci; do
|
||||
if grep -qxF "$name" <<<"$output"; then
|
||||
pass "$name crossed the privilege drop"
|
||||
else
|
||||
fail "$name did not cross the privilege drop"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
check-named-list-is-silent() {
|
||||
declare desc="no warning is written to stderr"
|
||||
local flag stderr
|
||||
|
||||
flag="$(SSH_USER=ci fn-sudo-preserve-env-flag SSH_USER)"
|
||||
stderr="$(SSH_USER=ci sudo "$flag" -u nobody true 2>&1 >/dev/null || true)"
|
||||
if [[ -z "$stderr" ]]; then
|
||||
pass "no warning on stderr"
|
||||
else
|
||||
fail "unexpected stderr: $stderr"
|
||||
fi
|
||||
}
|
||||
|
||||
check-absent-names-are-tolerated() {
|
||||
declare desc="naming a variable that is not set is not an error"
|
||||
local flag
|
||||
|
||||
flag="$(fn-sudo-preserve-env-flag DOKKU_DEFINITELY_NOT_SET_HERE SSH_USER)"
|
||||
if sudo "$flag" -u nobody true; then
|
||||
pass "unset names are ignored"
|
||||
else
|
||||
fail "sudo rejected a list naming an unset variable"
|
||||
fi
|
||||
}
|
||||
|
||||
check-home-still-wins() {
|
||||
declare desc="-H is not defeated by the preserved list"
|
||||
local flag output
|
||||
local names=()
|
||||
|
||||
read -ra names <<<"$(fn-cli-preserved-env-names)"
|
||||
flag="$(fn-sudo-preserve-env-flag "${names[@]}")"
|
||||
output="$(sudo "$flag" -H -u nobody /usr/bin/env)"
|
||||
if grep -qxF "HOME=$(getent passwd nobody | cut -d: -f6)" <<<"$output"; then
|
||||
pass "-H still sets HOME for the target user"
|
||||
else
|
||||
fail "HOME was not reset for the target user"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
declare desc="run every check"
|
||||
|
||||
echo "# sudo version:"
|
||||
sudo --version | head -1 | sed -e 's/^/# /'
|
||||
|
||||
report-whole-environment-support
|
||||
check-named-list-crosses
|
||||
check-named-list-is-silent
|
||||
check-absent-names-are-tolerated
|
||||
check-home-still-wins
|
||||
|
||||
if [[ "$FAILURES" -gt 0 ]]; then
|
||||
echo "$FAILURES check(s) failed" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
echo "all checks passed"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
# Dokku-in-Docker coverage for DOKKU_LIB_HOST_ROOT. These tests talk to the
|
||||
# `dokku` container started by tests/ci/setup.sh docker and read/write the
|
||||
# host path that volume backs (/var/lib/dokku -> /mnt/dokku).
|
||||
|
||||
setup_file() {
|
||||
if ! docker inspect dokku >/dev/null 2>&1; then
|
||||
echo "dokku container is not running; skip docker storage tests" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
DOKKU_LIB_HOST_ROOT="$(docker exec dokku bash -c 'echo -n "$DOKKU_LIB_HOST_ROOT"')"
|
||||
if [[ -z "$DOKKU_LIB_HOST_ROOT" ]]; then
|
||||
echo "DOKKU_LIB_HOST_ROOT is unset inside the dokku container" >&2
|
||||
return 1
|
||||
fi
|
||||
export DOKKU_LIB_HOST_ROOT
|
||||
}
|
||||
|
||||
setup() {
|
||||
ENTRY_NAME="rdmtest-docker-hostroot-$$"
|
||||
export ENTRY_NAME
|
||||
}
|
||||
|
||||
teardown() {
|
||||
docker exec dokku dokku storage:destroy "$ENTRY_NAME" --force >/dev/null 2>&1 || true
|
||||
sudo rm -rf "${DOKKU_LIB_HOST_ROOT}/data/storage/${ENTRY_NAME}"
|
||||
}
|
||||
|
||||
@test "(docker) storage:exec sees a file written under DOKKU_LIB_HOST_ROOT" {
|
||||
run docker exec dokku dokku storage:create "$ENTRY_NAME" --chown root
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
[[ "$status" -eq 0 ]]
|
||||
|
||||
# storage:create mkdirs under DOKKU_LIB_ROOT inside the container, which is
|
||||
# the same tree as DOKKU_LIB_HOST_ROOT on the host via the /mnt/dokku volume.
|
||||
HOST_STORAGE_DIR="${DOKKU_LIB_HOST_ROOT}/data/storage/${ENTRY_NAME}"
|
||||
[[ -d "$HOST_STORAGE_DIR" ]]
|
||||
|
||||
echo "Hello World!" | sudo tee "${HOST_STORAGE_DIR}/welcome.txt" >/dev/null
|
||||
|
||||
run docker exec dokku dokku storage:exec "$ENTRY_NAME" -- cat /data/welcome.txt
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
[[ "$status" -eq 0 ]]
|
||||
[[ "$output" == *"Hello World!"* ]]
|
||||
}
|
||||
Executable
+108
@@ -0,0 +1,108 @@
|
||||
#!/usr/bin/env bash
|
||||
set -xeo pipefail
|
||||
|
||||
SELF=$(command -v "$0")
|
||||
TARGET="$1"
|
||||
SCOPE="${2:-host}"
|
||||
REMOTE="dokku@$TARGET"
|
||||
APP="test-coredns-outage-$RANDOM"
|
||||
|
||||
cleanup() {
|
||||
local exit_code=$?
|
||||
set +e
|
||||
start_coredns_docker
|
||||
ssh "$REMOTE" apps:destroy "$APP" --force >/dev/null 2>&1
|
||||
ssh "$REMOTE" nginx:set --global dns-resolver >/dev/null 2>&1
|
||||
ssh "$REMOTE" events:off >/dev/null 2>&1
|
||||
exit $exit_code
|
||||
}
|
||||
|
||||
stop_coredns_docker() {
|
||||
case "$SCOPE" in
|
||||
docker)
|
||||
docker exec dokku sv stop coredns-docker
|
||||
;;
|
||||
host)
|
||||
sudo systemctl stop coredns-docker
|
||||
;;
|
||||
*)
|
||||
echo "Unknown scope: $SCOPE"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
start_coredns_docker() {
|
||||
case "$SCOPE" in
|
||||
docker)
|
||||
docker exec dokku sv start coredns-docker
|
||||
;;
|
||||
host)
|
||||
sudo systemctl start coredns-docker
|
||||
;;
|
||||
*)
|
||||
echo "Unknown scope: $SCOPE"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
curl_status() {
|
||||
curl -kSso /dev/null -w "%{http_code}" -m 10 "http://$APP.$TARGET/"
|
||||
}
|
||||
|
||||
wait_for_status() {
|
||||
local expected="$1" attempts="${2:-15}" actual
|
||||
while [[ $attempts -gt 0 ]]; do
|
||||
actual="$(curl_status || true)"
|
||||
[[ "$actual" == "$expected" ]] && return 0
|
||||
attempts=$((attempts - 1))
|
||||
sleep 1
|
||||
done
|
||||
echo "Expected HTTP $expected, last observed $actual"
|
||||
return 1
|
||||
}
|
||||
|
||||
trap cleanup INT TERM EXIT
|
||||
|
||||
ssh "$REMOTE" events:on
|
||||
ssh "$REMOTE" nginx:set --global dns-resolver 127.0.0.1:1053
|
||||
|
||||
TMP=$(mktemp -d "/tmp/$TARGET.XXXXX")
|
||||
rmdir "$TMP" && cp -r "$(dirname "$SELF")/apps/python" "$TMP"
|
||||
|
||||
pushd "$TMP" >/dev/null
|
||||
git init -q
|
||||
git config user.email "robot@example.com"
|
||||
git config user.name "Test Robot"
|
||||
git remote add target "${REMOTE}:${APP}"
|
||||
[[ -f gitignore ]] && mv gitignore .gitignore
|
||||
git add .
|
||||
git commit -qm 'initial commit'
|
||||
git push target master
|
||||
popd >/dev/null
|
||||
rm -rf "$TMP"
|
||||
|
||||
echo "-----> Verifying app responds before outage"
|
||||
wait_for_status 200
|
||||
|
||||
echo "-----> Stopping coredns-docker ($SCOPE)"
|
||||
stop_coredns_docker
|
||||
|
||||
# Wait long enough for any cached DNS entry (resolver valid=10s in the template)
|
||||
sleep 12
|
||||
|
||||
echo "-----> Verifying nginx returns 502 with coredns-docker stopped"
|
||||
actual="$(curl_status || true)"
|
||||
if [[ "$actual" != "502" ]]; then
|
||||
echo "Expected HTTP 502 with coredns-docker stopped, observed $actual"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "-----> Restarting coredns-docker"
|
||||
start_coredns_docker
|
||||
|
||||
echo "-----> Verifying app recovers"
|
||||
wait_for_status 200
|
||||
|
||||
echo "-----> coredns-docker outage test PASSED"
|
||||
@@ -58,6 +58,37 @@ teardown() {
|
||||
assert_output_contains "cron: 1" 1
|
||||
}
|
||||
|
||||
@test "(app-json) negative formation quantity" {
|
||||
mkdir -p /var/lib/dokku/data/app-json/$TEST_APP
|
||||
negative_formation_callback "$TEST_APP" /var/lib/dokku/data/app-json/$TEST_APP
|
||||
|
||||
run_plugn_trigger post-release-builder herokuish $TEST_APP dokku/$TEST_APP:latest
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Invalid quantity for process type web in app.json: value must be zero or greater"
|
||||
|
||||
run /bin/bash -c "dokku --quiet ps:scale $TEST_APP"
|
||||
output=$(echo "$output" | tr -s " ")
|
||||
echo "output: ($output)"
|
||||
echo "status: $status"
|
||||
assert_output "web: 1"
|
||||
}
|
||||
|
||||
@test "(app-json) healthcheck path with whitespace fails deploy" {
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP whitespace_healthcheck_path_callback
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains 'Invalid app.json healthcheck web readiness check for process type web: path "/health check" must not contain whitespace, control characters, quotes, or backslashes' 2
|
||||
|
||||
run /bin/bash -c "docker ps -a -q --filter label=com.dokku.app-name=$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
}
|
||||
|
||||
persist_scale_callback_a() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
@@ -81,3 +112,39 @@ persist_scale_callback_b() {
|
||||
echo "cron: python3 worker.py" >>"$APP_REPO_DIR/Procfile"
|
||||
mv "$APP_REPO_DIR/app-5205b.json" "$APP_REPO_DIR/app.json"
|
||||
}
|
||||
|
||||
negative_formation_callback() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
[[ -z "$APP" ]] && local APP="$TEST_APP"
|
||||
|
||||
cat >"$APP_REPO_DIR/app.json" <<EOF
|
||||
{
|
||||
"formation": {
|
||||
"web": {
|
||||
"quantity": -1
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
whitespace_healthcheck_path_callback() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
[[ -z "$APP" ]] && local APP="$TEST_APP"
|
||||
|
||||
cat >"$APP_REPO_DIR/app.json" <<EOF
|
||||
{
|
||||
"healthchecks": {
|
||||
"web": [
|
||||
{
|
||||
"name": "web readiness check",
|
||||
"path": "/health check",
|
||||
"type": "readiness"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
EOF
|
||||
}
|
||||
@@ -144,7 +144,7 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku postgres:create $TEST_APP $TEST_APP"
|
||||
run /bin/bash -c "dokku postgres:create $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
@@ -154,7 +154,7 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku redis:create $TEST_APP $TEST_APP"
|
||||
run /bin/bash -c "dokku redis:create $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
@@ -179,12 +179,12 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --force postgres:destroy $TEST_APP"
|
||||
run /bin/bash -c "dokku postgres:destroy $TEST_APP --force"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --force redis:destroy $TEST_APP"
|
||||
run /bin/bash -c "dokku redis:destroy $TEST_APP --force"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
@@ -2,11 +2,16 @@
|
||||
|
||||
load test_helper
|
||||
|
||||
APP_FILTER_PLUGIN_NAME="app-filter-test"
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
}
|
||||
|
||||
teardown() {
|
||||
release_deploy_lock
|
||||
rm -rf "${PLUGIN_ENABLED_PATH:?}/$APP_FILTER_PLUGIN_NAME" "${PLUGIN_AVAILABLE_PATH:?}/$APP_FILTER_PLUGIN_NAME"
|
||||
dokku --force apps:destroy "$TEST_APP-source" &>/dev/null || true
|
||||
global_teardown
|
||||
}
|
||||
|
||||
@@ -398,6 +403,162 @@ teardown() {
|
||||
destroy_app
|
||||
}
|
||||
|
||||
@test "(apps) apps:lock does not modify the deploy lock file" {
|
||||
run create_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "echo holder-id >$DOKKU_LIB_ROOT/data/apps/$TEST_APP/.deploy.lock && chown dokku:dokku $DOKKU_LIB_ROOT/data/apps/$TEST_APP/.deploy.lock"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku apps:lock $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "cat $DOKKU_LIB_ROOT/data/apps/$TEST_APP/.deploy.lock"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "holder-id"
|
||||
|
||||
run /bin/bash -c "dokku apps:unlock $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
destroy_app
|
||||
}
|
||||
|
||||
@test "(apps:locked) ignores a deploy lock file that no deploy holds" {
|
||||
run create_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "echo stale-id >$DOKKU_LIB_ROOT/data/apps/$TEST_APP/.deploy.lock && chown dokku:dokku $DOKKU_LIB_ROOT/data/apps/$TEST_APP/.deploy.lock"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku apps:locked $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku apps:report $TEST_APP --app-locked"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "false"
|
||||
|
||||
destroy_app
|
||||
}
|
||||
|
||||
@test "(apps:locked) reports a deploy lock held by a running deploy" {
|
||||
run create_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
hold_deploy_lock
|
||||
|
||||
run /bin/bash -c "dokku apps:locked $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku apps:unlock $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "A deploy may be in progress."
|
||||
|
||||
release_deploy_lock
|
||||
destroy_app
|
||||
}
|
||||
|
||||
@test "(apps:unlock) succeeds for an app that is not locked" {
|
||||
run create_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku apps:unlock $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_contains "A deploy may be in progress."
|
||||
|
||||
destroy_app
|
||||
}
|
||||
|
||||
@test "(apps:rename) fails for a locked app" {
|
||||
run create_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku apps:lock $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku apps:rename $TEST_APP great-test-name"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Unable to rename a locked app"
|
||||
|
||||
run /bin/bash -c "dokku apps:exists great-test-name"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku apps:locked $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
destroy_app
|
||||
}
|
||||
|
||||
@test "(apps) [install] converts a lock created by apps:lock in older versions" {
|
||||
run create_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "sudo -u dokku touch $DOKKU_LIB_ROOT/data/apps/$TEST_APP/.deploy.lock"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "DOKKU_ROOT=$DOKKU_ROOT PLUGIN_PATH=$PLUGIN_PATH PLUGIN_AVAILABLE_PATH=$PLUGIN_AVAILABLE_PATH PLUGIN_ENABLED_PATH=$PLUGIN_ENABLED_PATH PLUGIN_CORE_AVAILABLE_PATH=$PLUGIN_CORE_AVAILABLE_PATH DOKKU_LIB_ROOT=$DOKKU_LIB_ROOT $PLUGIN_ENABLED_PATH/apps/install"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "[[ ! -e $DOKKU_LIB_ROOT/data/apps/$TEST_APP/.deploy.lock ]]"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "[[ -f $DOKKU_LIB_ROOT/data/apps/$TEST_APP/.manual-deploy.lock ]]"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku apps:locked $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
destroy_app
|
||||
}
|
||||
|
||||
@test "(apps:report) emits new stripped JSON keys alongside legacy" {
|
||||
create_app
|
||||
|
||||
@@ -489,3 +650,59 @@ teardown() {
|
||||
|
||||
destroy_app
|
||||
}
|
||||
|
||||
@test "(apps) apps:create, apps:clone, and apps:rename with an existing filtered app" {
|
||||
create_app
|
||||
create_app "$TEST_APP-source"
|
||||
|
||||
setup_app_filter_plugin "$TEST_APP"
|
||||
|
||||
run /bin/bash -c "dokku apps:create $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Name is already taken"
|
||||
assert_output_not_contains "Creating $TEST_APP"
|
||||
|
||||
run /bin/bash -c "dokku apps:clone $TEST_APP-source $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Name is already taken"
|
||||
|
||||
run /bin/bash -c "dokku apps:rename $TEST_APP-source $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Name is already taken"
|
||||
|
||||
rm -rf "${PLUGIN_ENABLED_PATH:?}/$APP_FILTER_PLUGIN_NAME" "${PLUGIN_AVAILABLE_PATH:?}/$APP_FILTER_PLUGIN_NAME"
|
||||
|
||||
destroy_app 0 "$TEST_APP-source"
|
||||
destroy_app
|
||||
}
|
||||
|
||||
setup_app_filter_plugin() {
|
||||
declare desc="installs a plugin that filters out a single app"
|
||||
declare FILTERED_APP="$1"
|
||||
local PLUGIN_DIR="$PLUGIN_AVAILABLE_PATH/$APP_FILTER_PLUGIN_NAME"
|
||||
mkdir -p "$PLUGIN_DIR"
|
||||
|
||||
cat <<EOF >"$PLUGIN_DIR/plugin.toml"
|
||||
[plugin]
|
||||
description = "test plugin filtering out a single app"
|
||||
version = "0.1.0"
|
||||
[plugin.config]
|
||||
EOF
|
||||
|
||||
cat <<EOF >"$PLUGIN_DIR/user-auth-app"
|
||||
#!/usr/bin/env bash
|
||||
shift 2
|
||||
for app in "\$@"; do
|
||||
[[ "\$app" == "$FILTERED_APP" ]] || echo "\$app"
|
||||
done
|
||||
EOF
|
||||
chmod +x "$PLUGIN_DIR/user-auth-app"
|
||||
|
||||
dokku plugin:enable "$APP_FILTER_PLUGIN_NAME"
|
||||
}
|
||||
@@ -33,6 +33,38 @@ teardown() {
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(apps:clone) does not copy the lock of a locked app" {
|
||||
run /bin/bash -c "dokku apps:create $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku apps:lock $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku apps:clone --skip-deploy $TEST_APP great-test-name"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku apps:locked great-test-name"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku apps:locked $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --force apps:destroy great-test-name"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(apps) apps:clone (no app)" {
|
||||
run /bin/bash -c "dokku apps:create $TEST_APP"
|
||||
echo "output: $output"
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
create_app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
destroy_app
|
||||
global_teardown
|
||||
}
|
||||
|
||||
@test "(apps:lock) blocks ps:rebuild until apps:unlock" {
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP convert_to_dockerfile
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku builds:list $TEST_APP --format json | jq length"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
local BUILD_COUNT="$output"
|
||||
|
||||
run /bin/bash -c "dokku apps:lock $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "$TEST_APP has been locked via apps:lock" -1
|
||||
assert_output_not_contains "Building $TEST_APP"
|
||||
|
||||
run /bin/bash -c "dokku builds:list $TEST_APP --format json | jq length"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "$BUILD_COUNT"
|
||||
|
||||
run /bin/bash -c "dokku apps:locked $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku apps:unlock $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(apps:lock) blocks git:sync before fetching" {
|
||||
run /bin/bash -c "dokku apps:lock $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku git:sync --build $TEST_APP https://github.com/dokku/smoke-test-app.git"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "$TEST_APP has been locked via apps:lock"
|
||||
|
||||
run /bin/bash -c "sudo -u dokku git -C $DOKKU_ROOT/$TEST_APP rev-parse --verify -q master"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku builds:list $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "No builds recorded"
|
||||
}
|
||||
@@ -345,6 +345,80 @@ EOF
|
||||
assert_output "['task.py', 'some', 'cron', 'task']"
|
||||
}
|
||||
|
||||
@test "(builder-dockerfile) ps:rebuild --no-cache" {
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP convert_to_dockerfile
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "CACHED" -1
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild --no-cache $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "CACHED" 1
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "CACHED" -1
|
||||
}
|
||||
|
||||
@test "(builder-dockerfile) failed build restores previous image" {
|
||||
local CUSTOM_TMP=$(mktemp -d "/tmp/${DOKKU_DOMAIN}.XXXXX")
|
||||
trap 'popd &>/dev/null || true; rm -rf "$CUSTOM_TMP"' INT TERM
|
||||
|
||||
CUSTOM_TMP="$CUSTOM_TMP" run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" convert_to_dockerfile
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
local previous_image
|
||||
previous_image="$(docker container inspect "$TEST_APP.web.1" --format '{{.Image}}')"
|
||||
[[ -n "$previous_image" ]]
|
||||
|
||||
run failing_build_callback "$TEST_APP" "$CUSTOM_TMP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run git -C "$CUSTOM_TMP" add Dockerfile
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run git -C "$CUSTOM_TMP" commit -m 'Break the build'
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run git -C "$CUSTOM_TMP" push target master:master
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "App build failed"
|
||||
assert_output_contains "Removing invalid image tag" 0
|
||||
|
||||
run /bin/bash -c "docker image inspect dokku/$TEST_APP:latest --format '{{.Id}}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "$previous_image"
|
||||
|
||||
run /bin/bash -c "dokku ps:restart $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
rm -rf "$CUSTOM_TMP"
|
||||
}
|
||||
|
||||
cron_run_wrapper() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
@@ -354,3 +428,9 @@ cron_run_wrapper() {
|
||||
convert_to_dockerfile "$APP" "$APP_REPO_DIR"
|
||||
mv -f "$APP_REPO_DIR/app-cron.json" "$APP_REPO_DIR/app.json"
|
||||
}
|
||||
|
||||
failing_build_callback() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
echo "RUN exit 1" >>"$APP_REPO_DIR/Dockerfile"
|
||||
}
|
||||
@@ -104,6 +104,50 @@ teardown() {
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(builder-herokuish:report) stack raw vs computed vs global" {
|
||||
local default_stack="gliderlabs/herokuish:latest-24"
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-stack"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-global-stack"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-computed-stack"
|
||||
assert_success
|
||||
assert_output "$default_stack"
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:set --global stack gliderlabs/herokuish:global"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-global-stack"
|
||||
assert_success
|
||||
assert_output "gliderlabs/herokuish:global"
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-computed-stack"
|
||||
assert_success
|
||||
assert_output "gliderlabs/herokuish:global"
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:set $TEST_APP stack gliderlabs/herokuish:app"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-stack"
|
||||
assert_success
|
||||
assert_output "gliderlabs/herokuish:app"
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-computed-stack"
|
||||
assert_success
|
||||
assert_output "gliderlabs/herokuish:app"
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:set $TEST_APP stack"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku builder-herokuish:set --global stack"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(builder-herouish:build .env)" {
|
||||
run /bin/bash -c "dokku docker-options:add $TEST_APP build '--label=com.dokku.build-test=safe'"
|
||||
echo "output: $output"
|
||||
@@ -253,6 +297,50 @@ teardown() {
|
||||
assert_output "['task.py', 'some', 'cron', 'task']"
|
||||
}
|
||||
|
||||
@test "(builder-herokuish) ps:rebuild --no-cache" {
|
||||
run /bin/bash -c "dokku builder-herokuish:set $TEST_APP allowed true"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker volume inspect --format '{{.CreatedAt}}' cache-$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
cache_created_at="$output"
|
||||
|
||||
sleep 1
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Clearing build cache" 0
|
||||
|
||||
run /bin/bash -c "docker volume inspect --format '{{.CreatedAt}}' cache-$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "$cache_created_at"
|
||||
|
||||
sleep 1
|
||||
run /bin/bash -c "dokku ps:rebuild --no-cache $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Clearing build cache"
|
||||
|
||||
run /bin/bash -c "docker volume inspect --format '{{.CreatedAt}}' cache-$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
[[ "$output" != "$cache_created_at" ]]
|
||||
}
|
||||
|
||||
cron_run_wrapper() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
|
||||
@@ -229,6 +229,30 @@ teardown() {
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(builder-nixpacks) ps:rebuild --no-cache" {
|
||||
run /bin/bash -c "dokku builder:set $TEST_APP selected nixpacks"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP add_requirements_txt
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "CACHED" -1
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild --no-cache $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "unpacking 'https://github.com/NixOS/nixpkgs" -1
|
||||
}
|
||||
|
||||
cron_run_wrapper() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
|
||||
@@ -107,6 +107,55 @@ teardown() {
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(builder-pack:report) stack raw vs computed vs global" {
|
||||
run /bin/bash -c "dokku builder-pack:set --global stack"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-stack"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-global-stack"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-computed-stack"
|
||||
assert_success
|
||||
assert_output "heroku/builder:24"
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:set --global stack paketobuildpacks/builder:global"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-global-stack"
|
||||
assert_success
|
||||
assert_output "paketobuildpacks/builder:global"
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-computed-stack"
|
||||
assert_success
|
||||
assert_output "paketobuildpacks/builder:global"
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:set $TEST_APP stack paketobuildpacks/builder:app"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-stack"
|
||||
assert_success
|
||||
assert_output "paketobuildpacks/builder:app"
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-computed-stack"
|
||||
assert_success
|
||||
assert_output "paketobuildpacks/builder:app"
|
||||
|
||||
run /bin/bash -c "cat $DOKKU_LIB_ROOT/config/builder-pack/$TEST_APP/clear-cache"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:set $TEST_APP stack"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:set --global stack"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(builder-pack:set)" {
|
||||
run /bin/bash -c "dokku config:set $TEST_APP SECRET_KEY=fjdkslafjdk"
|
||||
echo "output: $output"
|
||||
@@ -118,11 +167,17 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:set-property $TEST_APP stack heroku/builder:24"
|
||||
run /bin/bash -c "dokku builder-pack:set $TEST_APP stack heroku/builder:24"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "cat $DOKKU_LIB_ROOT/config/builder-pack/$TEST_APP/clear-cache"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP add_requirements_txt_cnb
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
@@ -130,6 +185,11 @@ teardown() {
|
||||
assert_output_contains 'Building with buildpack 1' 0
|
||||
assert_output_contains 'Installing dependencies using pip'
|
||||
|
||||
run /bin/bash -c "test -f $DOKKU_LIB_ROOT/config/builder-pack/$TEST_APP/clear-cache"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:set $TEST_APP projecttoml-path nonexistent.toml"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
@@ -326,6 +386,32 @@ teardown() {
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(builder-pack) ps:rebuild --no-cache" {
|
||||
run /bin/bash -c "dokku builder:set $TEST_APP selected pack"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP add_requirements_txt_cnb
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Using cached pip download/wheel cache"
|
||||
assert_output_contains "Skipping buildpack layer analysis" 0
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild --no-cache $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Skipping buildpack layer analysis"
|
||||
assert_output_contains "Using cached pip download/wheel cache" 0
|
||||
}
|
||||
|
||||
cron_run_wrapper() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
|
||||
@@ -240,6 +240,53 @@ teardown() {
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(builder-railpack) ps:rebuild --no-cache" {
|
||||
run /bin/bash -c "dokku builder:set $TEST_APP selected railpack"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP add_requirements_txt
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "CACHED" -1
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild --no-cache $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Collecting flask" -1
|
||||
}
|
||||
|
||||
@test "(builder-railpack) docker-options build --no-cache" {
|
||||
run /bin/bash -c "dokku builder:set $TEST_APP selected railpack"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP add_requirements_txt
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku docker-options:add $TEST_APP build --no-cache"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Collecting flask" -1
|
||||
}
|
||||
|
||||
cron_run_wrapper() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
|
||||
+50
-47
@@ -253,71 +253,51 @@ teardown() {
|
||||
assert_output "https://github.com/heroku/heroku-buildpack-nodejs.git"
|
||||
}
|
||||
|
||||
@test "(buildpacks) buildpacks:set-property" {
|
||||
run /bin/bash -c "dokku buildpacks:set-property --global stack gliderlabs/herokuish:latest"
|
||||
@test "(buildpacks) buildpacks:set-property forwards stack to the detected builder" {
|
||||
run /bin/bash -c "dokku buildpacks:set-property $TEST_APP stack gliderlabs/herokuish:app"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
assert_output_contains "Deprecated"
|
||||
|
||||
@test "(buildpacks:report) stack raw vs computed vs global" {
|
||||
run /bin/bash -c "dokku buildpacks:set-property --global stack"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r '.\"buildpacks-stack\"'"
|
||||
assert_success
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r '.\"buildpacks-global-stack\"'"
|
||||
assert_success
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:set-property --global stack gliderlabs/herokuish:global"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r '.\"buildpacks-global-stack\"'"
|
||||
assert_success
|
||||
assert_output "gliderlabs/herokuish:global"
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r '.\"buildpacks-computed-stack\"'"
|
||||
assert_success
|
||||
assert_output "gliderlabs/herokuish:global"
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:set-property $TEST_APP stack gliderlabs/herokuish:app"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r '.\"buildpacks-stack\"'"
|
||||
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-stack"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "gliderlabs/herokuish:app"
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r '.\"buildpacks-global-stack\"'"
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-stack"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "gliderlabs/herokuish:global"
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r '.\"buildpacks-computed-stack\"'"
|
||||
run /bin/bash -c "dokku buildpacks:set-property $TEST_APP stack heroku/builder:24"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "gliderlabs/herokuish:app"
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-stack"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "heroku/builder:24"
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:set-property $TEST_APP stack"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:set-property --global stack"
|
||||
run /bin/bash -c "dokku builder-herokuish:report $TEST_APP --builder-herokuish-stack"
|
||||
assert_success
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku builder-pack:report $TEST_APP --builder-pack-stack"
|
||||
assert_success
|
||||
assert_output ""
|
||||
}
|
||||
|
||||
@test "(buildpacks:report) emits new stripped JSON keys alongside legacy" {
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r 'has(\"stack\") and has(\"buildpacks-stack\")'"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r 'has(\"global-stack\") and has(\"buildpacks-global-stack\")'"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r 'has(\"computed-stack\") and has(\"buildpacks-computed-stack\")'"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
run /bin/bash -c "dokku buildpacks:report $TEST_APP --format json | jq -r 'has(\"list\") and has(\"buildpacks-list\")'"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
@@ -476,6 +456,29 @@ teardown() {
|
||||
assert_output_contains "heroku-buildpack-python"
|
||||
}
|
||||
|
||||
@test "(buildpacks:add) concurrent calls for the same app keep every buildpack" {
|
||||
run run_concurrently 20 /bin/bash -c 'dokku buildpacks:add "$1" "https://github.com/dokku/buildpack-race$2.git"' _ "$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --quiet buildpacks:list $TEST_APP | grep -cE '^ *https://github.com/dokku/buildpack-race[0-9]+\.git$'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "20"
|
||||
|
||||
run run_concurrently 20 /bin/bash -c 'dokku buildpacks:remove "$1" "https://github.com/dokku/buildpack-race$2.git"' _ "$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --quiet buildpacks:list $TEST_APP | grep -cE '^ *https://github.com/dokku/buildpack-race[0-9]+\.git$'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "0"
|
||||
}
|
||||
|
||||
template_buildpacks_appjson() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
|
||||
@@ -91,6 +91,36 @@ EOF
|
||||
assert_output_contains "git-hook"
|
||||
}
|
||||
|
||||
@test "(builds:report) records a ps:rebuild called with flags before the app name" {
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP convert_to_dockerfile
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild --no-cache $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "builds-record" 0
|
||||
|
||||
run /bin/bash -c "dokku builds:report $TEST_APP --build-source"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "ps:rebuild"
|
||||
|
||||
run /bin/bash -c "dokku builds:report $TEST_APP --build-status"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "succeeded"
|
||||
|
||||
run /bin/bash -c "[[ ! -e $DOKKU_LIB_ROOT/data/builds/--no-cache ]]"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(builds:list) shows an abandoned record when the PID is gone but the record is still running" {
|
||||
write_running_record "$TEST_APP" "ghost001" 99999 "git-hook"
|
||||
|
||||
@@ -101,6 +131,75 @@ EOF
|
||||
assert_output_contains "abandoned"
|
||||
}
|
||||
|
||||
@test "(builds) [lock] a failed build releases the deploy lock and finalizes the record as failed" {
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP convert_to_dockerfile
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku builder-dockerfile:set $TEST_APP dockerfile-path fail.Dockerfile"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "App build failed" -1
|
||||
|
||||
run /bin/bash -c "dokku apps:locked $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "[[ ! -e $DOKKU_LIB_ROOT/data/apps/$TEST_APP/.deploy.lock ]]"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku builds:report $TEST_APP --build-status"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "failed"
|
||||
|
||||
run /bin/bash -c "dokku builds:report $TEST_APP --build-exit-code"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_not_output "0"
|
||||
}
|
||||
|
||||
@test "(builds) [lock] a deploy that exits while holding the lock finalizes its record" {
|
||||
run /bin/bash -c "sudo -u dokku env PLUGIN_PATH=$PLUGIN_PATH PLUGIN_AVAILABLE_PATH=$PLUGIN_AVAILABLE_PATH PLUGIN_ENABLED_PATH=$PLUGIN_ENABLED_PATH PLUGIN_CORE_AVAILABLE_PATH=$PLUGIN_CORE_AVAILABLE_PATH DOKKU_LIB_ROOT=$DOKKU_LIB_ROOT DOKKU_BUILD_ID=exit0001 bash -c 'source $PLUGIN_CORE_AVAILABLE_PATH/common/functions; plugn trigger builds-record-start $TEST_APP exit0001 \$\$ git-hook; acquire_app_deploy_lock $TEST_APP exclusive; exit 3'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_equal 3 "$status"
|
||||
|
||||
run /bin/bash -c "[[ ! -e $DOKKU_LIB_ROOT/data/apps/$TEST_APP/.deploy.lock ]]"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku apps:locked $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku builds:info $TEST_APP exit0001 --format json | jq -r .status"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "failed"
|
||||
|
||||
run /bin/bash -c "dokku builds:info $TEST_APP exit0001 --format json | jq -r .exit_code"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "3"
|
||||
}
|
||||
|
||||
@test "(builds:list --kind=build) filters to build-kind records" {
|
||||
write_finished_record "$TEST_APP" "b1" "succeeded" "git-hook" 1001 "build"
|
||||
write_finished_record "$TEST_APP" "d1" "succeeded" "ps:restart" 1002 "deploy"
|
||||
|
||||
@@ -0,0 +1,311 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
# Isolated coverage for plugins/caddy-vhosts/docker-args-process-deploy.
|
||||
# Stubs plugn and plugin sources so the trigger can run without a Dokku install.
|
||||
|
||||
setup() {
|
||||
REPO_ROOT="$(cd "$BATS_TEST_DIRNAME/../.." && pwd)"
|
||||
TRIGGER="$REPO_ROOT/plugins/caddy-vhosts/docker-args-process-deploy"
|
||||
STUB_ROOT="$BATS_TEST_TMPDIR/stub"
|
||||
mkdir -p "$STUB_ROOT/bin" \
|
||||
"$STUB_ROOT/core/common" \
|
||||
"$STUB_ROOT/plugins/proxy" \
|
||||
"$STUB_ROOT/plugins/caddy-vhosts"
|
||||
|
||||
cat >"$STUB_ROOT/core/common/functions" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
dokku_log_warn() { echo "WARN: $*" >&2; }
|
||||
dokku_log_fail() {
|
||||
echo "FAIL: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
EOF
|
||||
|
||||
cat >"$STUB_ROOT/plugins/proxy/functions" <<EOF
|
||||
#!/usr/bin/env bash
|
||||
source "$REPO_ROOT/plugins/proxy/functions"
|
||||
EOF
|
||||
cat >>"$STUB_ROOT/plugins/proxy/functions" <<'EOF'
|
||||
fn-proxy-get-labels-file-path() {
|
||||
echo "${STUB_LABELS_FILE:-/nonexistent}"
|
||||
}
|
||||
EOF
|
||||
|
||||
cat >"$STUB_ROOT/plugins/caddy-vhosts/internal-functions" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
fn-caddy-computed-letsencrypt-email() {
|
||||
echo "${STUB_LETSENCRYPT_EMAIL:-}"
|
||||
}
|
||||
fn-caddy-computed-tls-internal() {
|
||||
echo "${STUB_TLS_INTERNAL:-false}"
|
||||
}
|
||||
EOF
|
||||
|
||||
cat >"$STUB_ROOT/bin/plugn" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
if [[ "$1" != "trigger" ]]; then
|
||||
echo "unexpected plugn command: $*" >&2
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
cmd="$1"
|
||||
shift
|
||||
case "$cmd" in
|
||||
proxy-type)
|
||||
echo "${STUB_PROXY_TYPE:-caddy}"
|
||||
;;
|
||||
proxy-is-enabled)
|
||||
echo "${STUB_PROXY_ENABLED:-true}"
|
||||
;;
|
||||
domains-vhost-enabled)
|
||||
[[ "${STUB_VHOST_ENABLED:-true}" == "true" ]]
|
||||
;;
|
||||
ports-configure)
|
||||
;;
|
||||
ports-get)
|
||||
if [[ -n "${STUB_PORTS:-}" ]]; then
|
||||
printf '%s\n' "$STUB_PORTS"
|
||||
fi
|
||||
;;
|
||||
domains-list)
|
||||
if [[ -n "${STUB_DOMAINS:-}" ]]; then
|
||||
printf '%s\n' "$STUB_DOMAINS"
|
||||
fi
|
||||
;;
|
||||
app-json-get-content)
|
||||
echo "${STUB_APP_JSON:-{\}}"
|
||||
;;
|
||||
*)
|
||||
echo "unexpected plugn trigger: $cmd $*" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
EOF
|
||||
chmod +x "$STUB_ROOT/bin/plugn"
|
||||
}
|
||||
|
||||
invoke_caddy_docker_args() {
|
||||
env \
|
||||
PLUGIN_CORE_AVAILABLE_PATH="$STUB_ROOT/core" \
|
||||
PLUGIN_AVAILABLE_PATH="$STUB_ROOT/plugins" \
|
||||
PATH="$STUB_ROOT/bin:$PATH" \
|
||||
STUB_PORTS="${STUB_PORTS:-}" \
|
||||
STUB_DOMAINS="${STUB_DOMAINS:-}" \
|
||||
STUB_TLS_INTERNAL="${STUB_TLS_INTERNAL:-false}" \
|
||||
STUB_LETSENCRYPT_EMAIL="${STUB_LETSENCRYPT_EMAIL:-}" \
|
||||
STUB_PROXY_TYPE="${STUB_PROXY_TYPE:-caddy}" \
|
||||
STUB_PROXY_ENABLED="${STUB_PROXY_ENABLED:-true}" \
|
||||
STUB_VHOST_ENABLED="${STUB_VHOST_ENABLED:-true}" \
|
||||
STUB_LABELS_FILE="${STUB_LABELS_FILE:-/nonexistent}" \
|
||||
STUB_APP_JSON="${STUB_APP_JSON:-}" \
|
||||
bash "$TRIGGER" "${APP_NAME:-testapp}" "dockerfile" "latest" "${PROC_TYPE:-web}" "1" <<<"${STDIN_DATA:-}"
|
||||
}
|
||||
|
||||
@test "(caddy-vhosts) tls-internal does not leak caddy.tls=internal without http/https ports" {
|
||||
STUB_DOMAINS="example.com"
|
||||
STUB_PORTS=""
|
||||
STUB_TLS_INTERNAL="true"
|
||||
|
||||
run invoke_caddy_docker_args
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
if [[ "$output" == *"caddy.tls=internal"* ]]; then
|
||||
flunk "stray caddy.tls=internal label leaked with no http/https mapping: $output"
|
||||
fi
|
||||
}
|
||||
|
||||
@test "(caddy-vhosts) is_app_listening gate compares == true not -n" {
|
||||
run grep -F '[[ "$is_app_listening" == "true" ]]' "$TRIGGER"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run grep -F '[[ -n "$is_app_listening" ]]' "$TRIGGER"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "(caddy-vhosts) is_app_listening true still emits reverse_proxy labels" {
|
||||
STUB_DOMAINS="example.com"
|
||||
STUB_PORTS="http:80:5000"
|
||||
STUB_TLS_INTERNAL="false"
|
||||
|
||||
run invoke_caddy_docker_args
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "caddy.reverse_proxy"
|
||||
}
|
||||
|
||||
@test "(caddy-vhosts) readiness healthcheck emits health and retry labels" {
|
||||
STUB_DOMAINS="example.com"
|
||||
STUB_PORTS="http:80:5000"
|
||||
STUB_APP_JSON='{"healthchecks":{"web":[{"type":"readiness","path":"/health","timeout":3,"wait":2}]}}'
|
||||
|
||||
run invoke_caddy_docker_args
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains '--label "caddy.reverse_proxy.health_uri=/health"'
|
||||
assert_output_contains "--label caddy.reverse_proxy.health_interval=2s"
|
||||
assert_output_contains "--label caddy.reverse_proxy.health_timeout=3s"
|
||||
assert_output_contains "--label caddy.reverse_proxy.health_headers.Host=example.com"
|
||||
assert_output_contains "--label caddy.reverse_proxy.lb_try_duration=5s"
|
||||
assert_output_contains "--label caddy.reverse_proxy.lb_try_interval=250ms"
|
||||
assert_output_contains "health_port" 0
|
||||
}
|
||||
|
||||
@test "(caddy-vhosts) readiness healthcheck defaults and port" {
|
||||
STUB_DOMAINS="example.com"
|
||||
STUB_PORTS="http:80:5000"
|
||||
STUB_APP_JSON='{"healthchecks":{"web":[{"type":"readiness","path":"/","port":5001}]}}'
|
||||
|
||||
run invoke_caddy_docker_args
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "--label caddy.reverse_proxy.health_port=5001"
|
||||
assert_output_contains "--label caddy.reverse_proxy.health_interval=5s"
|
||||
assert_output_contains "--label caddy.reverse_proxy.health_timeout=5s"
|
||||
}
|
||||
|
||||
@test "(caddy-vhosts) healthcheck host header skips localhost and catch-all domains" {
|
||||
STUB_DOMAINS="localhost * app.example.com other.example.com"
|
||||
STUB_PORTS="http:80:5000"
|
||||
STUB_APP_JSON='{"healthchecks":{"web":[{"type":"readiness","path":"/"}]}}'
|
||||
|
||||
run invoke_caddy_docker_args
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "--label caddy.reverse_proxy.health_headers.Host=app.example.com"
|
||||
}
|
||||
|
||||
@test "(caddy-vhosts) startup healthcheck emits no health or retry labels" {
|
||||
STUB_DOMAINS="example.com"
|
||||
STUB_PORTS="http:80:5000"
|
||||
STUB_APP_JSON='{"healthchecks":{"web":[{"type":"startup","path":"/"}]}}'
|
||||
|
||||
run invoke_caddy_docker_args
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "caddy.reverse_proxy="
|
||||
assert_output_contains "health_" 0
|
||||
assert_output_contains "lb_try_" 0
|
||||
}
|
||||
|
||||
@test "(caddy-vhosts) missing app.json emits no health or retry labels" {
|
||||
STUB_DOMAINS="example.com"
|
||||
STUB_PORTS="http:80:5000"
|
||||
|
||||
run invoke_caddy_docker_args
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "caddy.reverse_proxy="
|
||||
assert_output_contains "health_" 0
|
||||
assert_output_contains "lb_try_" 0
|
||||
}
|
||||
|
||||
@test "(caddy-vhosts) readiness healthcheck without routing labels emits no health labels" {
|
||||
STUB_DOMAINS="example.com"
|
||||
STUB_PORTS=""
|
||||
STUB_APP_JSON='{"healthchecks":{"web":[{"type":"readiness","path":"/"}]}}'
|
||||
|
||||
run invoke_caddy_docker_args
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "health_" 0
|
||||
}
|
||||
|
||||
@test "(caddy-vhosts) invalid readiness healthcheck path fails" {
|
||||
STUB_DOMAINS="example.com"
|
||||
STUB_PORTS="http:80:5000"
|
||||
STUB_APP_JSON='{"healthchecks":{"web":[{"type":"readiness","path":"/has space"}]}}'
|
||||
|
||||
run invoke_caddy_docker_args
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Invalid app.json healthcheck path for caddy"
|
||||
}
|
||||
|
||||
@test "(caddy-vhosts) readiness healthcheck maps attempts and headers" {
|
||||
STUB_DOMAINS="example.com"
|
||||
STUB_PORTS="http:80:5000"
|
||||
STUB_APP_JSON='{"healthchecks":{"web":[{"type":"readiness","path":"/","attempts":4,"httpHeaders":[{"name":"X-Check","value":"dokku check"},{"name":"host","value":"check.example.com"}]}]}}'
|
||||
|
||||
run invoke_caddy_docker_args
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "--label caddy.reverse_proxy.health_fails=4"
|
||||
assert_output_contains "--label 'caddy.reverse_proxy.health_headers.X-Check=\"dokku check\"'"
|
||||
assert_output_contains "--label caddy.reverse_proxy.health_headers.Host=check.example.com"
|
||||
assert_output_contains "health_headers.Host=example.com" 0
|
||||
assert_output_contains "health_headers.host" 0
|
||||
}
|
||||
|
||||
@test "(caddy-vhosts) readiness healthcheck defaults attempts to 3" {
|
||||
STUB_DOMAINS="example.com"
|
||||
STUB_PORTS="http:80:5000"
|
||||
STUB_APP_JSON='{"healthchecks":{"web":[{"type":"readiness","path":"/"}]}}'
|
||||
|
||||
run invoke_caddy_docker_args
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "--label caddy.reverse_proxy.health_fails=3"
|
||||
}
|
||||
|
||||
@test "(caddy-vhosts) invalid healthcheck headers are skipped" {
|
||||
STUB_DOMAINS="example.com"
|
||||
STUB_PORTS="http:80:5000"
|
||||
STUB_APP_JSON='{"healthchecks":{"web":[{"type":"readiness","path":"/","httpHeaders":[{"name":"X.Dotted","value":"a"},{"name":"X-Order_1","value":"a"},{"name":"X-Quote","value":"it'"'"'s"},{"name":"Bad Name","value":"a"},{"name":"X-Good","value":"ok"}]}]}}'
|
||||
|
||||
run invoke_caddy_docker_args
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Skipping invalid app.json healthcheck header for caddy" 4
|
||||
assert_output_contains "health_headers.X-Good=" 1
|
||||
assert_output_contains "health_headers.X.Dotted" 0
|
||||
assert_output_contains "health_headers.X-Order_1" 0
|
||||
assert_output_contains "health_headers.X-Quote" 0
|
||||
}
|
||||
|
||||
@test "(caddy-vhosts) tls-internal emits caddy.tls=internal alongside https site labels" {
|
||||
STUB_DOMAINS="example.com"
|
||||
STUB_PORTS="$(printf 'http:80:5000\nhttps:443:5000')"
|
||||
STUB_LETSENCRYPT_EMAIL="admin@example.com"
|
||||
STUB_TLS_INTERNAL="true"
|
||||
|
||||
run invoke_caddy_docker_args
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "--label 'caddy=example.com'"
|
||||
assert_output_contains "--label caddy.tls=internal"
|
||||
assert_output_contains "caddy.reverse_proxy="
|
||||
}
|
||||
|
||||
@test "(caddy-vhosts) tls-internal does not emit caddy.tls=internal for http-only sites" {
|
||||
STUB_DOMAINS="example.com"
|
||||
STUB_PORTS="http:80:5000"
|
||||
STUB_TLS_INTERNAL="true"
|
||||
|
||||
run invoke_caddy_docker_args
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "--label 'caddy=example.com:80'"
|
||||
assert_output_contains "caddy.tls=internal" 0
|
||||
}
|
||||
@@ -82,3 +82,16 @@ teardown() {
|
||||
assert_success
|
||||
assert_output "false"
|
||||
}
|
||||
|
||||
@test "(caddy:set) missing app" {
|
||||
run /bin/bash -c "dokku caddy:set missing-app tls-internal true"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "App missing-app does not exist"
|
||||
|
||||
run /bin/bash -c "test -e $DOKKU_LIB_ROOT/config/caddy/missing-app"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
}
|
||||
@@ -429,3 +429,216 @@ teardown() {
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
}
|
||||
|
||||
@test "(caddy:labels:add) concurrent calls for the same app keep every label" {
|
||||
run run_concurrently 20 /bin/bash -c 'dokku caddy:labels:add "$1" "caddy.race$2" value' _ "$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku caddy:labels:show $TEST_APP | grep -c 'caddy\.race[0-9]*=value'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "20"
|
||||
|
||||
run run_concurrently 20 /bin/bash -c 'dokku caddy:labels:remove "$1" "caddy.race$2"' _ "$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku caddy:labels:show $TEST_APP 2>/dev/null | grep -c 'caddy\.race[0-9]*=value'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "0"
|
||||
}
|
||||
|
||||
@test "(caddy) healthcheck labels from app.json" {
|
||||
run /bin/bash -c "dokku proxy:set $TEST_APP caddy"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP setup_caddy_readiness_healthcheck
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"caddy.reverse_proxy.health_uri\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "/"
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"caddy.reverse_proxy.health_interval\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "2s"
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"caddy.reverse_proxy.health_timeout\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "5s"
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"caddy.reverse_proxy.health_headers.Host\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "$TEST_APP.$DOKKU_DOMAIN"
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"caddy.reverse_proxy.lb_try_duration\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "5s"
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"caddy.reverse_proxy.lb_try_interval\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "250ms"
|
||||
|
||||
assert_http_localhost_response "http" "$TEST_APP.dokku.me" "80" "" "python/http.server"
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
assert_http_localhost_response "http" "$TEST_APP.dokku.me" "80" "" "python/http.server"
|
||||
}
|
||||
|
||||
@test "(caddy) healthcheck labels can be overridden" {
|
||||
run /bin/bash -c "dokku proxy:set $TEST_APP caddy"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku caddy:labels:add $TEST_APP caddy.reverse_proxy.lb_try_duration 10s"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP setup_caddy_readiness_healthcheck
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"caddy.reverse_proxy.lb_try_duration\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "10s"
|
||||
|
||||
assert_http_localhost_response "http" "$TEST_APP.dokku.me" "80" "" "python/http.server"
|
||||
}
|
||||
|
||||
@test "(caddy) no healthcheck labels without readiness check" {
|
||||
run /bin/bash -c "dokku proxy:set $TEST_APP caddy"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP convert_to_dockerfile
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"caddy.reverse_proxy.health_uri\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"caddy.reverse_proxy.lb_try_duration\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
}
|
||||
|
||||
@test "(caddy) invalid stored healthcheck path fails restart" {
|
||||
run /bin/bash -c "dokku proxy:set $TEST_APP caddy"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP setup_caddy_readiness_healthcheck
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "jq '.healthchecks.web[0].path = \"/health check\"' /var/lib/dokku/data/app-json/$TEST_APP/app.json > /var/lib/dokku/data/app-json/$TEST_APP/app.json.tmp && mv /var/lib/dokku/data/app-json/$TEST_APP/app.json.tmp /var/lib/dokku/data/app-json/$TEST_APP/app.json"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:restart $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Invalid app.json healthcheck path for caddy" -1
|
||||
}
|
||||
|
||||
@test "(caddy) healthcheck headers from app.json" {
|
||||
run /bin/bash -c "dokku proxy:set $TEST_APP caddy"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP setup_caddy_readiness_healthcheck_headers
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"caddy.reverse_proxy.health_headers.X-Check\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output '"dokku check"'
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"caddy.reverse_proxy.health_fails\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "2"
|
||||
|
||||
sleep 5
|
||||
|
||||
run /bin/bash -c "docker cp caddy-caddy-1:/config/caddy/Caddyfile.autosave - | tar -xO"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains 'X-Check "dokku check"'
|
||||
assert_output_contains "health_fails 2"
|
||||
|
||||
run /bin/bash -c "docker logs caddy-caddy-1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Failed to convert caddyfile" 0
|
||||
|
||||
assert_http_localhost_response "http" "$TEST_APP.dokku.me" "80" "" "python/http.server"
|
||||
}
|
||||
|
||||
setup_caddy_readiness_healthcheck() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
[[ -z "$APP" ]] && local APP="$TEST_APP"
|
||||
APP_REPO_DIR="$(realpath "$APP_REPO_DIR")"
|
||||
|
||||
convert_to_dockerfile "$APP" "$APP_REPO_DIR"
|
||||
mv "$APP_REPO_DIR/app-readiness.json" "$APP_REPO_DIR/app.json"
|
||||
}
|
||||
|
||||
setup_caddy_readiness_healthcheck_headers() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
[[ -z "$APP" ]] && local APP="$TEST_APP"
|
||||
APP_REPO_DIR="$(realpath "$APP_REPO_DIR")"
|
||||
|
||||
convert_to_dockerfile "$APP" "$APP_REPO_DIR"
|
||||
jq '.healthchecks.web[0].attempts = 2 | .healthchecks.web[0].httpHeaders = [{"name": "X-Check", "value": "dokku check"}]' "$APP_REPO_DIR/app-readiness.json" >"$APP_REPO_DIR/app.json"
|
||||
}
|
||||
@@ -53,6 +53,18 @@ teardown() {
|
||||
assert_success
|
||||
assert_output_contains "/$TEST_APP/tls"
|
||||
|
||||
run /bin/bash -c "dokku certs:report $TEST_APP --ssl-fingerprint"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku certs:report $TEST_APP --ssl-serial"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku certs:report $TEST_APP --ssl-invalid-flag"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
@@ -118,6 +130,75 @@ teardown() {
|
||||
assert_output "node-js-app.dokku.me"
|
||||
}
|
||||
|
||||
@test "(certs:report) reports the certificate fingerprint and serial" {
|
||||
local EXPECTED_FINGERPRINT EXPECTED_SERIAL
|
||||
EXPECTED_FINGERPRINT="$(openssl x509 -in "$BATS_TMPDIR/tls/server.crt" -noout -fingerprint -sha256 | cut -d= -f2-)"
|
||||
EXPECTED_SERIAL="$(openssl x509 -in "$BATS_TMPDIR/tls/server.crt" -noout -serial | cut -d= -f2-)"
|
||||
|
||||
run /bin/bash -c "dokku certs:add $TEST_APP $BATS_TMPDIR/tls/server.crt $BATS_TMPDIR/tls/server.key"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku certs:report $TEST_APP --ssl-fingerprint"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "$EXPECTED_FINGERPRINT"
|
||||
|
||||
run /bin/bash -c "dokku certs:report $TEST_APP --ssl-serial"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "$EXPECTED_SERIAL"
|
||||
|
||||
run /bin/bash -c "dokku certs:report $TEST_APP --format json | jq -r '.fingerprint'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "$EXPECTED_FINGERPRINT"
|
||||
|
||||
run /bin/bash -c "dokku certs:report $TEST_APP --format json | jq -r '.serial'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "$EXPECTED_SERIAL"
|
||||
}
|
||||
|
||||
@test "(certs:report) fingerprint and serial follow a replaced certificate" {
|
||||
local EXPECTED_FINGERPRINT EXPECTED_SERIAL
|
||||
EXPECTED_FINGERPRINT="$(openssl x509 -in "$BATS_TMPDIR/tls/domain.com.crt" -noout -fingerprint -sha256 | cut -d= -f2-)"
|
||||
EXPECTED_SERIAL="$(openssl x509 -in "$BATS_TMPDIR/tls/domain.com.crt" -noout -serial | cut -d= -f2-)"
|
||||
|
||||
run /bin/bash -c "dokku certs:add $TEST_APP $BATS_TMPDIR/tls/server.crt $BATS_TMPDIR/tls/server.key"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku certs:report $TEST_APP --ssl-fingerprint"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_not_output "$EXPECTED_FINGERPRINT"
|
||||
|
||||
run /bin/bash -c "dokku certs:update $TEST_APP $BATS_TMPDIR/tls/domain.com.crt $BATS_TMPDIR/tls/domain.com.key"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku certs:report $TEST_APP --ssl-fingerprint"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "$EXPECTED_FINGERPRINT"
|
||||
|
||||
run /bin/bash -c "dokku certs:report $TEST_APP --ssl-serial"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "$EXPECTED_SERIAL"
|
||||
}
|
||||
|
||||
@test "(certs:report) reports the CN and all SANs as hostnames" {
|
||||
local SANS_TLS="$BATS_TMPDIR/tls-sans"
|
||||
mkdir -p "$SANS_TLS"
|
||||
|
||||
@@ -374,3 +374,26 @@ teardown() {
|
||||
assert_output_contains "Failure in name='port listening check': container listening on expected IPv4 interface with an unexpected port: expected=5000 actual=5001"
|
||||
assert_output_contains "Running healthcheck name='port listening check' attempts=3 port=5000 retries=2 timeout=5 type='listening' wait=5"
|
||||
}
|
||||
|
||||
@test "(checks:disable) concurrent calls for the same app keep every process type" {
|
||||
run run_concurrently 20 /bin/bash -c 'dokku checks:disable "$1" "worker$2"' _ "$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku checks:report $TEST_APP --checks-disabled-list | tr ',' '\n' | grep -cx 'worker[0-9]*'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "20"
|
||||
|
||||
run run_concurrently 20 /bin/bash -c 'dokku checks:enable "$1" "worker$2"' _ "$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku checks:report $TEST_APP --checks-disabled-list | tr ',' '\n' | grep -cx 'worker[0-9]*'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "0"
|
||||
}
|
||||
@@ -11,6 +11,7 @@ setup() {
|
||||
}
|
||||
|
||||
teardown() {
|
||||
restore_app_config_dir
|
||||
destroy_app
|
||||
if [[ -f ${DOKKU_LIB_ROOT}/config/--global/ENV.bak ]]; then
|
||||
mv -f ${DOKKU_LIB_ROOT}/config/--global/ENV.bak ${DOKKU_LIB_ROOT}/config/--global/ENV
|
||||
@@ -704,6 +705,131 @@ teardown() {
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(config:set) fails when the config file cannot be written" {
|
||||
run /bin/bash -c "dokku config:set --no-restart $TEST_APP first_key=first_value"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
block_app_config_dir
|
||||
|
||||
run /bin/bash -c "dokku config:set --no-restart $TEST_APP second_key=second_value"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Unable to write config vars"
|
||||
|
||||
restore_app_config_dir
|
||||
|
||||
run /bin/bash -c "dokku config:get $TEST_APP first_key"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "first_value"
|
||||
|
||||
run /bin/bash -c "dokku config:get $TEST_APP second_key"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "(config:unset) fails when the config file cannot be written" {
|
||||
run /bin/bash -c "dokku config:set --no-restart $TEST_APP first_key=first_value"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
block_app_config_dir
|
||||
|
||||
run /bin/bash -c "dokku config:unset --no-restart $TEST_APP first_key"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Unable to write config vars"
|
||||
|
||||
restore_app_config_dir
|
||||
|
||||
run /bin/bash -c "dokku config:get $TEST_APP first_key"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "first_value"
|
||||
}
|
||||
|
||||
@test "(config:clear) fails when the config file cannot be written" {
|
||||
run /bin/bash -c "dokku config:set --no-restart $TEST_APP first_key=first_value"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
block_app_config_dir
|
||||
|
||||
run /bin/bash -c "dokku config:clear --no-restart $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Unable to write config vars"
|
||||
|
||||
restore_app_config_dir
|
||||
|
||||
run /bin/bash -c "dokku config:get $TEST_APP first_key"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "first_value"
|
||||
}
|
||||
|
||||
@test "(config) config-unset plugin trigger reports a failure" {
|
||||
run_plugn_trigger config-unset "$TEST_APP" invalid-key false
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Invalid key name"
|
||||
}
|
||||
|
||||
@test "(config:set) concurrent calls for the same app keep every key" {
|
||||
run run_concurrently 20 /bin/bash -c 'dokku config:set --no-restart "$1" "RACE_KEY_$2=value"' _ "$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku config:keys $TEST_APP | grep -cx 'RACE_KEY_[0-9]*'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "20"
|
||||
|
||||
run run_concurrently 20 /bin/bash -c 'dokku config:unset --no-restart "$1" "RACE_KEY_$2"' _ "$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku config:keys $TEST_APP | grep -cx 'RACE_KEY_[0-9]*'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "0"
|
||||
}
|
||||
|
||||
block_app_config_dir() {
|
||||
declare desc="makes the app config directory unwritable for the dokku user"
|
||||
|
||||
run /bin/bash -c "sudo chown root:root ${DOKKU_LIB_ROOT}/config/$TEST_APP && sudo chmod 0555 ${DOKKU_LIB_ROOT}/config/$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
|
||||
restore_app_config_dir() {
|
||||
declare desc="hands the app config directory back to the dokku user"
|
||||
|
||||
if [[ ! -d "${DOKKU_LIB_ROOT}/config/$TEST_APP" ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
sudo chmod 0755 "${DOKKU_LIB_ROOT}/config/$TEST_APP"
|
||||
sudo chown -R dokku:dokku "${DOKKU_LIB_ROOT}/config/$TEST_APP"
|
||||
}
|
||||
|
||||
stage_stale_env() {
|
||||
declare desc="writes a legacy ENV file at the pre-0.38 path for the test app"
|
||||
|
||||
|
||||
@@ -120,3 +120,85 @@ teardown() {
|
||||
assert_line 0 "--label"
|
||||
assert_line 1 "a b"
|
||||
}
|
||||
|
||||
@test "(common) [preserve-env] fn-sudo-preserve-env-flag emits only the requested names" {
|
||||
run /bin/bash -c "source '$PLUGIN_CORE_AVAILABLE_PATH/common/functions'; fn-sudo-preserve-env-flag DOKKU_TRACE DOKKU_APP_NAME"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "--preserve-env=DOKKU_TRACE,DOKKU_APP_NAME"
|
||||
}
|
||||
|
||||
@test "(common) [preserve-env] fn-sudo-preserve-env-flag omits sudo managed names" {
|
||||
run /bin/bash -c "source '$PLUGIN_CORE_AVAILABLE_PATH/common/functions'; export DOKKU_TEST_CROSSING=1; fn-sudo-preserve-env-flag | sed 's/^--preserve-env=//' | tr ',' '\\n' | grep -cx DOKKU_TEST_CROSSING"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "1"
|
||||
|
||||
run /bin/bash -c "source '$PLUGIN_CORE_AVAILABLE_PATH/common/functions'; fn-sudo-preserve-env-flag | sed 's/^--preserve-env=//' | tr ',' '\\n' | grep -cxE 'HOME|LOGNAME|MAIL|PATH|SHELL|USER|_|SUDO_.*'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "0"
|
||||
}
|
||||
|
||||
@test "(common) [preserve-env] fn-sudo-preserve-env-flag honors DOKKU_PRESERVE_ENV" {
|
||||
run /bin/bash -c "source '$PLUGIN_CORE_AVAILABLE_PATH/common/functions'; DOKKU_PRESERVE_ENV=ALPHA,BETA fn-sudo-preserve-env-flag DOKKU_TRACE"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "--preserve-env=DOKKU_TRACE,ALPHA,BETA"
|
||||
|
||||
run /bin/bash -c "source '$PLUGIN_CORE_AVAILABLE_PATH/common/functions'; DOKKU_PRESERVE_ENV=ALPHA fn-sudo-preserve-env-flag | sed 's/^--preserve-env=//' | tr ',' '\\n' | grep -cx ALPHA"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "1"
|
||||
}
|
||||
|
||||
@test "(common) [preserve-env] fn-cli-preserved-env-names covers every parse_args export" {
|
||||
run /bin/bash -c "source '$PLUGIN_CORE_AVAILABLE_PATH/common/functions'; fn-cli-preserved-env-names | tr ' ' '\\n' | grep -cxE 'DOKKU_APP_NAME|DOKKU_APPS_FORCE_DELETE|DOKKU_GLOBAL_FLAGS|DOKKU_PRESERVE_ENV|DOKKU_QUIET_OUTPUT|DOKKU_TRACE|SSH_USER'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "7"
|
||||
}
|
||||
|
||||
@test "(common) [preserve-env] fn-cli-preserved-env-names covers the docker image build variables" {
|
||||
# neither is read by the dokku script itself, so the derivation test below does not
|
||||
# catch them. both exist only in the environment while the docker image is built
|
||||
run /bin/bash -c "source '$PLUGIN_CORE_AVAILABLE_PATH/common/functions'; fn-cli-preserved-env-names | tr ' ' '\\n' | grep -cxE 'DOKKU_INIT_SYSTEM|DOKKU_LIB_HOST_ROOT'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "2"
|
||||
}
|
||||
|
||||
@test "(common) [preserve-env] every environment-overridable dokku variable is preserved" {
|
||||
# test_helper leaves these unexported, so the single-quoted script below cannot see
|
||||
# them without this
|
||||
export PLUGIN_CORE_AVAILABLE_PATH
|
||||
export DOKKU_SOURCE="${BATS_TEST_DIRNAME}/../../dokku"
|
||||
run /bin/bash -c 'source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"; comm -23 <(grep -oE "[{][A-Z_]+:=" "$DOKKU_SOURCE" | tr -cd "A-Z_\n" | sort -u | grep -vx DOKKU_PID) <(fn-cli-preserved-env-names | tr " " "\n" | sort -u)'
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output ""
|
||||
unset DOKKU_SOURCE
|
||||
}
|
||||
|
||||
@test "(common) [preserve-env] parse_args records global flags for replay" {
|
||||
run /bin/bash -c "source '$PLUGIN_CORE_AVAILABLE_PATH/common/functions'; parse_args --label=a=b run foo env; echo \"\$DOKKU_GLOBAL_FLAGS\""
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "--label=a=b"
|
||||
}
|
||||
|
||||
@test "(core) cleanup missing app" {
|
||||
run /bin/bash -c "dokku cleanup missing-app"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "App missing-app does not exist"
|
||||
}
|
||||
@@ -37,6 +37,14 @@ teardown() {
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(core) ssh arguments are passed through unchanged" {
|
||||
run ssh "dokku@$DOKKU_DOMAIN" fakecommand --version --help -n -e -E
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains '`fakecommand --version --help -n -e -E` is not a dokku command.'
|
||||
}
|
||||
|
||||
@test "(core) urls (non-ssl)" {
|
||||
assert_urls "http://${TEST_APP}.${DOKKU_DOMAIN}"
|
||||
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
create_app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
destroy_app
|
||||
global_teardown
|
||||
}
|
||||
|
||||
@test "(core) [global-flags] --quiet crosses the privilege drop" {
|
||||
run /bin/bash -c "dokku apps:list"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "My Apps"
|
||||
|
||||
run /bin/bash -c "dokku --quiet apps:list"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_contains "My Apps"
|
||||
assert_output_contains "$TEST_APP"
|
||||
}
|
||||
|
||||
@test "(core) [global-flags] --trace crosses the privilege drop" {
|
||||
run /bin/bash -c "dokku --trace apps:list 2>&1 >/dev/null"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "execute_dokku_cmd"
|
||||
}
|
||||
|
||||
@test "(core) [global-flags] --force crosses the privilege drop" {
|
||||
local force_app="${TEST_APP}-force"
|
||||
run /bin/bash -c "dokku apps:create $force_app"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --force apps:destroy $force_app </dev/null"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_contains "To proceed, type"
|
||||
}
|
||||
|
||||
@test "(core) [global-flags] --app crosses the privilege drop" {
|
||||
run /bin/bash -c "dokku --app $TEST_APP config:set --no-restart TEST_PRESERVED=crossed"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku config:get $TEST_APP TEST_PRESERVED"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "crossed"
|
||||
}
|
||||
|
||||
@test "(core) [global-flags] a clean invocation writes nothing to stderr" {
|
||||
run /bin/bash -c "dokku apps:list 2>&1 >/dev/null"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output ""
|
||||
}
|
||||
|
||||
@test "(core) [global-flags] the caller environment crosses the privilege drop" {
|
||||
run /bin/bash -c "DOKKU_QUIET_OUTPUT=1 dokku apps:list"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_contains "My Apps"
|
||||
assert_output_contains "$TEST_APP"
|
||||
}
|
||||
|
||||
@test "(core) [global-flags] an unlisted variable only crosses when DOKKU_PRESERVE_ENV names it" {
|
||||
# DOKKU_TRACE is set in the environment rather than passed as --trace so that the
|
||||
# parent traces too: the sudo line naming the forwarded variables is only emitted there
|
||||
run /bin/bash -c "DOKKU_TRACE=1 DOKKU_TEST_CROSSING=1 dokku apps:list 2>&1 >/dev/null | grep -o -- '--preserve-env=[^ ]*' | head -1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "--preserve-env="
|
||||
assert_output_not_contains "DOKKU_TEST_CROSSING"
|
||||
|
||||
run /bin/bash -c "DOKKU_TRACE=1 DOKKU_PRESERVE_ENV=DOKKU_TEST_CROSSING DOKKU_TEST_CROSSING=1 dokku apps:list 2>&1 >/dev/null | grep -o -- '--preserve-env=[^ ]*' | head -1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "DOKKU_TEST_CROSSING"
|
||||
}
|
||||
|
||||
@test "(core) [global-flags] the system sudo supports a named preserve-env list" {
|
||||
run /bin/bash -c "DOKKU_TEST_CROSSING=1 sudo -u dokku --preserve-env=DOKKU_TEST_CROSSING -H /usr/bin/env | grep -cxE 'DOKKU_TEST_CROSSING=1|HOME=/home/dokku'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "2"
|
||||
}
|
||||
@@ -104,6 +104,54 @@ teardown() {
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "(cron) injected json entries" {
|
||||
cat >/var/lib/dokku/plugins/enabled/cron-entries/cron-entries <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
[[ "$2" == "json" ]] || exit 0
|
||||
echo '@daily;/bin/true'
|
||||
echo '{"schedule":"@hourly","command":"/bin/false","log-file":"/var/log/dokku/log.log","mailto":"ops@example.com"}'
|
||||
EOF
|
||||
chmod +x /var/lib/dokku/plugins/enabled/cron-entries/cron-entries
|
||||
|
||||
run /bin/bash -c "dokku cron:set --global mailto global@example.com"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku plugin:trigger scheduler-cron-write"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "cat /var/spool/cron/crontabs/dokku"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
# once in the header, and once to reset it after the task with its own
|
||||
assert_output_contains "MAILTO=global@example.com" 2
|
||||
assert_output_contains "@daily /bin/true"
|
||||
assert_output_contains "MAILTO=ops@example.com"
|
||||
assert_output_contains "@hourly /bin/false 2>&1 | tee -a /var/log/dokku/log.log"
|
||||
|
||||
# the global MAILTO is restored for every task after the one with its own
|
||||
run /bin/bash -c "grep -A1 -F 'tee -a /var/log/dokku/log.log' /var/spool/cron/crontabs/dokku | tail -n 1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "MAILTO=global@example.com"
|
||||
|
||||
run /bin/bash -c "dokku cron:list --global --format json | jq -r '.[] | select(.schedule == \"@hourly\") | .mailto'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "ops@example.com"
|
||||
|
||||
run /bin/bash -c "dokku cron:set --global mailto"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(cron) invalid [command]" {
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP template_cron_file_injection
|
||||
echo "output: $output"
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
TEST_SERVICE="ds-test-service"
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
create_app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
dokku datastore:unlink redis "$TEST_SERVICE" "$TEST_APP" --no-restart >/dev/null 2>&1 || true
|
||||
dokku datastore:destroy redis "$TEST_SERVICE" --force >/dev/null 2>&1 || true
|
||||
destroy_app
|
||||
global_teardown
|
||||
}
|
||||
|
||||
@test "(datastore) datastore:help" {
|
||||
run /bin/bash -c "dokku datastore"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Manage datastore services."
|
||||
assert_output_contains "datastore:create <datastore-type> <service>"
|
||||
help_output="$output"
|
||||
|
||||
run /bin/bash -c "dokku datastore:help"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "$help_output"
|
||||
|
||||
run /bin/bash -c "dokku datastore:help redis"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "dokku datastore:list redis"
|
||||
|
||||
run /bin/bash -c "dokku datastore:help redis create"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "dokku datastore:create redis <service>"
|
||||
|
||||
run /bin/bash -c "dokku datastore:help nonsense"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku help --all"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "datastore:create <datastore-type> <service>"
|
||||
}
|
||||
|
||||
@test "(datastore) datastore:version" {
|
||||
run /bin/bash -c "dokku datastore:version"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "v"
|
||||
}
|
||||
|
||||
@test "(datastore) create, link, unlink and destroy a service" {
|
||||
run /bin/bash -c "dokku datastore:create redis $TEST_SERVICE"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku datastore:exists redis $TEST_SERVICE"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku datastore:list redis"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "$TEST_SERVICE"
|
||||
|
||||
run /bin/bash -c "dokku datastore:link redis $TEST_SERVICE $TEST_APP --no-restart"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku config:get $TEST_APP REDIS_URL"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "redis://"
|
||||
|
||||
run /bin/bash -c "dokku datastore:unlink redis $TEST_SERVICE $TEST_APP --no-restart"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku config:get $TEST_APP REDIS_URL"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku datastore:destroy redis $TEST_SERVICE --force"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku datastore:exists redis $TEST_SERVICE"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "(datastore) deleting an app unlinks its services" {
|
||||
run /bin/bash -c "dokku datastore:create redis $TEST_SERVICE"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku datastore:link redis $TEST_SERVICE $TEST_APP --no-restart"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --force apps:destroy $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku datastore:linked redis $TEST_SERVICE $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
create_app
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
LOCK_DIR="$(mktemp -d "/tmp/${DOKKU_DOMAIN}.XXXXX")"
|
||||
LOCK_FILE="$LOCK_DIR/test.lock"
|
||||
LOCK_PIDS=()
|
||||
}
|
||||
|
||||
teardown() {
|
||||
local pid
|
||||
touch "$LOCK_DIR/release"
|
||||
for pid in "${LOCK_PIDS[@]}"; do
|
||||
kill "$pid" &>/dev/null || true
|
||||
done
|
||||
rm -rf "$LOCK_DIR"
|
||||
global_teardown
|
||||
}
|
||||
|
||||
lock_script() {
|
||||
declare BUILD_ID="$1" SCRIPT="$2"
|
||||
echo "source '$PLUGIN_CORE_AVAILABLE_PATH/common/functions'; export DOKKU_BUILD_ID='$BUILD_ID'; $SCRIPT"
|
||||
}
|
||||
|
||||
start_lock_holder() {
|
||||
declare BUILD_ID="$1"
|
||||
/bin/bash -c "$(lock_script "$BUILD_ID" "acquire_advisory_lock '$LOCK_FILE' exclusive 'waiting' 'lock held'; while [[ ! -f '$LOCK_DIR/release' ]]; do sleep 0.2; done; release_advisory_lock '$LOCK_FILE'")" >/dev/null 2>&1 3>&- &
|
||||
LOCK_PIDS+=("$!")
|
||||
wait_for "[[ \"\$(cat '$LOCK_FILE' 2>/dev/null)\" == '$BUILD_ID' ]]"
|
||||
}
|
||||
|
||||
wait_for() {
|
||||
declare CONDITION="$1"
|
||||
local i
|
||||
for i in $(seq 1 50); do
|
||||
if eval "$CONDITION"; then
|
||||
return 0
|
||||
fi
|
||||
sleep 0.2
|
||||
done
|
||||
|
||||
echo "timed out waiting for: $CONDITION"
|
||||
return 1
|
||||
}
|
||||
|
||||
@test "(deploy-lock) a failed acquire does not truncate the lock holder's build id" {
|
||||
start_lock_holder "holder-a"
|
||||
|
||||
run /bin/bash -c "$(lock_script "other" "acquire_advisory_lock '$LOCK_FILE' exclusive 'waiting' 'lock held'")"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "lock held"
|
||||
|
||||
run /bin/bash -c "cat '$LOCK_FILE'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "holder-a"
|
||||
}
|
||||
|
||||
@test "(deploy-lock) a waiter does not keep a stale lock after the holder removes the lock file" {
|
||||
start_lock_holder "holder-a"
|
||||
|
||||
/bin/bash -c "$(lock_script "holder-b" "acquire_advisory_lock '$LOCK_FILE' waiting 'waiting' 'lock held'; touch '$LOCK_DIR/b.acquired'; exec sleep 60")" >"$LOCK_DIR/b.log" 2>&1 3>&- &
|
||||
local B_PID="$!"
|
||||
LOCK_PIDS+=("$B_PID")
|
||||
wait_for "grep -q waiting '$LOCK_DIR/b.log'"
|
||||
|
||||
touch "$LOCK_DIR/release"
|
||||
wait_for "[[ -f '$LOCK_DIR/b.acquired' ]]"
|
||||
|
||||
run /bin/bash -c "[[ /proc/$B_PID/fd/200 -ef '$LOCK_FILE' ]]"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "cat '$LOCK_FILE'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "holder-b"
|
||||
|
||||
run /bin/bash -c "$(lock_script "holder-c" "acquire_advisory_lock '$LOCK_FILE' exclusive 'waiting' 'lock held'")"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "lock held"
|
||||
}
|
||||
|
||||
@test "(deploy-lock) the lock file is removed when the holder exits without releasing it" {
|
||||
run /bin/bash -c "$(lock_script "holder-a" "acquire_advisory_lock '$LOCK_FILE' exclusive 'waiting' 'lock held'; exit 1")"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "[[ ! -e '$LOCK_FILE' ]]"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(deploy-lock) the lock file is removed when the holder is terminated" {
|
||||
start_lock_holder "holder-a"
|
||||
|
||||
kill -TERM "${LOCK_PIDS[0]}"
|
||||
wait_for "! kill -0 ${LOCK_PIDS[0]} 2>/dev/null"
|
||||
|
||||
run /bin/bash -c "[[ ! -e '$LOCK_FILE' ]]"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(deploy-lock) release only removes the lock file it holds" {
|
||||
start_lock_holder "holder-a"
|
||||
|
||||
run /bin/bash -c "rm -f '$LOCK_FILE' && echo 'replacement' >'$LOCK_FILE'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
touch "$LOCK_DIR/release"
|
||||
wait_for "! kill -0 ${LOCK_PIDS[0]} 2>/dev/null"
|
||||
|
||||
run /bin/bash -c "cat '$LOCK_FILE'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "replacement"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
setup() {
|
||||
DOKKU_TEST_TMPDIR="$(mktemp -d)"
|
||||
export DOKKU_TEST_ARGS_FILE="$DOKKU_TEST_TMPDIR/args"
|
||||
export PLUGIN_CORE_AVAILABLE_PATH="$DOKKU_TEST_TMPDIR/plugin"
|
||||
|
||||
mkdir -p "$PLUGIN_CORE_AVAILABLE_PATH/common"
|
||||
cat >"$PLUGIN_CORE_AVAILABLE_PATH/common/common" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
printf '%s\n' "$@" > "$DOKKU_TEST_ARGS_FILE"
|
||||
EOF
|
||||
chmod +x "$PLUGIN_CORE_AVAILABLE_PATH/common/common"
|
||||
|
||||
source "$BATS_TEST_DIRNAME/../../plugins/common/functions"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
rm -rf "$DOKKU_TEST_TMPDIR"
|
||||
}
|
||||
|
||||
@test "docker_cleanup forwards the manual force flag to the core command" {
|
||||
run docker_cleanup --global true
|
||||
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$(cat "$DOKKU_TEST_ARGS_FILE")" = $'--quiet\ndocker-cleanup\n--global\ntrue' ]
|
||||
}
|
||||
@@ -316,6 +316,29 @@ teardown() {
|
||||
assert_output_contains "running"
|
||||
}
|
||||
|
||||
@test "(docker-options:add) concurrent calls for the same app keep every option" {
|
||||
run run_concurrently 20 /bin/bash -c 'dokku docker-options:add "$1" deploy "--label=race$2"' _ "$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku docker-options:list $TEST_APP --phase deploy | grep -cx -- '--label=race[0-9]*'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "20"
|
||||
|
||||
run run_concurrently 20 /bin/bash -c 'dokku docker-options:remove "$1" deploy "--label=race$2"' _ "$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku docker-options:list $TEST_APP --phase deploy | grep -cx -- '--label=race[0-9]*'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "0"
|
||||
}
|
||||
|
||||
web_worker_callback() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
|
||||
@@ -136,6 +136,20 @@ teardown() {
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "(domains) domains:enable and domains:disable (missing app)" {
|
||||
run /bin/bash -c "dokku domains:disable missing-app"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "App missing-app does not exist"
|
||||
|
||||
run /bin/bash -c "dokku domains:enable missing-app"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "App missing-app does not exist"
|
||||
}
|
||||
|
||||
@test "(domains) domains:remove" {
|
||||
run /bin/bash -c "dokku domains:add $TEST_APP test.app.${DOKKU_DOMAIN}"
|
||||
echo "output: $output"
|
||||
@@ -519,3 +533,28 @@ teardown() {
|
||||
assert_success
|
||||
assert_output "http:2019:2019 http:80:80 https:443:443 udp:443:443"
|
||||
}
|
||||
|
||||
@test "(domains) urls do not glob expand a catch-all domain" {
|
||||
local tmp_dir
|
||||
tmp_dir="$(mktemp -d)"
|
||||
touch "$tmp_dir/glob-canary"
|
||||
chmod 755 "$tmp_dir"
|
||||
|
||||
run /bin/bash -c "dokku proxy:set $TEST_APP caddy"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku domains:set $TEST_APP '*'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "cd $tmp_dir && dokku urls $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
rm -rf "$tmp_dir"
|
||||
assert_success
|
||||
assert_output_contains "glob-canary" 0
|
||||
assert_output_contains "http://*"
|
||||
}
|
||||
+115
-9
@@ -185,12 +185,18 @@ teardown() {
|
||||
run /bin/bash -c "dokku git:auth-status"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_exit_status 3
|
||||
assert_output_contains "Please supply a git host"
|
||||
|
||||
run /bin/bash -c "dokku git:auth-status github.com"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_exit_status 0
|
||||
|
||||
run /bin/bash -c "dokku git:auth-status github.com username password"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 1
|
||||
|
||||
run /bin/bash -c "dokku git:auth github.com username password"
|
||||
echo "output: $output"
|
||||
@@ -200,38 +206,85 @@ teardown() {
|
||||
run /bin/bash -c "dokku git:auth-status github.com"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_exit_status 2
|
||||
|
||||
run /bin/bash -c "dokku git:auth-status github.com username password"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_exit_status 0
|
||||
|
||||
run /bin/bash -c "dokku git:auth-status github.com username wrong-password"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_exit_status 2
|
||||
|
||||
run /bin/bash -c "dokku git:auth-status github.com other-username password"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_exit_status 2
|
||||
|
||||
run /bin/bash -c "dokku git:auth-status github.com username"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_exit_status 3
|
||||
assert_output_contains "Missing password for netrc auth entry"
|
||||
|
||||
run /bin/bash -c "printf 'password' | dokku git:auth-status github.com username"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_exit_status 0
|
||||
|
||||
run /bin/bash -c "printf 'wrong-password' | dokku git:auth-status github.com username"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_exit_status 2
|
||||
}
|
||||
|
||||
@test "(git:auth-status) distinguishes a missing entry from a differing entry" {
|
||||
run /bin/bash -c "dokku git:auth auth-status.example.com"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku git:auth-status auth-status.example.com username password"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 1
|
||||
|
||||
run /bin/bash -c "dokku git:auth-status auth-status.example.com"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 0
|
||||
|
||||
run /bin/bash -c "dokku git:auth auth-status.example.com username password"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku git:auth-status auth-status.example.com username password"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 0
|
||||
|
||||
run /bin/bash -c "dokku git:auth-status auth-status.example.com username other-password"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 2
|
||||
|
||||
run /bin/bash -c "dokku git:auth-status auth-status.example.com"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 2
|
||||
|
||||
run /bin/bash -c "dokku git:auth auth-status.example.com"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku git:auth-status auth-status.example.com username password"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 1
|
||||
}
|
||||
|
||||
@test "(git) git:sync new [errors]" {
|
||||
@@ -342,6 +395,59 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "$SMOKE_TEST_APP_MASTER_SHA"
|
||||
|
||||
# the no-op tick must not add a record of its own, and must leave the
|
||||
# succeeded record of the build above untouched
|
||||
run /bin/bash -c "ls $DOKKU_LIB_ROOT/data/builds/$TEST_APP/*.json 2>/dev/null | wc -l"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "1"
|
||||
|
||||
run /bin/bash -c "dokku builds:list $TEST_APP --format json"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains '"status":"succeeded"'
|
||||
assert_output_not_contains '"display_status":"abandoned"'
|
||||
}
|
||||
|
||||
@test "(git) git:sync new [no build leaves no build record]" {
|
||||
run /bin/bash -c "rm -rf $DOKKU_LIB_ROOT/data/builds/$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# a sync with no build flag builds nothing, so it should record nothing
|
||||
run /bin/bash -c "dokku git:sync $TEST_APP https://github.com/dokku/smoke-test-app.git"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "ls $DOKKU_LIB_ROOT/data/builds/$TEST_APP/*.json 2>/dev/null | wc -l"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "0"
|
||||
|
||||
# and neither should a --build-if-changes poll that finds no changes
|
||||
run /bin/bash -c "dokku git:sync --build-if-changes $TEST_APP https://github.com/dokku/smoke-test-app.git"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Skipping build as no changes were detected"
|
||||
|
||||
run /bin/bash -c "ls $DOKKU_LIB_ROOT/data/builds/$TEST_APP/*.json 2>/dev/null | wc -l"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "0"
|
||||
|
||||
run /bin/bash -c "ls $DOKKU_LIB_ROOT/data/builds/$TEST_APP/*.log 2>/dev/null | wc -l"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "0"
|
||||
}
|
||||
|
||||
@test "(git) git:sync new [--build branch]" {
|
||||
|
||||
@@ -10,11 +10,49 @@ setup() {
|
||||
}
|
||||
|
||||
teardown() {
|
||||
release_deploy_lock
|
||||
docker image rm "dokku-test/$TEST_APP:second-procfile" "dokku-test/$TEST_APP:default-procfile" &>/dev/null || true
|
||||
rm -f /home/dokku/.ssh/id_rsa.pub || true
|
||||
destroy_app
|
||||
global_teardown
|
||||
}
|
||||
|
||||
build_python_image() {
|
||||
declare TAG="$1" PROCFILE="$2"
|
||||
local TMP_IMAGE_DIR exit_code=0
|
||||
TMP_IMAGE_DIR="$(mktemp -d "/tmp/${DOKKU_DOMAIN}.XXXXX")"
|
||||
cp -r "${BATS_TEST_DIRNAME}/../../tests/apps/python/." "$TMP_IMAGE_DIR"
|
||||
if [[ -n "$PROCFILE" ]]; then
|
||||
cp "$TMP_IMAGE_DIR/$PROCFILE" "$TMP_IMAGE_DIR/Procfile"
|
||||
fi
|
||||
|
||||
docker image build --label "com.dokku.test-app=$TEST_APP" -t "dokku-test/$TEST_APP:$TAG" -f "$TMP_IMAGE_DIR/alt.Dockerfile" "$TMP_IMAGE_DIR" || exit_code="$?"
|
||||
rm -rf "$TMP_IMAGE_DIR"
|
||||
return "$exit_code"
|
||||
}
|
||||
|
||||
deploy_second_procfile_image() {
|
||||
run build_python_image second-procfile second.Procfile
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku git:from-image $TEST_APP dokku-test/$TEST_APP:second-procfile"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku plugin:trigger procfile-get-command $TEST_APP web 5001"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "second.Procfile"
|
||||
}
|
||||
|
||||
deploy_branch_rev() {
|
||||
sudo -u dokku git -C "/home/dokku/$TEST_APP" rev-parse master
|
||||
}
|
||||
|
||||
@test "(git) git:from-image [missing]" {
|
||||
run /bin/bash -c "dokku git:from-image $TEST_APP dokku/python:missing-tag"
|
||||
echo "output: $output"
|
||||
@@ -50,11 +88,21 @@ teardown() {
|
||||
assert_output_contains "Image exists on host, skipping pull"
|
||||
assert_output_contains "No changes detected, skipping git commit"
|
||||
|
||||
run /bin/bash -c "dokku apps:locked $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku git:from-image --force $TEST_APP linuxserver/foldingathome:7.6.21"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output_contains "Force pulling image"
|
||||
assert_output_contains "No changes detected, skipping git commit"
|
||||
|
||||
run /bin/bash -c "dokku apps:locked $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "(git) git:from-image [normal-custom-branch]" {
|
||||
@@ -141,6 +189,17 @@ teardown() {
|
||||
assert_failure
|
||||
assert_output "fatal: this operation must be run in a work tree"
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku apps:locked $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku config:set --no-restart $TEST_APP FAIL_ON_STARTUP=false"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
@@ -151,6 +210,12 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "dokku-test/$TEST_APP:latest"
|
||||
|
||||
run /bin/bash -c "dokku config:set --no-restart $TEST_APP FAIL_ON_STARTUP=true"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
@@ -161,6 +226,17 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku apps:locked $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "dokku-test/$TEST_APP:latest"
|
||||
|
||||
run /bin/bash -c "dokku config:set --no-restart $TEST_APP FAIL_ON_STARTUP=false"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
@@ -172,6 +248,12 @@ teardown() {
|
||||
assert_success
|
||||
assert_output_contains "No changes detected, skipping git commit" 0
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "dokku-test/$TEST_APP:v2"
|
||||
|
||||
run /bin/bash -c "docker image rm dokku-test/$TEST_APP:latest dokku-test/$TEST_APP:v2"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
@@ -249,3 +331,235 @@ EOF
|
||||
assert_success
|
||||
assert_output_contains "linuxserver/foldingathome:7.6.21"
|
||||
}
|
||||
|
||||
@test "(git) git:from-image source-image after failed deploy and ps:rebuild" {
|
||||
deploy_second_procfile_image
|
||||
|
||||
run build_python_image default-procfile
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku config:set --no-restart $TEST_APP FAIL_ON_STARTUP=true"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku git:from-image $TEST_APP dokku-test/$TEST_APP:default-procfile"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "dokku-test/$TEST_APP:second-procfile"
|
||||
|
||||
run /bin/bash -c "dokku config:set --no-restart $TEST_APP FAIL_ON_STARTUP=false"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "dokku-test/$TEST_APP:second-procfile"
|
||||
|
||||
run /bin/bash -c "dokku plugin:trigger procfile-get-command $TEST_APP web 5001"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "second.Procfile"
|
||||
assert_output_contains "first.Procfile" 0
|
||||
}
|
||||
|
||||
@test "(git) git:from-image then git:from-archive ignores the previous source-image" {
|
||||
deploy_second_procfile_image
|
||||
|
||||
run /bin/bash -c "dokku config:set --no-restart $TEST_APP FAIL_ON_STARTUP=true"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "tar -C ${BATS_TEST_DIRNAME}/../../tests/apps -cf - python | dokku git:from-archive $TEST_APP --"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "dokku-test/$TEST_APP:second-procfile"
|
||||
|
||||
run /bin/bash -c "dokku config:set --no-restart $TEST_APP FAIL_ON_STARTUP=false"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "tar -C ${BATS_TEST_DIRNAME}/../../tests/apps -cf - python | dokku git:from-archive $TEST_APP --"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku plugin:trigger procfile-get-command $TEST_APP web 5001"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "first.Procfile"
|
||||
assert_output_contains "second.Procfile" 0
|
||||
}
|
||||
|
||||
@test "(git) git:from-image then git push ignores the previous source-image" {
|
||||
local TMP=$(mktemp -d "/tmp/${DOKKU_DOMAIN}.XXXXX")
|
||||
trap 'rm -rf "$TMP"' INT TERM
|
||||
|
||||
deploy_second_procfile_image
|
||||
|
||||
rmdir "$TMP" && cp -r "${BATS_TEST_DIRNAME}/../../tests/apps/python" "$TMP"
|
||||
run /bin/bash -c "cd $TMP && git init -q && git checkout -q -b master && git config user.email 'robot@example.com' && git config user.name 'Test Robot' && git add . && git commit -q -m 'initial commit' && git push --force dokku@${DOKKU_DOMAIN}:$TEST_APP master:master"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
rm -rf "$TMP"
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku plugin:trigger procfile-get-command $TEST_APP web 5001"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "first.Procfile"
|
||||
assert_output_contains "second.Procfile" 0
|
||||
}
|
||||
|
||||
@test "(git) git:from-image then git:sync clears the source-image" {
|
||||
deploy_second_procfile_image
|
||||
|
||||
run /bin/bash -c "dokku git:sync $TEST_APP https://github.com/dokku/smoke-test-app.git 2.0.0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku git:from-image $TEST_APP dokku-test/$TEST_APP:second-procfile"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "dokku-test/$TEST_APP:second-procfile"
|
||||
|
||||
run /bin/bash -c "dokku git:sync --build $TEST_APP https://github.com/dokku/smoke-test-app.git 2.0.0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output ""
|
||||
}
|
||||
|
||||
@test "(git) source-image is unchanged when the deploy lock is held" {
|
||||
deploy_second_procfile_image
|
||||
|
||||
run build_python_image default-procfile
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
local DEPLOY_REV
|
||||
DEPLOY_REV="$(deploy_branch_rev)"
|
||||
echo "deploy branch rev: $DEPLOY_REV"
|
||||
|
||||
hold_deploy_lock
|
||||
|
||||
run /bin/bash -c "dokku git:from-image $TEST_APP dokku-test/$TEST_APP:default-procfile"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "currently has a deploy lock in place"
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "dokku-test/$TEST_APP:second-procfile"
|
||||
|
||||
run deploy_branch_rev
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "$DEPLOY_REV"
|
||||
|
||||
run /bin/bash -c "cat $DEPLOY_LOCK_FILE"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "test-lock-holder"
|
||||
|
||||
run /bin/bash -c "dokku git:sync $TEST_APP https://github.com/dokku/smoke-test-app.git 2.0.0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "currently has a deploy lock in place"
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "dokku-test/$TEST_APP:second-procfile"
|
||||
|
||||
run deploy_branch_rev
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "$DEPLOY_REV"
|
||||
|
||||
run /bin/bash -c "cat $DEPLOY_LOCK_FILE"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "test-lock-holder"
|
||||
|
||||
release_deploy_lock
|
||||
|
||||
run /bin/bash -c "dokku git:from-image $TEST_APP dokku-test/$TEST_APP:default-procfile"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "No changes detected, skipping git commit" 0
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "dokku-test/$TEST_APP:default-procfile"
|
||||
}
|
||||
@@ -154,6 +154,12 @@ teardown() {
|
||||
assert_failure
|
||||
assert_output "fatal: this operation must be run in a work tree"
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku config:set --no-restart $TEST_APP FAIL_ON_STARTUP=false"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
@@ -164,6 +170,12 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "dokku-test/$TEST_APP:latest"
|
||||
|
||||
run /bin/bash -c "dokku config:set --no-restart $TEST_APP FAIL_ON_STARTUP=true"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
@@ -174,6 +186,12 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "dokku-test/$TEST_APP:latest"
|
||||
|
||||
run /bin/bash -c "dokku config:set --no-restart $TEST_APP FAIL_ON_STARTUP=false"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
@@ -184,6 +202,12 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "No changes detected, skipping git commit" 0
|
||||
|
||||
run /bin/bash -c "dokku git:report $TEST_APP --git-source-image"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "dokku-test/$TEST_APP:v2"
|
||||
}
|
||||
|
||||
@test "(git) git:load-image [onbuild]" {
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
APP_FILTER_PLUGIN_NAME="app-filter-test"
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
create_app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
rm -rf "${PLUGIN_ENABLED_PATH:?}/$APP_FILTER_PLUGIN_NAME" "${PLUGIN_AVAILABLE_PATH:?}/$APP_FILTER_PLUGIN_NAME"
|
||||
rm -rf /tmp/hidden-app-clone
|
||||
destroy_app
|
||||
global_teardown
|
||||
}
|
||||
|
||||
@test "(git) push to filtered app" {
|
||||
run deploy_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
setup_app_filter_plugin "$TEST_APP"
|
||||
|
||||
run /bin/bash -c "dokku apps:exists $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "cd /tmp && rm -rf hidden-app-clone && cp -r $BATS_TEST_DIRNAME/../../tests/apps/python hidden-app-clone && cd hidden-app-clone && git init -q && git add . && git -c user.email=robot@example.com -c user.name=Robot commit -qm second && git push -f dokku@$DOKKU_DOMAIN:$TEST_APP HEAD:master"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "App $TEST_APP does not exist"
|
||||
assert_output_not_contains "pre-receive hook declined"
|
||||
}
|
||||
|
||||
@test "(git) clone of filtered app" {
|
||||
run deploy_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
setup_app_filter_plugin "$TEST_APP"
|
||||
|
||||
run /bin/bash -c "git clone dokku@$DOKKU_DOMAIN:$TEST_APP /tmp/hidden-app-clone"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "App $TEST_APP does not exist"
|
||||
}
|
||||
|
||||
@test "(git) archive of filtered app" {
|
||||
run deploy_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
setup_app_filter_plugin "$TEST_APP"
|
||||
|
||||
run /bin/bash -c "set -o pipefail; git archive --remote=dokku@$DOKKU_DOMAIN:$TEST_APP master | tar -t"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "App $TEST_APP does not exist"
|
||||
}
|
||||
|
||||
setup_app_filter_plugin() {
|
||||
declare desc="installs a plugin that filters out a single app"
|
||||
declare FILTERED_APP="$1"
|
||||
local PLUGIN_DIR="$PLUGIN_AVAILABLE_PATH/$APP_FILTER_PLUGIN_NAME"
|
||||
mkdir -p "$PLUGIN_DIR"
|
||||
|
||||
cat <<EOF >"$PLUGIN_DIR/plugin.toml"
|
||||
[plugin]
|
||||
description = "test plugin filtering out a single app"
|
||||
version = "0.1.0"
|
||||
[plugin.config]
|
||||
EOF
|
||||
|
||||
cat <<EOF >"$PLUGIN_DIR/user-auth-app"
|
||||
#!/usr/bin/env bash
|
||||
shift 2
|
||||
for app in "\$@"; do
|
||||
[[ "\$app" == "$FILTERED_APP" ]] || echo "\$app"
|
||||
done
|
||||
EOF
|
||||
chmod +x "$PLUGIN_DIR/user-auth-app"
|
||||
|
||||
dokku plugin:enable "$APP_FILTER_PLUGIN_NAME"
|
||||
}
|
||||
@@ -246,6 +246,12 @@ teardown() {
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"haproxy.$TEST_APP-web.certbot\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
run /bin/bash -c "dokku ports:report $TEST_APP --ports-map"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
REPO_ROOT="$(cd "$BATS_TEST_DIRNAME/../.." && pwd)"
|
||||
HOST_ARCH="$(dpkg --print-architecture)"
|
||||
OTHER_ARCH="amd64"
|
||||
if [[ "$HOST_ARCH" == "amd64" ]]; then
|
||||
OTHER_ARCH="arm64"
|
||||
fi
|
||||
}
|
||||
|
||||
@test "(makefile) [arch] dependency urls default to the host architecture" {
|
||||
run make -n -C "$REPO_ROOT" docker-image-labeler
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "$(dependency_url docker-image-labeler "$HOST_ARCH")" -1
|
||||
}
|
||||
|
||||
@test "(makefile) [arch] TARGETARCH overrides the dependency architecture" {
|
||||
run env TARGETARCH="$OTHER_ARCH" make -n -C "$REPO_ROOT" docker-image-labeler
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "$(dependency_url docker-image-labeler "$OTHER_ARCH")" -1
|
||||
}
|
||||
|
||||
@test "(makefile) [arch] plugin builds default to the host architecture" {
|
||||
run make -B -n -C "$REPO_ROOT" go-build-plugin PLUGIN_NAME=common PLUGIN_MAKE_TARGET=build
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "GOARCH=$HOST_ARCH go build" -1
|
||||
assert_output_contains "GOARCH=$OTHER_ARCH" 0
|
||||
}
|
||||
|
||||
@test "(makefile) [arch] TARGETARCH sets the plugin build architecture" {
|
||||
run env TARGETARCH="$OTHER_ARCH" make -B -n -C "$REPO_ROOT" go-build-plugin PLUGIN_NAME=common PLUGIN_MAKE_TARGET=build
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "GOARCH=$OTHER_ARCH go build" -1
|
||||
assert_output_contains "GOARCH=$HOST_ARCH" 0
|
||||
}
|
||||
|
||||
@test "(makefile) [arch] GOARCH overrides the plugin build architecture" {
|
||||
run env GOARCH="$OTHER_ARCH" make -B -n -C "$REPO_ROOT" go-build-plugin PLUGIN_NAME=common PLUGIN_MAKE_TARGET=build
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "GOARCH=$OTHER_ARCH go build" -1
|
||||
assert_output_contains "GOARCH=$HOST_ARCH" 0
|
||||
|
||||
run env GOARCH="$OTHER_ARCH" make -n -C "$REPO_ROOT" docker-image-labeler
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "$(dependency_url docker-image-labeler "$HOST_ARCH")" -1
|
||||
}
|
||||
|
||||
dependency_url() {
|
||||
declare desc="print the url for a dependency in contrib/dependencies.json"
|
||||
declare NAME="$1" ARCH="$2"
|
||||
jq -r --arg name "$NAME" --arg arch "$ARCH" '.dependencies[] | select(.name == $name) | .urls[$arch]' "$REPO_ROOT/contrib/dependencies.json"
|
||||
}
|
||||
@@ -12,7 +12,9 @@ teardown() {
|
||||
destroy_app
|
||||
[[ -f "$DOKKU_ROOT/VHOST.bak" ]] && mv "$DOKKU_ROOT/VHOST.bak" "$DOKKU_ROOT/VHOST" && chown dokku:dokku "$DOKKU_ROOT/VHOST"
|
||||
docker network rm create-network || true
|
||||
docker network rm create-network-2 || true
|
||||
docker network rm deploy-network || true
|
||||
docker network rm deploy-network-2 || true
|
||||
docker network rm initial-network || true
|
||||
docker network rm "$TEST_NETWORK" || true
|
||||
global_teardown
|
||||
@@ -630,6 +632,37 @@ teardown() {
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(network) network:set attach-post-create attaches every network" {
|
||||
for network in create-network create-network-2 deploy-network deploy-network-2; do
|
||||
run /bin/bash -c "dokku network:create $network"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
done
|
||||
|
||||
run /bin/bash -c "dokku network:set $TEST_APP attach-post-create create-network create-network-2"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku network:set $TEST_APP attach-post-deploy deploy-network deploy-network-2"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
for network in create-network create-network-2 deploy-network deploy-network-2; do
|
||||
run /bin/bash -c "docker container inspect --format '{{range \$k, \$v := .NetworkSettings.Networks}}{{println \$k}}{{end}}' $TEST_APP.web.1 | grep -cx $network"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "1"
|
||||
done
|
||||
}
|
||||
|
||||
@test "(network) dont re-attach to network" {
|
||||
run /bin/bash -c "dokku network:create deploy-network"
|
||||
echo "output: $output"
|
||||
@@ -698,3 +731,16 @@ teardown() {
|
||||
assert_output_contains "Attempting pre-flight checks" 0
|
||||
assert_output_contains "Application deployed"
|
||||
}
|
||||
|
||||
@test "(network:rebuild) missing app" {
|
||||
run /bin/bash -c "dokku network:rebuild missing-app"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "App missing-app does not exist"
|
||||
|
||||
run /bin/bash -c "test -e $DOKKU_LIB_ROOT/config/common/missing-app"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
}
|
||||
@@ -129,3 +129,22 @@ teardown() {
|
||||
|
||||
docker image rm dokku-test/$TEST_APP:latest dokku-test/$TEST_APP:v2 || true
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) deploy removes stale nginx.conf.sigil files" {
|
||||
local DATA_DIR="/var/lib/dokku/data/nginx-vhosts/app-$TEST_APP"
|
||||
mkdir -p "$DATA_DIR"
|
||||
echo "# stale" >"$DATA_DIR/nginx.conf.sigil.99999999"
|
||||
touch "$DATA_DIR/nginx.conf.sigil.99999998.missing"
|
||||
chown -R dokku:dokku "$DATA_DIR"
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "find $DATA_DIR -maxdepth 1 -name 'nginx.conf.sigil.*'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
}
|
||||
@@ -3,7 +3,10 @@
|
||||
load test_helper
|
||||
|
||||
NGINX_VALIDATE_PLUGIN_NAME="test-nginx-validate"
|
||||
NGINX_VALIDATE_LEGACY_PLUGIN_NAME="test-nginx-validate-legacy"
|
||||
NGINX_VALIDATE_ZONE_CONF="/etc/nginx/conf.d/00-dokku-test-limit-req.conf"
|
||||
NGINX_VALIDATE_BROKEN_CONF="/etc/nginx/conf.d/00-dokku-test-broken.conf"
|
||||
NGINX_VALIDATE_CACHE_DIR="/var/cache/nginx/dokku-test-cache"
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
@@ -12,9 +15,12 @@ setup() {
|
||||
}
|
||||
|
||||
teardown() {
|
||||
rm -f "$NGINX_VALIDATE_ZONE_CONF" "$NGINX_VALIDATE_BROKEN_CONF"
|
||||
rm -rf "$NGINX_VALIDATE_CACHE_DIR"
|
||||
rm -rf "${PLUGIN_ENABLED_PATH:?}/$NGINX_VALIDATE_PLUGIN_NAME" "${PLUGIN_AVAILABLE_PATH:?}/$NGINX_VALIDATE_PLUGIN_NAME"
|
||||
rm -rf "${PLUGIN_ENABLED_PATH:?}/$NGINX_VALIDATE_LEGACY_PLUGIN_NAME" "${PLUGIN_AVAILABLE_PATH:?}/$NGINX_VALIDATE_LEGACY_PLUGIN_NAME"
|
||||
rm -rf "$DOKKU_LIB_ROOT/data/nginx-vhosts/app-$TEST_APP" || true
|
||||
destroy_app
|
||||
rm -f "$NGINX_VALIDATE_ZONE_CONF"
|
||||
[[ -f "$DOKKU_ROOT/VHOST.bak" ]] && mv "$DOKKU_ROOT/VHOST.bak" "$DOKKU_ROOT/VHOST" && chown dokku:dokku "$DOKKU_ROOT/VHOST"
|
||||
global_teardown
|
||||
}
|
||||
@@ -84,6 +90,102 @@ teardown() {
|
||||
assert_output_contains "Pre-validating custom nginx.conf.sigil"
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) [pre-validate] fn-nginx-vhosts-nginx-user parses the main nginx config" {
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions"
|
||||
|
||||
cat <<'EOF' >"$BATS_TEST_TMPDIR/nginx.conf"
|
||||
#user nobody;
|
||||
user www-data www-data; # workers run as www-data
|
||||
userid on;
|
||||
EOF
|
||||
|
||||
run fn-nginx-vhosts-nginx-user "$BATS_TEST_TMPDIR/nginx.conf"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "www-data"
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) [pre-validate] fn-nginx-vhosts-nginx-user ignores configs declaring no user" {
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions"
|
||||
|
||||
cat <<'EOF' >"$BATS_TEST_TMPDIR/nginx.conf"
|
||||
#user nobody;
|
||||
userid on;
|
||||
auth_basic_user_file conf/htpasswd;
|
||||
EOF
|
||||
|
||||
run fn-nginx-vhosts-nginx-user "$BATS_TEST_TMPDIR/nginx.conf"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output ""
|
||||
|
||||
run fn-nginx-vhosts-nginx-user "$BATS_TEST_TMPDIR/missing.conf"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output ""
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) [pre-validate] does not change proxy_cache_path directory ownership" {
|
||||
local NGINX_USER
|
||||
NGINX_USER="$(nginx_host_user)"
|
||||
[[ -n "$NGINX_USER" ]] || skip "host nginx config declares no user directive"
|
||||
|
||||
setup_nginx_cache_dir "$NGINX_USER"
|
||||
nginx_cache_config "$BATS_TEST_TMPDIR/nginx.conf.sigil"
|
||||
|
||||
run_plugin_script nginx-vhosts core-post-extract "$TEST_APP" "$BATS_TEST_TMPDIR"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Pre-validating custom nginx.conf.sigil"
|
||||
|
||||
run /bin/bash -c "stat -c %U $NGINX_VALIDATE_CACHE_DIR"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "$NGINX_USER"
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) [pre-validate] preserves ownership with a validate-config template predating NGINX_USER" {
|
||||
local NGINX_USER
|
||||
NGINX_USER="$(nginx_host_user)"
|
||||
[[ -n "$NGINX_USER" ]] || skip "host nginx config declares no user directive"
|
||||
|
||||
setup_nginx_validate_legacy_plugin
|
||||
setup_nginx_cache_dir "$NGINX_USER"
|
||||
nginx_cache_config "$BATS_TEST_TMPDIR/nginx.conf.sigil"
|
||||
|
||||
run_plugin_script nginx-vhosts core-post-extract "$TEST_APP" "$BATS_TEST_TMPDIR"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Pre-validating custom nginx.conf.sigil"
|
||||
|
||||
run /bin/bash -c "stat -c %U $NGINX_VALIDATE_CACHE_DIR"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "$NGINX_USER"
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts:validate-config) does not change proxy_cache_path directory ownership" {
|
||||
local NGINX_USER
|
||||
NGINX_USER="$(nginx_host_user)"
|
||||
[[ -n "$NGINX_USER" ]] || skip "host nginx config declares no user directive"
|
||||
|
||||
setup_nginx_cache_dir "$NGINX_USER"
|
||||
nginx_cache_config "$DOKKU_ROOT/$TEST_APP/nginx.conf"
|
||||
echo 'not_a_directive;' >"$NGINX_VALIDATE_BROKEN_CONF"
|
||||
|
||||
run /bin/bash -c "dokku nginx:validate-config $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "stat -c %U $NGINX_VALIDATE_CACHE_DIR"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "$NGINX_USER"
|
||||
}
|
||||
|
||||
setup_nginx_validate_plugin() {
|
||||
declare desc="installs a plugin that overrides the validate-config nginx template"
|
||||
local PLUGIN_DIR="$PLUGIN_AVAILABLE_PATH/$NGINX_VALIDATE_PLUGIN_NAME"
|
||||
@@ -110,6 +212,7 @@ EOF
|
||||
chmod +x "$PLUGIN_DIR/nginx-app-template-source"
|
||||
|
||||
cat <<'EOF' >"$PLUGIN_DIR/validate.conf.sigil"
|
||||
{{ if $.NGINX_USER }}user {{ $.NGINX_USER }};{{ end }}
|
||||
events { worker_connections 768; }
|
||||
http {
|
||||
access_log off;
|
||||
@@ -170,3 +273,74 @@ upstream {{ $.APP }}-{{ \$upstream_port }} {
|
||||
EOF
|
||||
cat "$APP_REPO_DIR/nginx.conf.sigil"
|
||||
}
|
||||
|
||||
nginx_host_user() {
|
||||
declare desc="returns the user the host nginx runs its workers as"
|
||||
|
||||
awk '{ sub(/#.*/, "") } $1 == "user" && NF >= 2 { value = $2; sub(/;.*$/, "", value); print value; exit }' /etc/nginx/nginx.conf
|
||||
}
|
||||
|
||||
setup_nginx_cache_dir() {
|
||||
declare desc="creates a proxy_cache_path directory owned by the host nginx user"
|
||||
local NGINX_USER="$1"
|
||||
|
||||
mkdir -p "$NGINX_VALIDATE_CACHE_DIR"
|
||||
chown "$NGINX_USER" "$NGINX_VALIDATE_CACHE_DIR"
|
||||
}
|
||||
|
||||
nginx_cache_config() {
|
||||
declare desc="writes an nginx config declaring a proxy_cache_path at the test cache directory"
|
||||
local OUTPUT_PATH="$1"
|
||||
|
||||
echo "injecting nginx_cache_config -> $OUTPUT_PATH"
|
||||
cat <<EOF >"$OUTPUT_PATH"
|
||||
proxy_cache_path $NGINX_VALIDATE_CACHE_DIR levels=1:2 keys_zone=dokkuvalidatecache:1m max_size=10m inactive=1m use_temp_path=off;
|
||||
|
||||
server {
|
||||
listen 127.0.0.1:18999;
|
||||
server_name dokku-validate-cache.test;
|
||||
|
||||
location / {
|
||||
proxy_cache dokkuvalidatecache;
|
||||
proxy_pass http://127.0.0.1:18998;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
setup_nginx_validate_legacy_plugin() {
|
||||
declare desc="installs a plugin whose validate-config template predates the NGINX_USER variable"
|
||||
local PLUGIN_DIR="$PLUGIN_AVAILABLE_PATH/$NGINX_VALIDATE_LEGACY_PLUGIN_NAME"
|
||||
mkdir -p "$PLUGIN_DIR"
|
||||
|
||||
cat <<EOF >"$PLUGIN_DIR/plugin.toml"
|
||||
[plugin]
|
||||
description = "test plugin overriding the validate-config nginx template without a user directive"
|
||||
version = "0.1.0"
|
||||
[plugin.config]
|
||||
EOF
|
||||
|
||||
cat <<'EOF' >"$PLUGIN_DIR/nginx-app-template-source"
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
TEMPLATE_TYPE="$2"
|
||||
if [[ "$TEMPLATE_TYPE" == "validate-config" ]]; then
|
||||
echo "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/validate.conf.sigil"
|
||||
fi
|
||||
EOF
|
||||
chmod +x "$PLUGIN_DIR/nginx-app-template-source"
|
||||
|
||||
cat <<'EOF' >"$PLUGIN_DIR/validate.conf.sigil"
|
||||
events { worker_connections 768; }
|
||||
http {
|
||||
access_log off;
|
||||
error_log /dev/null;
|
||||
include {{ $.NGINX_CONF }};
|
||||
}
|
||||
EOF
|
||||
|
||||
dokku plugin:enable "$NGINX_VALIDATE_LEGACY_PLUGIN_NAME"
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
[[ -f "$DOKKU_ROOT/VHOST" ]] && cp -fp "$DOKKU_ROOT/VHOST" "$DOKKU_ROOT/VHOST.bak"
|
||||
create_app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
sudo systemctl start coredns-docker >/dev/null 2>&1 || true
|
||||
dokku --quiet nginx:set --global dns-resolver
|
||||
dokku --quiet nginx:set --global dns-zone
|
||||
destroy_app
|
||||
[[ -f "$DOKKU_ROOT/VHOST.bak" ]] && mv "$DOKKU_ROOT/VHOST.bak" "$DOKKU_ROOT/VHOST" && chown dokku:dokku "$DOKKU_ROOT/VHOST"
|
||||
global_teardown
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts:set) dns-resolver defaults to empty and dns-zone defaults to docker" {
|
||||
run /bin/bash -c "dokku nginx:report $TEST_APP --nginx-computed-dns-resolver"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku nginx:report $TEST_APP --nginx-computed-dns-zone"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "docker"
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts:set) dns-resolver and dns-zone can be overridden globally" {
|
||||
run /bin/bash -c "dokku nginx:set --global dns-resolver 127.0.0.2:5353"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku nginx:set --global dns-zone test"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku nginx:report $TEST_APP --nginx-computed-dns-resolver"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "127.0.0.2:5353"
|
||||
|
||||
run /bin/bash -c "dokku nginx:report $TEST_APP --nginx-computed-dns-zone"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "test"
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) generated nginx.conf uses IP-based upstream by default" {
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku nginx:show-config $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_contains "resolver "
|
||||
assert_output_not_contains "\$dokku_upstream"
|
||||
assert_output_contains "upstream ${TEST_APP}-"
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) generated nginx.conf uses resolver and variable-based proxy_pass when dns-resolver is set" {
|
||||
run /bin/bash -c "dokku nginx:set --global dns-resolver 127.0.0.1:1053"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku nginx:show-config $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "resolver 127.0.0.1:1053 valid=10s ipv6=off"
|
||||
assert_output_contains "set \$dokku_upstream"
|
||||
assert_output_contains "${TEST_APP}.web.docker:"
|
||||
assert_output_contains "proxy_pass http://\$dokku_upstream"
|
||||
assert_output_not_contains "upstream ${TEST_APP}-"
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) unsetting dns-resolver reverts to IP-based upstream" {
|
||||
run /bin/bash -c "dokku nginx:set --global dns-resolver 127.0.0.1:1053"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku nginx:show-config $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "resolver 127.0.0.1:1053 valid=10s ipv6=off"
|
||||
|
||||
run /bin/bash -c "dokku nginx:set --global dns-resolver"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:build-config $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku nginx:show-config $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_contains "resolver 127.0.0.1:1053"
|
||||
assert_output_contains "upstream ${TEST_APP}-"
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) vendored nginx.conf.sigil renders IP-based upstream regardless of dns-resolver" {
|
||||
run /bin/bash -c "dokku nginx:set --global dns-resolver 127.0.0.1:1053"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP custom_nginx_template
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku nginx:show-config $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_contains "resolver 127.0.0.1:1053"
|
||||
assert_output_not_contains "\$dokku_upstream"
|
||||
assert_output_contains "upstream ${TEST_APP}-"
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) nginx returns 502 when coredns-docker is stopped" {
|
||||
run /bin/bash -c "dokku nginx:set --global dns-resolver 127.0.0.1:1053"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run sudo systemctl stop coredns-docker
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run curl --connect-to "$TEST_APP.$DOKKU_DOMAIN:80:localhost:80" -kSso /dev/null -w "%{http_code}" -m 10 "http://$TEST_APP.$DOKKU_DOMAIN/"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "502"
|
||||
|
||||
run sudo systemctl start coredns-docker
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
assert_http_localhost_response http "$TEST_APP.$DOKKU_DOMAIN" 80 / "" 200
|
||||
}
|
||||
|
||||
@test "(nginx-vhosts) nginx returns 502 when the app container is not running" {
|
||||
run /bin/bash -c "dokku nginx:set --global dns-resolver 127.0.0.1:1053"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
assert_http_localhost_response http "$TEST_APP.$DOKKU_DOMAIN" 80 / "" 200
|
||||
|
||||
run /bin/bash -c "docker container stop $TEST_APP.web.1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku nginx:show-config $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "proxy_pass http://\$dokku_upstream"
|
||||
|
||||
assert_http_localhost_response http "$TEST_APP.$DOKKU_DOMAIN" 80 / "" 502
|
||||
|
||||
run /bin/bash -c "docker container start $TEST_APP.web.1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
assert_http_localhost_response http "$TEST_APP.$DOKKU_DOMAIN" 80 / "" 200
|
||||
}
|
||||
@@ -103,7 +103,21 @@ assert_nginx_property_set_get() {
|
||||
@test "(nginx:report) misc properties raw/global/computed" {
|
||||
assert_nginx_property_set_get "disable-custom-config" "false" "true"
|
||||
assert_nginx_property_set_get "underscore-in-headers" "on" "off"
|
||||
assert_nginx_property_set_get "proxy-http-version" "2" "1.1"
|
||||
assert_nginx_property_set_get "proxy-keepalive" "8" "16"
|
||||
assert_nginx_property_set_get "nginx-conf-sigil-path" "custom.sigil" "global.sigil"
|
||||
assert_nginx_property_set_get "nginx-service-command" "/usr/sbin/nginx-app" "/usr/sbin/nginx-global"
|
||||
}
|
||||
|
||||
@test "(nginx:set) missing app" {
|
||||
run /bin/bash -c "dokku nginx:set missing-app hsts false"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "App missing-app does not exist"
|
||||
|
||||
run /bin/bash -c "test -e $DOKKU_LIB_ROOT/config/nginx/missing-app"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
dokku nginx:stop
|
||||
dokku openresty:set --global letsencrypt-server https://acme-staging-v02.api.letsencrypt.org/directory
|
||||
dokku openresty:set --global letsencrypt-email
|
||||
dokku openresty:start
|
||||
create_app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
global_teardown
|
||||
destroy_app
|
||||
dokku openresty:stop
|
||||
dokku nginx:start
|
||||
}
|
||||
|
||||
@test "(openresty) includes persist across ps:restart" {
|
||||
run /bin/bash -c "dokku proxy:set $TEST_APP openresty"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP add_openresty_include
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"openresty.include-http-example.conf\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "IyBmb3JjZSB0aGUgY2hhcmFjdGVyIHNldCB0byB1dGYtOApjaGFyc2V0IFVURi04Owo="
|
||||
|
||||
run /bin/bash -c "dokku ps:restart $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"openresty.include-http-example.conf\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "IyBmb3JjZSB0aGUgY2hhcmFjdGVyIHNldCB0byB1dGYtOApjaGFyc2V0IFVURi04Owo="
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"openresty.include-location-http-example.conf\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "IyBsb2NhdGlvbi1ibG9jawo="
|
||||
}
|
||||
|
||||
@test "(openresty) includes are removed when deleted from the repo" {
|
||||
local DATA_DIR="/var/lib/dokku/data/openresty-vhosts/app-$TEST_APP"
|
||||
local CUSTOM_TMP=$(mktemp -d "/tmp/${DOKKU_DOMAIN}.XXXXX")
|
||||
trap 'popd &>/dev/null || true; rm -rf "$CUSTOM_TMP"' INT TERM
|
||||
|
||||
run /bin/bash -c "dokku proxy:set $TEST_APP openresty"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
CUSTOM_TMP="$CUSTOM_TMP" run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP add_openresty_include
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run git -C "$CUSTOM_TMP" rm -r openresty
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run git -C "$CUSTOM_TMP" commit -m 'Remove openresty includes'
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run git -C "$CUSTOM_TMP" push target master:master
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"openresty.include-http-example.conf\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
|
||||
run /bin/bash -c "find $DATA_DIR -maxdepth 1 -name 'openresty-*-includes*'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
|
||||
rm -rf "$CUSTOM_TMP"
|
||||
}
|
||||
|
||||
@test "(openresty) deploy removes stale include markers and directories" {
|
||||
local DATA_DIR="/var/lib/dokku/data/openresty-vhosts/app-$TEST_APP"
|
||||
mkdir -p "$DATA_DIR/openresty-http-includes.99999999" "$DATA_DIR/openresty-location-includes.99999999"
|
||||
echo "charset UTF-8;" >"$DATA_DIR/openresty-http-includes.99999999/example.conf"
|
||||
echo "# location-block" >"$DATA_DIR/openresty-location-includes.99999999/example.conf"
|
||||
touch "$DATA_DIR/openresty-http-includes.99999998.missing" "$DATA_DIR/openresty-location-includes.99999998.missing"
|
||||
chown -R dokku:dokku "$DATA_DIR"
|
||||
|
||||
run /bin/bash -c "dokku proxy:set $TEST_APP openresty"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "find $DATA_DIR -maxdepth 1 -name 'openresty-*-includes*'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
}
|
||||
|
||||
add_openresty_include() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
[[ -z "$APP" ]] && local APP="$TEST_APP"
|
||||
mkdir -p "$APP_REPO_DIR/openresty/http-includes"
|
||||
echo "# force the character set to utf-8" >>"$APP_REPO_DIR/openresty/http-includes/example.conf"
|
||||
echo "charset UTF-8;" >>"$APP_REPO_DIR/openresty/http-includes/example.conf"
|
||||
|
||||
mkdir -p "$APP_REPO_DIR/openresty/http-location-includes"
|
||||
echo "# location-block" >>"$APP_REPO_DIR/openresty/http-location-includes/example.conf"
|
||||
}
|
||||
@@ -82,3 +82,16 @@ teardown() {
|
||||
assert_success
|
||||
assert_output "5m"
|
||||
}
|
||||
|
||||
@test "(openresty:set) missing app" {
|
||||
run /bin/bash -c "dokku openresty:set missing-app client-max-body-size 5m"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "App missing-app does not exist"
|
||||
|
||||
run /bin/bash -c "test -e $DOKKU_LIB_ROOT/config/openresty/missing-app"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
}
|
||||
@@ -760,6 +760,175 @@ teardown() {
|
||||
assert_output_not_exists
|
||||
}
|
||||
|
||||
@test "(openresty) healthcheck labels from app.json" {
|
||||
run /bin/bash -c "dokku proxy:set $TEST_APP openresty"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP setup_openresty_readiness_healthcheck
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"openresty.upstream-max-fails\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "1"
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"openresty.upstream-fail-timeout\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "2s"
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"openresty.proxy-next-upstream-timeout\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "5s"
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"openresty.healthcheck-path\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "/"
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"openresty.healthcheck-interval\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "2"
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"openresty.healthcheck-timeout\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "5"
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"openresty.healthcheck-fall\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "3"
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"openresty.healthcheck-host\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "$TEST_APP.dokku.me"
|
||||
|
||||
run /bin/bash -c "docker exec openresty-openresty-1 /usr/local/openresty/nginx/sbin/nginx -t"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker exec openresty-openresty-1 cat /etc/nginx/sites-enabled/sites.conf"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "max_fails=1 fail_timeout=2s;"
|
||||
assert_output_contains "proxy_next_upstream_timeout 5s;"
|
||||
|
||||
sleep 5
|
||||
|
||||
run /bin/bash -c "docker exec openresty-openresty-1 wget -qO- http://127.0.0.1:8999/upstream-healthcheck-status"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Upstream $TEST_APP-web-5000"
|
||||
assert_output_contains " UP"
|
||||
assert_output_contains "(NO checkers)" 0
|
||||
|
||||
assert_http_localhost_response "http" "$TEST_APP.dokku.me" "80" "" "python/http.server"
|
||||
}
|
||||
|
||||
@test "(openresty) no healthcheck labels without readiness check" {
|
||||
run /bin/bash -c "dokku proxy:set $TEST_APP openresty"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP convert_to_dockerfile
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"openresty.upstream-max-fails\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"openresty.proxy-next-upstream-timeout\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"openresty.healthcheck-path\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
}
|
||||
|
||||
@test "(openresty) healthcheck headers from app.json" {
|
||||
run /bin/bash -c "dokku proxy:set $TEST_APP openresty"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP setup_openresty_readiness_healthcheck_headers
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"openresty.healthcheck-header.X-Check\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "dokku"
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"openresty.healthcheck-host\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "check.dokku.me"
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.web.1 --format '{{ index .Config.Labels \"openresty.healthcheck-header.Host\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
|
||||
assert_http_localhost_response "http" "$TEST_APP.dokku.me" "80" "" "python/http.server"
|
||||
}
|
||||
|
||||
@test "(openresty) invalid stored healthcheck path fails restart" {
|
||||
run /bin/bash -c "dokku proxy:set $TEST_APP openresty"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP setup_openresty_readiness_healthcheck
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "jq '.healthchecks.web[0].path = \"/health check\"' /var/lib/dokku/data/app-json/$TEST_APP/app.json > /var/lib/dokku/data/app-json/$TEST_APP/app.json.tmp && mv /var/lib/dokku/data/app-json/$TEST_APP/app.json.tmp /var/lib/dokku/data/app-json/$TEST_APP/app.json"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:restart $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Invalid app.json healthcheck path for openresty" -1
|
||||
}
|
||||
|
||||
add_openresty_include() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
@@ -786,3 +955,23 @@ add_openresty_include_unsafe() {
|
||||
mkdir -p "$APP_REPO_DIR/openresty/http-location-includes"
|
||||
printf '# location\n' >"$APP_REPO_DIR/openresty/http-location-includes/unsafe filename.conf"
|
||||
}
|
||||
|
||||
setup_openresty_readiness_healthcheck() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
[[ -z "$APP" ]] && local APP="$TEST_APP"
|
||||
APP_REPO_DIR="$(realpath "$APP_REPO_DIR")"
|
||||
|
||||
convert_to_dockerfile "$APP" "$APP_REPO_DIR"
|
||||
mv "$APP_REPO_DIR/app-readiness.json" "$APP_REPO_DIR/app.json"
|
||||
}
|
||||
|
||||
setup_openresty_readiness_healthcheck_headers() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
[[ -z "$APP" ]] && local APP="$TEST_APP"
|
||||
APP_REPO_DIR="$(realpath "$APP_REPO_DIR")"
|
||||
|
||||
convert_to_dockerfile "$APP" "$APP_REPO_DIR"
|
||||
jq '.healthchecks.web[0].httpHeaders = [{"name": "X-Check", "value": "dokku"}, {"name": "Host", "value": "check.dokku.me"}]' "$APP_REPO_DIR/app-readiness.json" >"$APP_REPO_DIR/app.json"
|
||||
}
|
||||
+48
-4
@@ -9,9 +9,16 @@ setup() {
|
||||
|
||||
teardown() {
|
||||
remove_test_plugin || true
|
||||
restore_enter_plugin
|
||||
global_teardown
|
||||
}
|
||||
|
||||
restore_enter_plugin() {
|
||||
declare desc="re-enables the enter core plugin if a test left it disabled"
|
||||
[[ -e "$PLUGIN_CORE_PATH/enabled/enter" ]] || PLUGIN_PATH="$PLUGIN_CORE_PATH" plugn enable enter || true
|
||||
[[ -e "$PLUGIN_ENABLED_PATH/enter" ]] || PLUGIN_PATH="$PLUGIN_PATH" plugn enable enter || true
|
||||
}
|
||||
|
||||
@test "(plugin) plugin:help" {
|
||||
run /bin/bash -c "dokku plugin"
|
||||
echo "output: $output"
|
||||
@@ -116,7 +123,7 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "sudo -E -u nobody dokku plugin:uninstall $TEST_PLUGIN_NAME"
|
||||
run /bin/bash -c "sudo -u nobody dokku plugin:uninstall $TEST_PLUGIN_NAME"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
@@ -158,7 +165,7 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "sudo -E -u nobody dokku plugin:uninstall $TEST_PLUGIN_NAME"
|
||||
run /bin/bash -c "sudo -u nobody dokku plugin:uninstall $TEST_PLUGIN_NAME"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
@@ -212,7 +219,7 @@ teardown() {
|
||||
}
|
||||
|
||||
@test "(plugin) plugin:install, plugin:disable, plugin:uninstall as non-root user failure" {
|
||||
run /bin/bash -c "sudo -E -u nobody dokku plugin:install $TEST_PLUGIN_GIT_REPO"
|
||||
run /bin/bash -c "sudo -u nobody dokku plugin:install $TEST_PLUGIN_GIT_REPO"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
@@ -227,7 +234,7 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "sudo -E -u nobody dokku plugin:disable $TEST_PLUGIN_NAME"
|
||||
run /bin/bash -c "sudo -u nobody dokku plugin:disable $TEST_PLUGIN_NAME"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
@@ -372,3 +379,40 @@ teardown() {
|
||||
assert_output_contains "root" "0"
|
||||
assert_output_contains "dokku" "3"
|
||||
}
|
||||
|
||||
@test "(plugin:trigger) forwards the caller environment across the privilege drop" {
|
||||
run /bin/bash -c "DOKKU_TEST_CROSSING=1 DOKKU_TRACE=1 dokku plugin:trigger app-list 2>&1 >/dev/null | grep -q -- '--preserve-env=[^ ]*DOKKU_TEST_CROSSING'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(plugin:enable) core plugin skipped at install" {
|
||||
run /bin/bash -c "rm $PLUGIN_ENABLED_PATH/enter $PLUGIN_CORE_PATH/enabled/enter"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku plugin:list --format json | jq -r '.[] | select(.name == \"enter\") | .enabled'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "false"
|
||||
|
||||
run /bin/bash -c "dokku plugin:enable enter"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Plugin enter enabled"
|
||||
|
||||
run /bin/bash -c "dokku plugin:list --format json | jq -r '.[] | select(.name == \"enter\") | .enabled'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
run /bin/bash -c "test -L $PLUGIN_CORE_PATH/enabled/enter"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
+33
-10
@@ -7,19 +7,19 @@ setup() {
|
||||
[[ -f "$DOKKU_ROOT/VHOST" ]] && cp -fp "$DOKKU_ROOT/VHOST" "$DOKKU_ROOT/VHOST.bak"
|
||||
create_app
|
||||
|
||||
dokku --force postgres:destroy $TEST_APP 2>/dev/null || true
|
||||
dokku --force redis:destroy $TEST_APP 2>/dev/null || true
|
||||
dokku --force postgres:destroy $TEST_APP-other 2>/dev/null || true
|
||||
dokku --force redis:destroy $TEST_APP-other 2>/dev/null || true
|
||||
dokku postgres:destroy $TEST_APP --force 2>/dev/null || true
|
||||
dokku redis:destroy $TEST_APP --force 2>/dev/null || true
|
||||
dokku postgres:destroy $TEST_APP-other --force 2>/dev/null || true
|
||||
dokku redis:destroy $TEST_APP-other --force 2>/dev/null || true
|
||||
}
|
||||
|
||||
teardown() {
|
||||
destroy_app
|
||||
|
||||
dokku --force postgres:destroy $TEST_APP 2>/dev/null || true
|
||||
dokku --force redis:destroy $TEST_APP 2>/dev/null || true
|
||||
dokku --force postgres:destroy $TEST_APP-other 2>/dev/null || true
|
||||
dokku --force redis:destroy $TEST_APP-other 2>/dev/null || true
|
||||
dokku postgres:destroy $TEST_APP --force 2>/dev/null || true
|
||||
dokku redis:destroy $TEST_APP --force 2>/dev/null || true
|
||||
dokku postgres:destroy $TEST_APP-other --force 2>/dev/null || true
|
||||
dokku redis:destroy $TEST_APP-other --force 2>/dev/null || true
|
||||
|
||||
[[ -f "$DOKKU_ROOT/VHOST.bak" ]] && mv "$DOKKU_ROOT/VHOST.bak" "$DOKKU_ROOT/VHOST" && chown dokku:dokku "$DOKKU_ROOT/VHOST"
|
||||
global_teardown
|
||||
@@ -274,7 +274,7 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku postgres:create $TEST_APP $TEST_APP"
|
||||
run /bin/bash -c "dokku postgres:create $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
@@ -284,7 +284,7 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku redis:create $TEST_APP $TEST_APP"
|
||||
run /bin/bash -c "dokku redis:create $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
@@ -415,3 +415,26 @@ teardown() {
|
||||
assert_success
|
||||
assert_output "true"
|
||||
}
|
||||
|
||||
@test "(ports:add) concurrent calls for the same app keep every port mapping" {
|
||||
run run_concurrently 20 /bin/bash -c 'dokku ports:add "$1" "http:$((8000 + $2)):5000"' _ "$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --quiet ports:report $TEST_APP --ports-map | tr ' ' '\n' | grep -cx 'http:80[0-9][0-9]:5000'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "20"
|
||||
|
||||
run run_concurrently 20 /bin/bash -c 'dokku ports:remove "$1" "http:$((8000 + $2)):5000"' _ "$TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --quiet ports:report $TEST_APP --ports-map | tr ' ' '\n' | grep -cx 'http:80[0-9][0-9]:5000'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "0"
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
dokku nginx:stop
|
||||
dokku caddy:start
|
||||
create_app
|
||||
dokku proxy:set "$TEST_APP" caddy
|
||||
}
|
||||
|
||||
teardown() {
|
||||
dokku proxy:route:clear "$TEST_APP" >/dev/null 2>&1 || true
|
||||
destroy_app
|
||||
dokku caddy:stop
|
||||
dokku nginx:start
|
||||
global_teardown
|
||||
}
|
||||
|
||||
@test "(proxy-route:caddy) basic routing - /api/v0 hits api, / hits web" {
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Give the daemon a moment to read the new labels.
|
||||
sleep 5
|
||||
|
||||
# Without --strip-prefix, /api/v0/Procfile reaches api as /api/v0/Procfile
|
||||
# which python's http.server returns 404 for. A 404 here proves the route
|
||||
# reaches api - web's catch-all would have returned 200.
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404"
|
||||
}
|
||||
|
||||
@test "(proxy-route:caddy) --strip-prefix toggles upstream path visibility" {
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Give the daemon a moment to read the new labels.
|
||||
sleep 5
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404"
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001 --strip-prefix"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Give the daemon a moment to read the new labels.
|
||||
sleep 5
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server"
|
||||
}
|
||||
|
||||
@test "(proxy-route:caddy) removing a route falls back to web" {
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
assert_success
|
||||
|
||||
# Set without --strip-prefix first; 404 proves the labels attached.
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Give the daemon a moment to read the new labels.
|
||||
sleep 5
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404"
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001 --strip-prefix"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Give the daemon a moment to read the new labels.
|
||||
sleep 5
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server"
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:remove $TEST_APP /api/v0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:report $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "(none)"
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Give the daemon a moment to read the new labels.
|
||||
sleep 5
|
||||
|
||||
# Poll the response body via file to avoid shell-quoting issues with JSON
|
||||
# bodies that contain embedded double quotes.
|
||||
rm -f /tmp/route-removed-body
|
||||
local attempt=0
|
||||
for attempt in $(seq 1 30); do
|
||||
curl --connect-to "${TEST_APP}.${DOKKU_DOMAIN}:80:localhost:80" -kSso /tmp/route-removed-body "http://${TEST_APP}.${DOKKU_DOMAIN}:80/api/v0/Procfile" || true
|
||||
if ! grep -q 'python3 -m http.server' /tmp/route-removed-body 2>/dev/null; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
run /bin/bash -c "grep -c 'python3 -m http.server' /tmp/route-removed-body || true"
|
||||
assert_output "0"
|
||||
}
|
||||
|
||||
add_api_process_callback() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
echo "api: python3 -m http.server 5001" >>"$APP_REPO_DIR/Procfile"
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
TEST_APP="rdmtestapp"
|
||||
|
||||
setup() {
|
||||
uninstall_k3s || true
|
||||
global_setup
|
||||
dokku nginx:stop
|
||||
export KUBECONFIG="/etc/rancher/k3s/k3s.yaml"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
global_teardown
|
||||
dokku nginx:start
|
||||
uninstall_k3s || true
|
||||
}
|
||||
|
||||
@test "(proxy-route:k3s-nginx) basic routing - /api/v0 hits api, / hits web" {
|
||||
if [[ -z "$DOCKERHUB_USERNAME" ]] || [[ -z "$DOCKERHUB_TOKEN" ]]; then
|
||||
skip "skipping due to missing docker.io credentials DOCKERHUB_USERNAME:DOCKERHUB_TOKEN"
|
||||
fi
|
||||
|
||||
INGRESS_CLASS=nginx install_k3s
|
||||
|
||||
run /bin/bash -c "dokku apps:create $TEST_APP"
|
||||
assert_success
|
||||
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# scheduler-k3s does not yet have a proxy-build-config trigger handler, so
|
||||
# proxy:route:set does not re-render the chart. ps:rebuild forces a redeploy
|
||||
# which renders the chart with current routes. Runtime gap tracked as a
|
||||
# follow-up; the test fix unblocks CI.
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Without --strip-prefix, /api/v0/Procfile reaches api as /api/v0/Procfile
|
||||
# which python's http.server returns 404 for. 404 proves the route reaches
|
||||
# api (web's catch-all would have returned 200).
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404"
|
||||
}
|
||||
|
||||
@test "(proxy-route:k3s-nginx) --strip-prefix renders rewrite-target Ingress and strips upstream path" {
|
||||
if [[ -z "$DOCKERHUB_USERNAME" ]] || [[ -z "$DOCKERHUB_TOKEN" ]]; then
|
||||
skip "skipping due to missing docker.io credentials DOCKERHUB_USERNAME:DOCKERHUB_TOKEN"
|
||||
fi
|
||||
|
||||
INGRESS_CLASS=nginx install_k3s
|
||||
|
||||
run /bin/bash -c "dokku apps:create $TEST_APP"
|
||||
assert_success
|
||||
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
assert_success
|
||||
|
||||
# Set without strip first; the 404 proves the route reached api before we
|
||||
# assert the strip-prefix HTTP behavior.
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
assert_success
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404"
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001 --strip-prefix"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
assert_success
|
||||
|
||||
# The chart should emit an additional Ingress carrying the rewrite-target
|
||||
# annotation when --strip-prefix is set.
|
||||
run /bin/bash -c "kubectl get ingress -o json | jq -r '.items[].metadata.annotations | select(.[\"nginx.ingress.kubernetes.io/rewrite-target\"] != null) | .[\"nginx.ingress.kubernetes.io/rewrite-target\"]'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "/\$2"
|
||||
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server"
|
||||
}
|
||||
|
||||
@test "(proxy-route:k3s-nginx) removing a route drops the extra Ingress paths" {
|
||||
if [[ -z "$DOCKERHUB_USERNAME" ]] || [[ -z "$DOCKERHUB_TOKEN" ]]; then
|
||||
skip "skipping due to missing docker.io credentials DOCKERHUB_USERNAME:DOCKERHUB_TOKEN"
|
||||
fi
|
||||
|
||||
INGRESS_CLASS=nginx install_k3s
|
||||
|
||||
run /bin/bash -c "dokku apps:create $TEST_APP"
|
||||
assert_success
|
||||
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
assert_success
|
||||
|
||||
# Verify the route reaches api first (404 proves routing) before checking
|
||||
# that strip applied (200 with Procfile content). scheduler-k3s does not
|
||||
# yet have a proxy-build-config trigger, so ps:rebuild forces a chart
|
||||
# re-render after each proxy:route mutation.
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
assert_success
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404"
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001 --strip-prefix"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
assert_success
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server"
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:remove $TEST_APP /api/v0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
assert_success
|
||||
|
||||
# Confirm storage was cleared before checking cluster state.
|
||||
run /bin/bash -c "dokku proxy:route:report $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "(none)"
|
||||
|
||||
# The rewrite-target Ingress should be gone after removal. Retry briefly
|
||||
# in case the chart re-render hasn't settled.
|
||||
local count="1"
|
||||
for attempt in $(seq 1 30); do
|
||||
run /bin/bash -c "kubectl get ingress -o json | jq -r '[.items[] | select(.metadata.annotations[\"nginx.ingress.kubernetes.io/rewrite-target\"] != null)] | length'"
|
||||
count="$output"
|
||||
if [[ "$count" == "0" ]]; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
echo "final ingress count after $attempt attempts: $count"
|
||||
assert_equal "$count" "0"
|
||||
}
|
||||
|
||||
add_api_process_callback() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
echo "api: python3 -m http.server 5001" >>"$APP_REPO_DIR/Procfile"
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
TEST_APP="rdmtestapp"
|
||||
|
||||
setup() {
|
||||
uninstall_k3s || true
|
||||
global_setup
|
||||
dokku nginx:stop
|
||||
export KUBECONFIG="/etc/rancher/k3s/k3s.yaml"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
global_teardown
|
||||
dokku nginx:start
|
||||
uninstall_k3s || true
|
||||
}
|
||||
|
||||
@test "(proxy-route:k3s-traefik) basic routing - /api/v0 hits api, / hits web" {
|
||||
if [[ -z "$DOCKERHUB_USERNAME" ]] || [[ -z "$DOCKERHUB_TOKEN" ]]; then
|
||||
skip "skipping due to missing docker.io credentials DOCKERHUB_USERNAME:DOCKERHUB_TOKEN"
|
||||
fi
|
||||
|
||||
INGRESS_CLASS=traefik install_k3s
|
||||
|
||||
run /bin/bash -c "dokku apps:create $TEST_APP"
|
||||
assert_success
|
||||
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# scheduler-k3s does not yet have a proxy-build-config trigger handler, so
|
||||
# proxy:route:set does not re-render the chart. ps:rebuild forces a redeploy
|
||||
# which renders the chart with current routes. Runtime gap tracked as a
|
||||
# follow-up; the test fix unblocks CI.
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Without --strip-prefix, /api/v0/Procfile reaches api as /api/v0/Procfile
|
||||
# which python's http.server returns 404 for. 404 proves the route reaches
|
||||
# api (web's catch-all would have returned 200).
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404"
|
||||
}
|
||||
|
||||
@test "(proxy-route:k3s-traefik) --strip-prefix renders stripPrefix Middleware and strips upstream path" {
|
||||
if [[ -z "$DOCKERHUB_USERNAME" ]] || [[ -z "$DOCKERHUB_TOKEN" ]]; then
|
||||
skip "skipping due to missing docker.io credentials DOCKERHUB_USERNAME:DOCKERHUB_TOKEN"
|
||||
fi
|
||||
|
||||
INGRESS_CLASS=traefik install_k3s
|
||||
|
||||
run /bin/bash -c "dokku apps:create $TEST_APP"
|
||||
assert_success
|
||||
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
assert_success
|
||||
|
||||
# Set without strip first; the 404 proves the route reached api before we
|
||||
# assert the strip-prefix HTTP behavior. ps:rebuild after each mutation
|
||||
# forces a chart re-render (k3s has no proxy-build-config trigger yet).
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
assert_success
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404"
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001 --strip-prefix"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
assert_success
|
||||
|
||||
# The chart should emit a StripPrefix Middleware CRD when --strip-prefix
|
||||
# is set.
|
||||
run /bin/bash -c "kubectl get middleware.traefik.io -o json | jq -r '.items[].spec.stripPrefix.prefixes[]?' | head -1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "/api/v0"
|
||||
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server"
|
||||
}
|
||||
|
||||
@test "(proxy-route:k3s-traefik) removing a route drops the stripPrefix Middleware" {
|
||||
if [[ -z "$DOCKERHUB_USERNAME" ]] || [[ -z "$DOCKERHUB_TOKEN" ]]; then
|
||||
skip "skipping due to missing docker.io credentials DOCKERHUB_USERNAME:DOCKERHUB_TOKEN"
|
||||
fi
|
||||
|
||||
INGRESS_CLASS=traefik install_k3s
|
||||
|
||||
run /bin/bash -c "dokku apps:create $TEST_APP"
|
||||
assert_success
|
||||
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
assert_success
|
||||
|
||||
# Verify the route reaches api first (404 proves routing) before checking
|
||||
# that strip applied (200 with Procfile content). ps:rebuild after each
|
||||
# mutation forces a chart re-render (k3s has no proxy-build-config yet).
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
assert_success
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404"
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001 --strip-prefix"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
assert_success
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server"
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:remove $TEST_APP /api/v0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
assert_success
|
||||
|
||||
# Confirm storage was cleared before checking cluster state.
|
||||
run /bin/bash -c "dokku proxy:route:report $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "(none)"
|
||||
|
||||
# The stripPrefix Middleware should be gone after removal. Retry briefly
|
||||
# in case the chart re-render hasn't settled.
|
||||
local count="1"
|
||||
for attempt in $(seq 1 30); do
|
||||
run /bin/bash -c "kubectl get middleware.traefik.io -o json | jq -r '[.items[] | select(.spec.stripPrefix != null)] | length'"
|
||||
count="$output"
|
||||
if [[ "$count" == "0" ]]; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
echo "final middleware count after $attempt attempts: $count"
|
||||
assert_equal "$count" "0"
|
||||
}
|
||||
|
||||
add_api_process_callback() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
echo "api: python3 -m http.server 5001" >>"$APP_REPO_DIR/Procfile"
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
create_app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
dokku proxy:route:clear "$TEST_APP" >/dev/null 2>&1 || true
|
||||
destroy_app
|
||||
global_teardown
|
||||
}
|
||||
|
||||
@test "(proxy-route:nginx) basic routing - /api/v0 hits api, / hits web" {
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Without --strip-prefix, /api/v0/Procfile reaches api as /api/v0/Procfile.
|
||||
# api (python's http.server) does not have that file on disk and returns
|
||||
# 404. A 404 here proves the route reaches api - web's catch-all would
|
||||
# have returned 200 instead.
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404"
|
||||
}
|
||||
|
||||
@test "(proxy-route:nginx) --strip-prefix toggles upstream path visibility" {
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Without --strip-prefix, /api/v0/Procfile is forwarded as-is to api,
|
||||
# which does not have an /api/v0/Procfile file on disk.
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
assert_success
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404"
|
||||
|
||||
# With --strip-prefix, /api/v0/Procfile becomes /Procfile upstream and api
|
||||
# returns the Procfile content.
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001 --strip-prefix"
|
||||
assert_success
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server"
|
||||
}
|
||||
|
||||
@test "(proxy-route:nginx) removing a route falls back to web" {
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
assert_success
|
||||
|
||||
# First set the route without --strip-prefix so a 404 from api uniquely
|
||||
# identifies that the route reached api (avoids racing with web's catch-all
|
||||
# 200 during the brief window before nginx fully reloads).
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
assert_success
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404"
|
||||
|
||||
# Now switch the route to --strip-prefix and assert api serves the Procfile.
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001 --strip-prefix"
|
||||
assert_success
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server"
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:remove $TEST_APP /api/v0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Confirm storage was actually mutated; a CommandRouteRemove that returns
|
||||
# changed=false silently skips BuildConfig and leaves nginx with the old
|
||||
# route block.
|
||||
run /bin/bash -c "dokku proxy:route:report $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "(none)"
|
||||
|
||||
# nginx reload races with the curl after route removal: both api and web
|
||||
# return 200 for /api/v0/Procfile so the polling loop in
|
||||
# assert_http_localhost_response_contains exits on status alone before
|
||||
# nginx picks up the new config. Hand-roll a retry that polls the BODY
|
||||
# written to a file (avoids shell-quoting issues with JSON bodies that
|
||||
# contain embedded double quotes).
|
||||
rm -f /tmp/route-removed-body
|
||||
local attempt=0
|
||||
for attempt in $(seq 1 30); do
|
||||
curl --connect-to "${TEST_APP}.${DOKKU_DOMAIN}:80:localhost:80" -kSso /tmp/route-removed-body "http://${TEST_APP}.${DOKKU_DOMAIN}:80/api/v0/Procfile" || true
|
||||
if ! grep -q 'python3 -m http.server' /tmp/route-removed-body 2>/dev/null; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
run /bin/bash -c "grep -c 'python3 -m http.server' /tmp/route-removed-body || true"
|
||||
assert_output "0"
|
||||
}
|
||||
|
||||
@test "(proxy-route:nginx) websocket upgrade headers are present in rendered config" {
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku nginx:show-config $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "location /api/v0"
|
||||
# These headers appear in both the route's location block AND the existing
|
||||
# location / block, so allow >= 1 occurrence (count = -1) rather than the
|
||||
# default exact-count-of-1.
|
||||
assert_output_contains "proxy_http_version 1.1" -1
|
||||
assert_output_contains "proxy_set_header Upgrade \$http_upgrade" -1
|
||||
assert_output_contains "proxy_set_header Connection \$http_connection" -1
|
||||
}
|
||||
|
||||
add_api_process_callback() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
# api serves /app's working directory on port 5001. GET /Procfile returns
|
||||
# the literal Procfile bytes, which web.py does not serve - this gives the
|
||||
# HTTP assertions a clear marker for which process handled the request.
|
||||
echo "api: python3 -m http.server 5001" >>"$APP_REPO_DIR/Procfile"
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
dokku nginx:stop
|
||||
dokku openresty:start
|
||||
create_app
|
||||
dokku proxy:set "$TEST_APP" openresty
|
||||
}
|
||||
|
||||
teardown() {
|
||||
dokku proxy:route:clear "$TEST_APP" >/dev/null 2>&1 || true
|
||||
destroy_app
|
||||
dokku openresty:stop
|
||||
dokku nginx:start
|
||||
global_teardown
|
||||
}
|
||||
|
||||
@test "(proxy-route:openresty) basic routing - /api/v0 hits api, / hits web" {
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Give the daemon a moment to read the new labels.
|
||||
sleep 5
|
||||
|
||||
# Without --strip-prefix, /api/v0/Procfile reaches api as /api/v0/Procfile
|
||||
# which python's http.server returns 404 for. A 404 here proves the route
|
||||
# reaches api - web's catch-all would have returned 200.
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404"
|
||||
}
|
||||
|
||||
@test "(proxy-route:openresty) --strip-prefix toggles upstream path visibility" {
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Give the daemon a moment to read the new labels.
|
||||
sleep 5
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404"
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001 --strip-prefix"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Give the sidecar a longer window than the default HTTP retry to detect
|
||||
# and re-render after a route's labels change on the api container.
|
||||
HTTP_ASSERT_RETRIES=60 assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server"
|
||||
}
|
||||
|
||||
@test "(proxy-route:openresty) removing a route falls back to web" {
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
assert_success
|
||||
|
||||
# Set without --strip-prefix first; 404 proves the labels attached.
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Give the daemon a moment to read the new labels.
|
||||
sleep 5
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404"
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001 --strip-prefix"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Give the daemon a moment to read the new labels.
|
||||
sleep 5
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server"
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:remove $TEST_APP /api/v0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:report $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "(none)"
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Give the daemon a moment to read the new labels.
|
||||
sleep 5
|
||||
|
||||
# Poll the response body via file to avoid shell-quoting issues with JSON
|
||||
# bodies that contain embedded double quotes.
|
||||
rm -f /tmp/route-removed-body
|
||||
local attempt=0
|
||||
for attempt in $(seq 1 30); do
|
||||
curl --connect-to "${TEST_APP}.${DOKKU_DOMAIN}:80:localhost:80" -kSso /tmp/route-removed-body "http://${TEST_APP}.${DOKKU_DOMAIN}:80/api/v0/Procfile" || true
|
||||
if ! grep -q 'python3 -m http.server' /tmp/route-removed-body 2>/dev/null; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
run /bin/bash -c "grep -c 'python3 -m http.server' /tmp/route-removed-body || true"
|
||||
assert_output "0"
|
||||
}
|
||||
|
||||
add_api_process_callback() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
echo "api: python3 -m http.server 5001" >>"$APP_REPO_DIR/Procfile"
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
dokku nginx:stop
|
||||
dokku traefik:start
|
||||
create_app
|
||||
dokku proxy:set "$TEST_APP" traefik
|
||||
}
|
||||
|
||||
teardown() {
|
||||
dokku proxy:route:clear "$TEST_APP" >/dev/null 2>&1 || true
|
||||
destroy_app
|
||||
dokku traefik:stop
|
||||
dokku nginx:start
|
||||
global_teardown
|
||||
}
|
||||
|
||||
@test "(proxy-route:traefik) basic routing - /api/v0 hits api, / hits web" {
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Routes are applied via container labels - rebuild so the api container
|
||||
# restarts with the new labels attached.
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker inspect $TEST_APP.api.1 --format '{{ index .Config.Labels \"traefik.http.routers.$TEST_APP-api-api-v0.rule\" }}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "(Host(\`$TEST_APP.$DOKKU_DOMAIN\`)) && PathPrefix(\`/api/v0\`)"
|
||||
|
||||
# Give the daemon a moment to read the new labels.
|
||||
sleep 5
|
||||
|
||||
# Without --strip-prefix, /api/v0/Procfile reaches api as /api/v0/Procfile
|
||||
# which python's http.server returns 404 for. A 404 here proves the route
|
||||
# reaches api - web's catch-all would have returned 200.
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404"
|
||||
}
|
||||
|
||||
@test "(proxy-route:traefik) --strip-prefix toggles upstream path visibility" {
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Give the daemon a moment to read the new labels.
|
||||
sleep 5
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404"
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001 --strip-prefix"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Give the daemon a moment to read the new labels.
|
||||
sleep 5
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server"
|
||||
}
|
||||
|
||||
@test "(proxy-route:traefik) removing a route falls back to web" {
|
||||
run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" add_api_process_callback
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=1 api=1"
|
||||
assert_success
|
||||
|
||||
# Set the route without --strip-prefix first; a 404 from api proves the
|
||||
# labels attached and traefik is routing correctly.
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Give the daemon a moment to read the new labels.
|
||||
sleep 5
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "" "404"
|
||||
|
||||
# Switch to --strip-prefix and verify api now serves the Procfile.
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001 --strip-prefix"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Give the daemon a moment to read the new labels.
|
||||
sleep 5
|
||||
assert_http_localhost_response_contains "http" "${TEST_APP}.${DOKKU_DOMAIN}" "80" "/api/v0/Procfile" "python3 -m http.server"
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:remove $TEST_APP /api/v0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Confirm storage was actually mutated before doing the slow rebuild.
|
||||
run /bin/bash -c "dokku proxy:route:report $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "(none)"
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# Give the daemon a moment to read the new labels.
|
||||
sleep 5
|
||||
|
||||
# After ps:rebuild, traefik recreates the api container without the route
|
||||
# labels, but there is still a race with traefik picking up the new state.
|
||||
# Poll the response body via file to avoid shell-quoting issues with JSON
|
||||
# bodies that contain embedded double quotes.
|
||||
rm -f /tmp/route-removed-body
|
||||
local attempt=0
|
||||
for attempt in $(seq 1 30); do
|
||||
curl --connect-to "${TEST_APP}.${DOKKU_DOMAIN}:80:localhost:80" -kSso /tmp/route-removed-body "http://${TEST_APP}.${DOKKU_DOMAIN}:80/api/v0/Procfile" || true
|
||||
if ! grep -q 'python3 -m http.server' /tmp/route-removed-body 2>/dev/null; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
run /bin/bash -c "grep -c 'python3 -m http.server' /tmp/route-removed-body || true"
|
||||
assert_output "0"
|
||||
}
|
||||
|
||||
add_api_process_callback() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
echo "api: python3 -m http.server 5001" >>"$APP_REPO_DIR/Procfile"
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
create_app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
dokku proxy:route:clear "$TEST_APP" >/dev/null 2>&1 || true
|
||||
destroy_app
|
||||
global_teardown
|
||||
}
|
||||
|
||||
@test "(proxy:route) help text mentions route commands" {
|
||||
run /bin/bash -c "dokku proxy:help"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output_contains "proxy:route:set"
|
||||
assert_output_contains "proxy:route:remove"
|
||||
assert_output_contains "proxy:route:clear"
|
||||
assert_output_contains "proxy:route:report"
|
||||
}
|
||||
|
||||
@test "(proxy:route:set) stores a route under the default port and is idempotent" {
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:report $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "/api/v0 -> api:5000"
|
||||
|
||||
# second call with identical args produces identical state
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:report $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output_contains "/api/v0 -> api:5000"
|
||||
}
|
||||
|
||||
@test "(proxy:route:set) --port overrides the default port" {
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:report $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output_contains "/api/v0 -> api:5001"
|
||||
}
|
||||
|
||||
@test "(proxy:route:set) --strip-prefix marks the route as stripping" {
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --strip-prefix"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:report $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output_contains "/api/v0 -> api:5000 (strip)"
|
||||
}
|
||||
|
||||
@test "(proxy:route:set) re-setting without --port resets port to default" {
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 5001"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:report $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output_contains "/api/v0 -> api:5000"
|
||||
}
|
||||
|
||||
@test "(proxy:route:set) re-setting without --strip-prefix resets strip to false" {
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --strip-prefix"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:report $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output_not_contains "(strip)"
|
||||
}
|
||||
|
||||
@test "(proxy:route:set) refuses web as a target" {
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP web /api/v0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "web cannot be a route target"
|
||||
}
|
||||
|
||||
@test "(proxy:route:set) refuses root path" {
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "reserved for the web process"
|
||||
}
|
||||
|
||||
@test "(proxy:route:set) refuses path without leading slash" {
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api api/v0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "must start with /"
|
||||
}
|
||||
|
||||
@test "(proxy:route:set) refuses path with trailing slash" {
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0/"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "must not end with /"
|
||||
}
|
||||
|
||||
@test "(proxy:route:set) refuses ports out of range" {
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0 --port 70000"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "out of range"
|
||||
}
|
||||
|
||||
@test "(proxy:route:set) warns when target process is scaled to zero" {
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP api=0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "scaled to 0"
|
||||
}
|
||||
|
||||
@test "(proxy:route:remove) deletes a route" {
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:remove $TEST_APP /api/v0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:report $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output_not_contains "/api/v0"
|
||||
}
|
||||
|
||||
@test "(proxy:route:remove) is idempotent on a nonexistent path" {
|
||||
run /bin/bash -c "dokku proxy:route:remove $TEST_APP /does/not/exist"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(proxy:route:clear) removes every route" {
|
||||
dokku proxy:route:set "$TEST_APP" api /api/v0 >/dev/null
|
||||
dokku proxy:route:set "$TEST_APP" api /api/v0/admin >/dev/null
|
||||
dokku proxy:route:set "$TEST_APP" ws /ws --port 8080 >/dev/null
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:clear $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:report $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output_contains "(none)"
|
||||
}
|
||||
|
||||
@test "(proxy:route:clear) is idempotent on an empty route set" {
|
||||
run /bin/bash -c "dokku proxy:route:clear $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(proxy:route:report) supports json output" {
|
||||
dokku proxy:route:set "$TEST_APP" api /api/v0 --port 5001 >/dev/null
|
||||
dokku proxy:route:set "$TEST_APP" ws /ws --port 8080 --strip-prefix >/dev/null
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:report $TEST_APP --format json | jq -e '.routes | length'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "2"
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:report $TEST_APP --format json | jq -r '.routes[] | select(.path == \"/ws\") | .strip_prefix'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "true"
|
||||
}
|
||||
|
||||
@test "(proxy:route:set) stores routes under haproxy backend even though they are inert" {
|
||||
dokku proxy:set "$TEST_APP" haproxy >/dev/null 2>&1 || skip "haproxy proxy not available"
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:set $TEST_APP api /api/v0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku proxy:route:report $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output_contains "/api/v0 -> api:5000"
|
||||
}
|
||||
@@ -305,6 +305,129 @@ worker=1" >/var/lib/dokku/config/ps/$TEST_APP/scale
|
||||
assert_output "[]"
|
||||
}
|
||||
|
||||
@test "(ps:scale) --replace" {
|
||||
echo "web=4
|
||||
worker=1" >/var/lib/dokku/config/ps/$TEST_APP/scale
|
||||
|
||||
run /bin/bash -c "dokku ps:scale --replace $TEST_APP web=2"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --quiet ps:scale $TEST_APP"
|
||||
output=$(echo "$output" | tr -s " ")
|
||||
echo "output: ($output)"
|
||||
echo "status: $status"
|
||||
assert_output $'web: 2\nworker: 0'
|
||||
}
|
||||
|
||||
@test "(ps:scale) --clear" {
|
||||
echo "web=4
|
||||
worker=1" >/var/lib/dokku/config/ps/$TEST_APP/scale
|
||||
|
||||
run /bin/bash -c "dokku ps:scale --clear $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --quiet ps:scale $TEST_APP"
|
||||
output=$(echo "$output" | tr -s " ")
|
||||
echo "output: ($output)"
|
||||
echo "status: $status"
|
||||
assert_output $'web: 1\nworker: 0'
|
||||
}
|
||||
|
||||
@test "(ps:scale) --clear and --replace argument validation" {
|
||||
run /bin/bash -c "dokku ps:scale --replace $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Must specify at least one process type when using the --replace flag"
|
||||
|
||||
run /bin/bash -c "dokku ps:scale --clear $TEST_APP web=1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Process types cannot be specified when using the --clear flag"
|
||||
|
||||
run /bin/bash -c "dokku ps:scale --clear --replace $TEST_APP web=1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "The --clear and --replace flags cannot be specified together"
|
||||
}
|
||||
|
||||
@test "(ps:scale) invalid process counts" {
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=-1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Invalid count for process type web: value must be zero or greater"
|
||||
|
||||
run /bin/bash -c "dokku ps:scale --replace $TEST_APP web=1 worker=-2"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Invalid count for process type worker: value must be zero or greater"
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP =1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Missing process type for count 1"
|
||||
|
||||
run_plugn_trigger ps-set-scale $TEST_APP true false web=-1
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Invalid count for process type web: value must be zero or greater"
|
||||
|
||||
run /bin/bash -c "dokku --quiet ps:scale $TEST_APP"
|
||||
output=$(echo "$output" | tr -s " ")
|
||||
echo "output: ($output)"
|
||||
echo "status: $status"
|
||||
assert_output "web: 1"
|
||||
|
||||
run /bin/bash -c "dokku ps:scale --skip-deploy $TEST_APP web=0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --quiet ps:scale $TEST_APP"
|
||||
output=$(echo "$output" | tr -s " ")
|
||||
echo "output: ($output)"
|
||||
echo "status: $status"
|
||||
assert_output "web: 0"
|
||||
}
|
||||
|
||||
@test "(ps:scale) repairing a negative process count" {
|
||||
echo "web=-1
|
||||
worker=2" >/var/lib/dokku/config/ps/$TEST_APP/scale
|
||||
|
||||
run /bin/bash -c "dokku --quiet ps:scale $TEST_APP"
|
||||
output=$(echo "$output" | tr -s " ")
|
||||
echo "output: ($output)"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output $'web: -1\nworker: 2'
|
||||
|
||||
run_plugn_trigger ps-current-scale $TEST_APP
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale --skip-deploy $TEST_APP web=1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --quiet ps:scale $TEST_APP"
|
||||
output=$(echo "$output" | tr -s " ")
|
||||
echo "output: ($output)"
|
||||
echo "status: $status"
|
||||
assert_output $'web: 1\nworker: 2'
|
||||
}
|
||||
|
||||
@test "(ps) handle windows newlines in procfile" {
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP procfile_line_endings_to_windows
|
||||
echo "output: $output"
|
||||
|
||||
@@ -196,3 +196,16 @@ teardown() {
|
||||
echo "output: ($output)"
|
||||
assert_output 'web: 1'
|
||||
}
|
||||
|
||||
@test "(ps:rebuild) --all --no-cache" {
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP convert_to_dockerfile
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild --all --no-cache"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "CACHED" 1
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
create_app
|
||||
}
|
||||
|
||||
teardown() {
|
||||
destroy_app
|
||||
global_teardown
|
||||
}
|
||||
|
||||
@test "(ps:scale) --replace scales down unspecified processes" {
|
||||
run /bin/bash -c "dokku builder-herokuish:set $TEST_APP allowed true"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP worker=1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker ps --filter label=com.dokku.app-name=$TEST_APP --filter label=com.dokku.process-type=worker --format '{{.Names}}' | wc -l"
|
||||
output=$(echo "$output" | tr -d " ")
|
||||
echo "output: ($output)"
|
||||
echo "status: $status"
|
||||
assert_output "1"
|
||||
|
||||
run /bin/bash -c "dokku ps:scale --replace $TEST_APP web=1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --quiet ps:scale $TEST_APP"
|
||||
output=$(echo "$output" | tr -s " ")
|
||||
echo "output: ($output)"
|
||||
echo "status: $status"
|
||||
assert_output $'cron: 0\ncustom: 0\nrelease: 0\ntask: 0\nweb: 1\nworker: 0'
|
||||
|
||||
sleep 2
|
||||
|
||||
run /bin/bash -c "dokku ps:retire"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker ps --filter label=com.dokku.app-name=$TEST_APP --filter label=com.dokku.process-type=worker --format '{{.Names}}' | wc -l"
|
||||
output=$(echo "$output" | tr -d " ")
|
||||
echo "output: ($output)"
|
||||
echo "status: $status"
|
||||
assert_output "0"
|
||||
}
|
||||
|
||||
@test "(ps:scale) --clear without a web process type" {
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=0 console=0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python-console-only
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:scale --skip-deploy $TEST_APP console=2"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --quiet ps:scale $TEST_APP"
|
||||
output=$(echo "$output" | tr -s " ")
|
||||
echo "output: ($output)"
|
||||
echo "status: $status"
|
||||
assert_output "console: 2"
|
||||
|
||||
run /bin/bash -c "dokku ps:scale --clear $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --quiet ps:scale $TEST_APP"
|
||||
output=$(echo "$output" | tr -s " ")
|
||||
echo "output: ($output)"
|
||||
echo "status: $status"
|
||||
assert_output "console: 0"
|
||||
}
|
||||
|
||||
@test "(ps:retire) missing app" {
|
||||
run /bin/bash -c "dokku ps:retire missing-app"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "App missing-app does not exist"
|
||||
}
|
||||
@@ -90,6 +90,12 @@ teardown() {
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "jq -r '.auths | keys | join(\",\")' /var/lib/dokku/config/registry/$TEST_APP/config.json"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_contains "index.docker.io"
|
||||
}
|
||||
|
||||
@test "(registry:logout) global logout" {
|
||||
@@ -106,6 +112,55 @@ teardown() {
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "jq -r '.auths | keys | join(\",\")' $DOKKU_ROOT/.docker/config.json"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_contains "index.docker.io"
|
||||
}
|
||||
|
||||
@test "(registry:auth-status) matches a credential written by registry:login" {
|
||||
if [[ -z "$DOCKERHUB_USERNAME" ]] || [[ -z "$DOCKERHUB_TOKEN" ]]; then
|
||||
skip "skipping due to missing docker.io credentials DOCKERHUB_USERNAME:DOCKERHUB_TOKEN"
|
||||
fi
|
||||
|
||||
run /bin/bash -c "dokku registry:login --global docker.io $DOCKERHUB_USERNAME $DOCKERHUB_TOKEN"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku registry:auth-status --global docker.io $DOCKERHUB_USERNAME $DOCKERHUB_TOKEN"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 0
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku registry:auth-status --global docker.io $DOCKERHUB_USERNAME wrong-password"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 2
|
||||
|
||||
run /bin/bash -c "dokku registry:report --global --format json | jq -r '.\"global-auth-servers\"'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "docker.io"
|
||||
|
||||
run /bin/bash -c "dokku registry:logout --global docker.io"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku registry:auth-status --global docker.io $DOCKERHUB_USERNAME $DOCKERHUB_TOKEN"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 1
|
||||
|
||||
run /bin/bash -c "dokku registry:auth-status --global docker.io"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 0
|
||||
}
|
||||
|
||||
@test "(registry) per-app credentials deleted on app destroy" {
|
||||
@@ -567,6 +622,13 @@ teardown() {
|
||||
skip "skipping due to missing docker.io credentials DOCKERHUB_USERNAME:DOCKERHUB_TOKEN"
|
||||
fi
|
||||
|
||||
# this test pushes to the registry, so it establishes its own credentials
|
||||
# rather than relying on a login left behind by an earlier test
|
||||
run /bin/bash -c "dokku registry:login --global docker.io $DOCKERHUB_USERNAME $DOCKERHUB_TOKEN"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku registry:set $TEST_APP push-on-release true"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
@@ -696,6 +758,13 @@ teardown() {
|
||||
skip "skipping due to missing docker.io credentials DOCKERHUB_USERNAME:DOCKERHUB_TOKEN"
|
||||
fi
|
||||
|
||||
# this test pushes to the registry, so it establishes its own credentials
|
||||
# rather than relying on a login left behind by an earlier test
|
||||
run /bin/bash -c "dokku registry:login --global docker.io $DOCKERHUB_USERNAME $DOCKERHUB_TOKEN"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku registry:set $TEST_APP push-on-release true"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
@@ -743,3 +812,214 @@ teardown() {
|
||||
assert_success
|
||||
assert_output "true"
|
||||
}
|
||||
|
||||
@test "(registry:auth-status) validates arguments" {
|
||||
run /bin/bash -c "dokku registry:auth-status"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 3
|
||||
assert_output_contains "Please specify an app or the --global flag"
|
||||
|
||||
run /bin/bash -c "dokku registry:auth-status --global"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 3
|
||||
assert_output_contains "Missing server argument"
|
||||
|
||||
run /bin/bash -c "dokku registry:auth-status $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 3
|
||||
assert_output_contains "Missing server argument"
|
||||
|
||||
run /bin/bash -c "dokku registry:auth-status $TEST_APP docker.io username"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 3
|
||||
assert_output_contains "Missing password argument"
|
||||
|
||||
# an unknown flag must not be reported as a differing credential, which is
|
||||
# what pflag would exit with if it handled the error itself
|
||||
run /bin/bash -c "dokku registry:auth-status --nonsense --global docker.io"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 3
|
||||
|
||||
run /bin/bash -c "dokku registry:auth-status --help"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 3
|
||||
|
||||
run /bin/bash -c "dokku registry:auth-status nonexistent-app-name docker.io username password"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 20
|
||||
|
||||
# a malformed app name must not be reported as a missing credential
|
||||
run /bin/bash -c "dokku registry:auth-status 'BAD NAME' docker.io username password"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 3
|
||||
}
|
||||
|
||||
@test "(registry:auth-status) reports per-app credential state" {
|
||||
run /bin/bash -c "dokku registry:auth-status $TEST_APP docker.io fakeuser fakepass"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 1
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku registry:auth-status $TEST_APP docker.io"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 0
|
||||
assert_output ""
|
||||
|
||||
write_registry_auth_config "$TEST_APP" "{\"auths\":{\"https://index.docker.io/v1/\":{\"auth\":\"$(fake_registry_auth fakeuser fakepass)\"}}}"
|
||||
|
||||
run /bin/bash -c "dokku registry:auth-status $TEST_APP docker.io fakeuser fakepass"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 0
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku registry:auth-status $TEST_APP docker.io fakeuser wrongpass"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 2
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku registry:auth-status $TEST_APP docker.io otheruser fakepass"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 2
|
||||
|
||||
run /bin/bash -c "dokku registry:auth-status $TEST_APP docker.io"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 2
|
||||
|
||||
run /bin/bash -c "dokku registry:auth-status $TEST_APP ghcr.io fakeuser fakepass"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 1
|
||||
|
||||
run /bin/bash -c "printf 'fakepass' | dokku registry:auth-status --password-stdin $TEST_APP docker.io fakeuser"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 0
|
||||
|
||||
run /bin/bash -c "printf 'wrongpass' | dokku registry:auth-status --password-stdin $TEST_APP docker.io fakeuser"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 2
|
||||
|
||||
run /bin/bash -c "dokku --app $TEST_APP registry:auth-status docker.io fakeuser fakepass"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 0
|
||||
}
|
||||
|
||||
@test "(registry:auth-status) normalizes server names and reports unreadable credentials" {
|
||||
write_registry_auth_config "$TEST_APP" "{\"auths\":{\"https://index.docker.io/v1/\":{\"auth\":\"$(fake_registry_auth fakeuser fakepass)\"}}}"
|
||||
|
||||
for server in docker.io hub.docker.com docker.com index.docker.io; do
|
||||
run /bin/bash -c "dokku registry:auth-status $TEST_APP $server fakeuser fakepass"
|
||||
echo "server: $server"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 0
|
||||
done
|
||||
|
||||
# docker stores registry-1.docker.io under a key of its own rather than the
|
||||
# index server, so a docker hub credential does not cover it
|
||||
run /bin/bash -c "dokku registry:auth-status $TEST_APP registry-1.docker.io fakeuser fakepass"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 1
|
||||
|
||||
write_registry_auth_config "$TEST_APP" '{"auths":{"ghcr.io":{}},"credsStore":"secretservice"}'
|
||||
|
||||
run /bin/bash -c "dokku registry:auth-status $TEST_APP ghcr.io fakeuser fakepass"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 4
|
||||
assert_output_contains "credential helper"
|
||||
assert_output_not_contains "fakepass"
|
||||
|
||||
# knowing a credential exists needs no access to the secret
|
||||
run /bin/bash -c "dokku registry:auth-status $TEST_APP ghcr.io"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 2
|
||||
|
||||
write_registry_auth_config "$TEST_APP" "{\"auths\":{\"ghcr.io\":{\"auth\":\"$(fake_registry_auth fakeuser '')\",\"identitytoken\":\"token\"}}}"
|
||||
|
||||
run /bin/bash -c "dokku registry:auth-status $TEST_APP ghcr.io fakeuser fakepass"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 4
|
||||
assert_output_contains "identity token"
|
||||
|
||||
# a username that differs settles the comparison without reading the secret
|
||||
run /bin/bash -c "dokku registry:auth-status $TEST_APP ghcr.io otheruser fakepass"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 2
|
||||
}
|
||||
|
||||
@test "(registry:report) auth-servers raw vs computed vs global" {
|
||||
run /bin/bash -c "dokku registry:report $TEST_APP --format json | jq -r '.\"auth-servers\"'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku registry:report $TEST_APP --format json | jq -r '.\"computed-auth-servers\" == .\"global-auth-servers\"'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
write_registry_auth_config "$TEST_APP" "{\"auths\":{\"https://index.docker.io/v1/\":{\"auth\":\"$(fake_registry_auth fakeuser fakepass)\"},\"ghcr.io\":{\"auth\":\"$(fake_registry_auth fakeuser fakepass)\"}}}"
|
||||
|
||||
run /bin/bash -c "dokku registry:report $TEST_APP --format json | jq -r '.\"auth-servers\"'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "docker.io,ghcr.io"
|
||||
|
||||
# a per-app config shadows the global one entirely rather than merging
|
||||
run /bin/bash -c "dokku registry:report $TEST_APP --format json | jq -r '.\"computed-auth-servers\"'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "docker.io,ghcr.io"
|
||||
|
||||
run /bin/bash -c "dokku registry:report $TEST_APP --format json | jq -r 'has(\"auth-servers\") and has(\"registry-auth-servers\")'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
run /bin/bash -c "dokku registry:report --global --format json | jq -r 'has(\"global-auth-servers\") and has(\"computed-auth-servers\")'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
}
|
||||
|
||||
fake_registry_auth() {
|
||||
declare desc="base64 encodes a username and password as docker stores them"
|
||||
declare USERNAME="$1" PASSWORD="$2"
|
||||
printf '%s:%s' "$USERNAME" "$PASSWORD" | base64 -w0
|
||||
}
|
||||
|
||||
write_registry_auth_config() {
|
||||
declare desc="writes a docker config.json for an app without contacting a registry"
|
||||
declare APP="$1" CONTENTS="$2"
|
||||
mkdir -p "/var/lib/dokku/config/registry/$APP"
|
||||
echo "$CONTENTS" >"/var/lib/dokku/config/registry/$APP/config.json"
|
||||
chown -R dokku:dokku "/var/lib/dokku/config/registry/$APP"
|
||||
chmod 600 "/var/lib/dokku/config/registry/$APP/config.json"
|
||||
}
|
||||
@@ -59,6 +59,22 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_output "536870912"
|
||||
|
||||
run /bin/bash -c "dokku resource:limit --memory 1G $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
CID=$(<$DOKKU_ROOT/$TEST_APP/CONTAINER.web.1)
|
||||
run /bin/bash -c "docker inspect --format '{{.HostConfig.Memory}}' $CID"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "1073741824"
|
||||
|
||||
run /bin/bash -c "dokku resource:limit --memory 512 $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
@@ -174,3 +190,52 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "(resource) resource:limit-clear preserves reservations" {
|
||||
run /bin/bash -c "dokku resource:limit --memory 512m $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku resource:limit --memory 384m --process-type web $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku resource:reserve --memory 256m $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku resource:reserve --memory 128m --process-type web $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku resource:limit-clear $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku resource:report --resource-_default_.limit.memory $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku resource:report --resource-web.limit.memory $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku resource:report --resource-_default_.reserve.memory $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "256m"
|
||||
|
||||
run /bin/bash -c "dokku resource:report --resource-web.reserve.memory $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "128m"
|
||||
}
|
||||
@@ -149,3 +149,52 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "(resource) resource:reserve-clear preserves limits" {
|
||||
run /bin/bash -c "dokku resource:limit --memory 512m $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku resource:limit --memory 384m --process-type web $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku resource:reserve --memory 256m $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku resource:reserve --memory 128m --process-type web $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku resource:reserve-clear $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku resource:report --resource-_default_.reserve.memory $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku resource:report --resource-web.reserve.memory $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku resource:report --resource-_default_.limit.memory $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "512m"
|
||||
|
||||
run /bin/bash -c "dokku resource:report --resource-web.limit.memory $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "384m"
|
||||
}
|
||||
@@ -101,6 +101,8 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# DOKKU_OMIT_RESOURCE_ARGS has to survive the privilege drop in
|
||||
# plugins/plugin/subcommands/trigger, so this also covers that forwarding
|
||||
run_plugn_trigger DOKKU_OMIT_RESOURCE_ARGS=1 docker-args-process-build "$TEST_APP" herokuish
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
@@ -129,3 +131,80 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "(resource) resource:limit uppercase memory units" {
|
||||
run /bin/bash -c "dokku resource:limit --memory 1G --memory-swap 2G $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku resource:reserve --memory 512M $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run_plugin_script resource docker-args-process-deploy "$TEST_APP" herokuish "dokku/$TEST_APP:latest" web "< /dev/null"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "--memory=1G "
|
||||
assert_output_contains "--memory-swap=2G "
|
||||
assert_output_contains "--memory-reservation=512M "
|
||||
assert_output_not_contains "1Gm"
|
||||
assert_output_not_contains "512Mm"
|
||||
|
||||
run /bin/bash -c "dokku resource:limit --memory 1G --process-type build $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run_plugn_trigger docker-args-process-build "$TEST_APP" herokuish
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "--memory=1G "
|
||||
assert_output_not_contains "1Gm"
|
||||
}
|
||||
|
||||
@test "(resource) resource:limit rejects invalid memory values" {
|
||||
run /bin/bash -c "dokku resource:limit --memory '100G --foo' $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku resource:limit --memory 1x $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku resource:limit --memory-swap 1x $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku resource:reserve --memory 1Gm $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku resource:report --resource-_default_.limit.memory $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku resource:report --resource-_default_.reserve.memory $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku resource:limit --memory-swap -1 $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku resource:report --resource-_default_.limit.memory-swap $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "-1"
|
||||
}
|
||||
@@ -140,3 +140,65 @@ teardown() {
|
||||
assert_success
|
||||
assert_output_not_contains "$container_id"
|
||||
}
|
||||
|
||||
@test "(run:logs) run:logs" {
|
||||
run deploy_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku run:detached $TEST_APP worker"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku run:list $TEST_APP --format json | jq -r '.[0].name'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
local RUN_CONTAINER="$output"
|
||||
sleep 5
|
||||
|
||||
run /bin/bash -c "dokku run:logs $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "sleeping for 60 seconds"
|
||||
|
||||
run /bin/bash -c "dokku run:logs $TEST_APP -n 1 -q"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "sleeping for 60 seconds"
|
||||
|
||||
run /bin/bash -c "dokku run:logs --container $RUN_CONTAINER -q"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "sleeping for 60 seconds"
|
||||
|
||||
run /bin/bash -c "dokku run:stop $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(run:logs) invalid arguments" {
|
||||
run /bin/bash -c "dokku run:logs $TEST_APP -n abc"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Invalid value for num: must be an integer"
|
||||
|
||||
run /bin/bash -c "dokku run:logs $TEST_APP --container other-app.run.1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Specified app does not match app in container name"
|
||||
|
||||
run /bin/bash -c "dokku run:logs --container $TEST_APP.run.1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Specified container does not exist"
|
||||
}
|
||||
@@ -8,6 +8,7 @@ setup() {
|
||||
}
|
||||
|
||||
teardown() {
|
||||
docker container rm -f "$TEST_APP.run.9999" >/dev/null 2>&1 || true
|
||||
destroy_app
|
||||
global_teardown
|
||||
}
|
||||
@@ -29,12 +30,35 @@ teardown() {
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "(run) run over ssh preserves echo-like arguments" {
|
||||
run deploy_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "ssh dokku@$DOKKU_DOMAIN run $TEST_APP /bin/echo --version --help 2>/dev/null"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "--version --help"
|
||||
|
||||
# bats strips trailing newlines from $output, so count bytes to verify -n was honored
|
||||
run /bin/bash -c "ssh dokku@$DOKKU_DOMAIN run $TEST_APP /bin/echo -n hello 2>/dev/null | wc -c"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "5"
|
||||
}
|
||||
|
||||
@test "(run) run:detached" {
|
||||
run deploy_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
# the leading --label is replayed out of DOKKU_GLOBAL_FLAGS by
|
||||
# plugins/scheduler-docker-local/scheduler-run, so this also covers that variable
|
||||
# surviving the re-exec as the dokku user
|
||||
RANDOM_RUN_CID="$(dokku --label=com.dokku.test-label=value run:detached $TEST_APP sleep 300)"
|
||||
run /bin/bash -c "docker inspect -f '{{ .State.Status }}' $RANDOM_RUN_CID"
|
||||
echo "output: $output"
|
||||
@@ -154,6 +178,58 @@ teardown() {
|
||||
assert_output "2"
|
||||
}
|
||||
|
||||
@test "(run:stop) only stops run containers for the app" {
|
||||
run deploy_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku run:detached $TEST_APP sleep 300"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku run:list $TEST_APP --format json | jq -r '.[0].name'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
local RUN_CONTAINER="$output"
|
||||
|
||||
run /bin/bash -c "docker container run -d --name $TEST_APP.run.9999 --entrypoint sleep dokku/$TEST_APP:latest 300"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku run:stop $TEST_APP --container other-app.run.1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Specified app does not match app in container name"
|
||||
|
||||
run /bin/bash -c "dokku run:stop $TEST_APP --container $TEST_APP.run.9999"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Specified container does not exist"
|
||||
|
||||
run /bin/bash -c "docker container inspect -f '{{.State.Running}}' $TEST_APP.run.9999"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
run /bin/bash -c "dokku run:stop $TEST_APP --container $RUN_CONTAINER"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker container ls -q --filter name=^/$RUN_CONTAINER\$ | wc -l"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "0"
|
||||
}
|
||||
|
||||
@test "(run) docker-options and -e flags are not eval-injected" {
|
||||
run deploy_app
|
||||
echo "output: $output"
|
||||
@@ -178,6 +254,23 @@ teardown() {
|
||||
[[ "$output" != *"uid="* ]] || flunk "id command output leaked - env value was expanded"
|
||||
}
|
||||
|
||||
@test "(run) run propagates the command exit code" {
|
||||
run deploy_app dockerfile
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku run $TEST_APP sh -c 'exit 3'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 3
|
||||
|
||||
run /bin/bash -c "dokku run $TEST_APP sh -c 'exit 0'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(run) --ttl-seconds rejects non-numeric input; docker-options stores it verbatim" {
|
||||
run /bin/bash -c "dokku run --ttl-seconds '\$(id)' $TEST_APP echo hi"
|
||||
echo "output: $output"
|
||||
|
||||
@@ -8,6 +8,8 @@ setup() {
|
||||
|
||||
teardown() {
|
||||
global_teardown
|
||||
docker image rm "dokku-test/$TEST_APP:shared" &>/dev/null || true
|
||||
start_retire_timer
|
||||
}
|
||||
|
||||
@test "(scheduler-docker-local:report) --global raw and computed keys" {
|
||||
@@ -483,3 +485,322 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_output "running"
|
||||
}
|
||||
|
||||
@test "(scheduler-docker-local) ps:retire keeps an image that is another app's source image" {
|
||||
local SECOND_APP="$TEST_APP-2" TMP_IMAGE_DIR
|
||||
stop_retire_timer
|
||||
TMP_IMAGE_DIR="$(mktemp -d "/tmp/${DOKKU_DOMAIN}.XXXXX")"
|
||||
cp -r "${BATS_TEST_DIRNAME}/../../tests/apps/python/." "$TMP_IMAGE_DIR"
|
||||
run /bin/bash -c "docker image build -t dokku-test/$TEST_APP:shared -f $TMP_IMAGE_DIR/alt.Dockerfile $TMP_IMAGE_DIR"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
rm -rf "$TMP_IMAGE_DIR"
|
||||
assert_success
|
||||
|
||||
run create_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run create_app "$SECOND_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku checks:set $TEST_APP wait-to-retire 1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku git:from-image $TEST_APP dokku-test/$TEST_APP:shared"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku git:from-image $SECOND_APP dokku-test/$TEST_APP:shared"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "tar -C ${BATS_TEST_DIRNAME}/../../tests/apps -cf - python | dokku git:from-archive $TEST_APP --"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
sleep 3
|
||||
|
||||
run /bin/bash -c "dokku ps:retire"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "is the source image for $SECOND_APP"
|
||||
|
||||
run /bin/bash -c "docker image inspect dokku-test/$TEST_APP:shared --format '{{.Id}}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(scheduler-docker-local) procfile quoted arguments on deploy" {
|
||||
run create_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP quoted_procfile_callback
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker inspect --format '{{json .Config.Cmd}}' $TEST_APP.web.1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output '["python3","-u","web.py","double quoted","single quoted","escaped \"quote\"","literal`tick`","5000"]'
|
||||
}
|
||||
|
||||
@test "(scheduler-docker-local) procfile quoted arguments on run" {
|
||||
run create_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP quoted_procfile_callback
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku run $TEST_APP args"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "['double quoted', 'single quoted', 'escaped \"quote\"', 'literal\`tick\`', '5000']"
|
||||
}
|
||||
|
||||
@test "(scheduler-docker-local) procfile with shell operators fails deploy" {
|
||||
run create_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP operator_procfile_callback
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Unable to parse command"
|
||||
}
|
||||
|
||||
@test "(scheduler-docker-local) deploy removes stale CHECKS files" {
|
||||
local DATA_DIR="/var/lib/dokku/data/scheduler-docker-local/$TEST_APP"
|
||||
|
||||
run create_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
mkdir -p "$DATA_DIR"
|
||||
echo "/ python/http.server" >"$DATA_DIR/CHECKS.99999999"
|
||||
touch "$DATA_DIR/CHECKS.99999998.missing"
|
||||
chown -R dokku:dokku "$DATA_DIR"
|
||||
|
||||
run deploy_app python dokku@$DOKKU_DOMAIN:$TEST_APP
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "find $DATA_DIR -maxdepth 1 -name 'CHECKS.*'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_not_exists
|
||||
}
|
||||
|
||||
@test "(scheduler-docker-local) failed deploy restores previous image" {
|
||||
local CUSTOM_TMP=$(mktemp -d "/tmp/${DOKKU_DOMAIN}.XXXXX")
|
||||
trap 'popd &>/dev/null || true; rm -rf "$CUSTOM_TMP"' INT TERM
|
||||
|
||||
run create_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku checks:set $TEST_APP wait-to-retire 1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
CUSTOM_TMP="$CUSTOM_TMP" run deploy_app python "dokku@$DOKKU_DOMAIN:$TEST_APP" dockerfile_callback
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
local previous_image
|
||||
previous_image="$(docker container inspect "$TEST_APP.web.1" --format '{{.Image}}')"
|
||||
[[ -n "$previous_image" ]]
|
||||
|
||||
run failing_check_callback "$TEST_APP" "$CUSTOM_TMP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run git -C "$CUSTOM_TMP" add app.json
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run git -C "$CUSTOM_TMP" commit -m 'Add a failing healthcheck'
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run git -C "$CUSTOM_TMP" push target master:master
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
assert_output_contains "Retagging old image $previous_image as dokku/$TEST_APP:latest"
|
||||
|
||||
run /bin/bash -c "docker image inspect dokku/$TEST_APP:latest --format '{{.Id}}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "$previous_image"
|
||||
|
||||
sleep 3
|
||||
|
||||
run /bin/bash -c "dokku ps:retire"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker image inspect dokku/$TEST_APP:latest --format '{{.Id}}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "$previous_image"
|
||||
|
||||
run /bin/bash -c "dokku ps:restart $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker container inspect $TEST_APP.web.1 --format '{{.Image}}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "$previous_image"
|
||||
|
||||
rm -rf "$CUSTOM_TMP"
|
||||
}
|
||||
|
||||
@test "(scheduler-docker-local) retire keeps image tagged as the app latest" {
|
||||
local CUSTOM_TMP=$(mktemp -d "/tmp/${DOKKU_DOMAIN}.XXXXX")
|
||||
trap 'popd &>/dev/null || true; rm -rf "$CUSTOM_TMP"' INT TERM
|
||||
|
||||
run create_app
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku checks:set $TEST_APP wait-to-retire 1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
rmdir "$CUSTOM_TMP"
|
||||
cp -r "${BATS_TEST_DIRNAME}/../../tests/apps/python" "$CUSTOM_TMP"
|
||||
dockerfile_callback "$TEST_APP" "$CUSTOM_TMP"
|
||||
failing_check_callback "$TEST_APP" "$CUSTOM_TMP"
|
||||
|
||||
run git -C "$CUSTOM_TMP" init -b master
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run git -C "$CUSTOM_TMP" config user.email "robot@example.com"
|
||||
assert_success
|
||||
run git -C "$CUSTOM_TMP" config user.name "Test Robot"
|
||||
assert_success
|
||||
run git -C "$CUSTOM_TMP" remote add target "dokku@$DOKKU_DOMAIN:$TEST_APP"
|
||||
assert_success
|
||||
|
||||
run git -C "$CUSTOM_TMP" add .
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run git -C "$CUSTOM_TMP" commit -m 'initial commit'
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run git -C "$CUSTOM_TMP" push target master:master
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
local failed_image
|
||||
failed_image="$(docker image inspect "dokku/$TEST_APP:latest" --format '{{.Id}}')"
|
||||
[[ -n "$failed_image" ]]
|
||||
|
||||
sleep 3
|
||||
|
||||
run /bin/bash -c "dokku ps:retire"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "is the current image for $TEST_APP, skipping rm"
|
||||
|
||||
run /bin/bash -c "docker image inspect dokku/$TEST_APP:latest --format '{{.Id}}'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "$failed_image"
|
||||
|
||||
rm -rf "$CUSTOM_TMP"
|
||||
}
|
||||
|
||||
quoted_procfile_callback() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
mv "$APP_REPO_DIR/dockerfile.Dockerfile" "$APP_REPO_DIR/Dockerfile"
|
||||
cat >"$APP_REPO_DIR/Procfile" <<'PROCFILE'
|
||||
web: python3 -u web.py "double quoted" 'single quoted' "escaped \"quote\"" literal\`tick\` "$PORT"
|
||||
args: python3 -c "import sys; print(sys.argv[1:])" "double quoted" 'single quoted' "escaped \"quote\"" literal\`tick\` "$PORT"
|
||||
PROCFILE
|
||||
}
|
||||
|
||||
operator_procfile_callback() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
mv "$APP_REPO_DIR/dockerfile.Dockerfile" "$APP_REPO_DIR/Dockerfile"
|
||||
cat >"$APP_REPO_DIR/Procfile" <<'PROCFILE'
|
||||
web: python3 -u web.py && echo done
|
||||
PROCFILE
|
||||
}
|
||||
|
||||
stop_retire_timer() {
|
||||
declare desc="stops the dokku-retire timer so only the test runs ps:retire"
|
||||
if systemctl is-active --quiet dokku-retire.timer 2>/dev/null; then
|
||||
systemctl stop dokku-retire.timer
|
||||
RETIRE_TIMER_STOPPED=true
|
||||
fi
|
||||
}
|
||||
|
||||
start_retire_timer() {
|
||||
declare desc="starts the dokku-retire timer if stop_retire_timer stopped it"
|
||||
if [[ "$RETIRE_TIMER_STOPPED" == "true" ]]; then
|
||||
systemctl start dokku-retire.timer
|
||||
fi
|
||||
}
|
||||
|
||||
dockerfile_callback() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
mv "$APP_REPO_DIR/dockerfile.Dockerfile" "$APP_REPO_DIR/Dockerfile"
|
||||
}
|
||||
|
||||
failing_check_callback() {
|
||||
local APP="$1"
|
||||
local APP_REPO_DIR="$2"
|
||||
mv "$APP_REPO_DIR/app-failing-check.json" "$APP_REPO_DIR/app.json"
|
||||
}
|
||||
@@ -10,10 +10,8 @@ setup() {
|
||||
teardown() {
|
||||
dokku --force apps:destroy $TEST_APP >/dev/null 2>/dev/null || true
|
||||
dokku --force apps:destroy ${TEST_APP}-2 >/dev/null 2>/dev/null || true
|
||||
for resource in deployment service pod cronjob job secret ingress serviceaccount; do
|
||||
dokku scheduler-k3s:annotations:set --global --resource-type "$resource" foo "" >/dev/null 2>/dev/null || true
|
||||
dokku scheduler-k3s:annotations:set --global --resource-type "$resource" bar "" >/dev/null 2>/dev/null || true
|
||||
done
|
||||
dokku scheduler-k3s:annotations:clear --global >/dev/null 2>/dev/null || true
|
||||
dokku scheduler-k3s:node-sysctls:clear --global >/dev/null 2>/dev/null || true
|
||||
global_teardown
|
||||
}
|
||||
|
||||
@@ -113,3 +111,166 @@ teardown() {
|
||||
assert_failure
|
||||
assert_output_contains "Invalid flag passed"
|
||||
}
|
||||
|
||||
@test "(scheduler-k3s:annotations:set) --replace writes the declared map in one call" {
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:set $TEST_APP --resource-type deployment keep old-value"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:set $TEST_APP --resource-type deployment drop dropped-value"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:set --replace $TEST_APP --resource-type deployment keep=new-value add=added-value"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:report $TEST_APP --format json | jq -r 'keys | sort | join(\",\")'"
|
||||
assert_success
|
||||
assert_output "global.deployment.add,global.deployment.keep"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:report $TEST_APP --format json | jq -r '.\"global.deployment.keep\"'"
|
||||
assert_success
|
||||
assert_output "new-value"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:set --replace $TEST_APP --resource-type deployment --process-type web scoped=scoped-value"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:report $TEST_APP --format json | jq -r 'keys | sort | join(\",\")'"
|
||||
assert_success
|
||||
assert_output "global.deployment.add,global.deployment.keep,web.deployment.scoped"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:set --replace --global --resource-type deployment global-key=global-value"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:report --global --format json | jq -r '.\"global.deployment.global-key\"'"
|
||||
assert_success
|
||||
assert_output "global-value"
|
||||
}
|
||||
|
||||
@test "(scheduler-k3s:annotations:set) --replace stores empty values and rejects malformed pair lists" {
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:set --replace $TEST_APP --resource-type deployment empty="
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:report $TEST_APP --format json | jq -r '.\"global.deployment.empty\"'"
|
||||
assert_success
|
||||
assert_output ""
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:set --replace $TEST_APP --resource-type deployment"
|
||||
assert_failure
|
||||
assert_output_contains "Must specify at least one key=value pair, use scheduler-k3s:annotations:clear to remove all annotations"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:set --replace $TEST_APP --resource-type deployment nodelimiter"
|
||||
assert_failure
|
||||
assert_output_contains "Invalid key=value pair: nodelimiter"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:set --replace $TEST_APP --resource-type deployment foo=bar foo=qux"
|
||||
assert_failure
|
||||
assert_output_contains "Duplicate key specified: foo"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:report $TEST_APP --format json | jq -r 'keys | sort | join(\",\")'"
|
||||
assert_success
|
||||
assert_output "global.deployment.empty"
|
||||
}
|
||||
|
||||
@test "(scheduler-k3s:annotations:set) rejects an unknown resource-type and a missing app" {
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:set $TEST_APP --resource-type deploymnet foo bar"
|
||||
assert_failure
|
||||
assert_output_contains "Invalid resource-type specified, valid resource types include:"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:set --replace $TEST_APP --resource-type deploymnet foo=bar"
|
||||
assert_failure
|
||||
assert_output_contains "Invalid resource-type specified, valid resource types include:"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:set ${TEST_APP}-missing --resource-type deployment foo bar"
|
||||
assert_failure
|
||||
assert_output_contains "App ${TEST_APP}-missing does not exist"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:set --replace ${TEST_APP}-missing --resource-type deployment foo=bar"
|
||||
assert_failure
|
||||
assert_output_contains "App ${TEST_APP}-missing does not exist"
|
||||
}
|
||||
|
||||
@test "(scheduler-k3s:annotations:clear) removes annotations, honouring filters" {
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:set $TEST_APP --resource-type deployment foo bar"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:set $TEST_APP --process-type web --resource-type deployment baz qux"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:set $TEST_APP --resource-type service alpha beta"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:clear $TEST_APP --process-type web"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:report $TEST_APP --format json | jq -r 'keys | sort | join(\",\")'"
|
||||
assert_success
|
||||
assert_output "global.deployment.foo,global.service.alpha"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:clear $TEST_APP --resource-type service"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:report $TEST_APP --format json | jq -r 'keys | sort | join(\",\")'"
|
||||
assert_success
|
||||
assert_output "global.deployment.foo"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:clear $TEST_APP"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:report $TEST_APP --format json"
|
||||
assert_success
|
||||
assert_output "{}"
|
||||
}
|
||||
|
||||
@test "(scheduler-k3s:annotations:clear) leaves neighbouring scheduler-k3s properties alone" {
|
||||
run /bin/bash -c "dokku scheduler-k3s:set $TEST_APP deploy-timeout 300s"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku scheduler-k3s:node-sysctls:set --global vm.max_map_count 262144"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku scheduler-k3s:autoscaling-auth:set $TEST_APP datadog --metadata apiKey=secret-1"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:set $TEST_APP --resource-type deployment foo bar"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:clear $TEST_APP"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:report $TEST_APP --format json"
|
||||
assert_success
|
||||
assert_output "{}"
|
||||
|
||||
run /bin/bash -c "dokku --quiet scheduler-k3s:report $TEST_APP --scheduler-k3s-deploy-timeout"
|
||||
assert_success
|
||||
assert_output "300s"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:node-sysctls:report --format json | jq -r '.\"--global\".\"vm.max_map_count\"'"
|
||||
assert_success
|
||||
assert_output "262144"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:autoscaling-auth:report $TEST_APP --format json | jq -r '.\"datadog.apiKey\"'"
|
||||
assert_success
|
||||
assert_output "secret-1"
|
||||
}
|
||||
|
||||
@test "(scheduler-k3s:annotations:clear) supports --global and requires an app" {
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:set --global --resource-type deployment foo global-val"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:clear"
|
||||
assert_failure
|
||||
assert_output_contains "Please specify an app to run the command on"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:clear ${TEST_APP}-missing"
|
||||
assert_failure
|
||||
assert_output_contains "App ${TEST_APP}-missing does not exist"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:clear $TEST_APP --resource-type deploymnet"
|
||||
assert_failure
|
||||
assert_output_contains "Invalid resource-type specified, valid resource types include:"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:report --global --format json | jq -r '.\"global.deployment.foo\"'"
|
||||
assert_success
|
||||
assert_output "global-val"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:clear --global"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:annotations:report --global --format json"
|
||||
assert_success
|
||||
assert_output "{}"
|
||||
}
|
||||
@@ -149,3 +149,44 @@ teardown() {
|
||||
assert_failure
|
||||
assert_output_contains "Invalid flag passed"
|
||||
}
|
||||
|
||||
@test "(scheduler-k3s:autoscaling-auth:set) --replace drops metadata keys not named" {
|
||||
run /bin/bash -c "dokku scheduler-k3s:autoscaling-auth:set $TEST_APP datadog --metadata apiKey=secret-1 --metadata appKey=secret-2 --metadata datadogSite=us5.datadoghq.com"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:autoscaling-auth:set $TEST_APP datadog --metadata apiKey=secret-3"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:autoscaling-auth:report $TEST_APP --format json | jq -r 'keys | sort | join(\",\")'"
|
||||
assert_success
|
||||
assert_output "datadog.apiKey,datadog.appKey,datadog.datadogSite"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:autoscaling-auth:set --replace $TEST_APP datadog --metadata apiKey=secret-4"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:autoscaling-auth:report $TEST_APP --format json | jq -r 'keys | sort | join(\",\")'"
|
||||
assert_success
|
||||
assert_output "datadog.apiKey"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:autoscaling-auth:report $TEST_APP --format json | jq -r '.\"datadog.apiKey\"'"
|
||||
assert_success
|
||||
assert_output "secret-4"
|
||||
}
|
||||
|
||||
@test "(scheduler-k3s:autoscaling-auth:set) --replace requires metadata and leaves other triggers alone" {
|
||||
run /bin/bash -c "dokku scheduler-k3s:autoscaling-auth:set $TEST_APP datadog --metadata apiKey=secret-1"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku scheduler-k3s:autoscaling-auth:set $TEST_APP memory --metadata some-key=some-value"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:autoscaling-auth:set --replace $TEST_APP datadog"
|
||||
assert_failure
|
||||
assert_output_contains "Must specify at least one --metadata flag, omit --replace to remove all metadata for the trigger"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:autoscaling-auth:set --replace $TEST_APP datadog --metadata appKey=secret-2"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:autoscaling-auth:report $TEST_APP --format json | jq -r 'keys | sort | join(\",\")'"
|
||||
assert_success
|
||||
assert_output "datadog.appKey,memory.some-key"
|
||||
}
|
||||
@@ -7,9 +7,8 @@ setup() {
|
||||
}
|
||||
|
||||
teardown() {
|
||||
dokku scheduler-k3s:charts:set cert-manager.installCRDs >/dev/null 2>/dev/null || true
|
||||
dokku scheduler-k3s:charts:set cert-manager.version >/dev/null 2>/dev/null || true
|
||||
dokku scheduler-k3s:charts:set traefik.replicas >/dev/null 2>/dev/null || true
|
||||
dokku scheduler-k3s:charts:clear cert-manager >/dev/null 2>/dev/null || true
|
||||
dokku scheduler-k3s:charts:clear traefik >/dev/null 2>/dev/null || true
|
||||
global_teardown
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,8 @@ setup() {
|
||||
}
|
||||
|
||||
teardown() {
|
||||
dokku scheduler-k3s:charts:set traefik.service.annotations.prometheus.io/scrape >/dev/null 2>/dev/null || true
|
||||
dokku scheduler-k3s:charts:set traefik.controller.config >/dev/null 2>/dev/null || true
|
||||
dokku scheduler-k3s:charts:set cert-manager.installCRDs >/dev/null 2>/dev/null || true
|
||||
dokku scheduler-k3s:charts:clear cert-manager >/dev/null 2>/dev/null || true
|
||||
dokku scheduler-k3s:charts:clear traefik >/dev/null 2>/dev/null || true
|
||||
global_teardown
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
global_setup
|
||||
}
|
||||
|
||||
teardown() {
|
||||
dokku scheduler-k3s:charts:clear cert-manager >/dev/null 2>/dev/null || true
|
||||
dokku scheduler-k3s:charts:clear traefik >/dev/null 2>/dev/null || true
|
||||
global_teardown
|
||||
}
|
||||
|
||||
@test "(scheduler-k3s:charts:set) --replace writes the declared map in one call" {
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:set traefik.replicas 2"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:set traefik.foo bar"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:set cert-manager.installCRDs false"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:set --replace traefik replicas=3 service.annotations.prometheus.io/scrape=true opt=a=b empty="
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:report traefik --format json | jq -c -S ."
|
||||
assert_success
|
||||
assert_output '{"traefik.empty":"","traefik.opt":"a=b","traefik.replicas":"3","traefik.service.annotations.prometheus.io/scrape":"true"}'
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:report cert-manager --format json | jq -c -S ."
|
||||
assert_success
|
||||
assert_output '{"cert-manager.installCRDs":"false"}'
|
||||
}
|
||||
|
||||
@test "(scheduler-k3s:charts:set) --replace rejects invalid input without writing" {
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:set traefik.replicas 2"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:set --replace"
|
||||
assert_failure
|
||||
assert_output_contains "Missing chart name"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:set --replace not-a-chart replicas=3"
|
||||
assert_failure
|
||||
assert_output_contains "Invalid chart name"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:set --replace replicas=3"
|
||||
assert_failure
|
||||
assert_output_contains "Invalid chart name"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:set --replace traefik"
|
||||
assert_failure
|
||||
assert_output_contains "scheduler-k3s:charts:clear"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:set --replace traefik replicas=3 malformed"
|
||||
assert_failure
|
||||
assert_output_contains "Invalid key=value pair: malformed"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:set --replace traefik replicas=3 =3"
|
||||
assert_failure
|
||||
assert_output_contains "Invalid key=value pair: =3"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:set --replace traefik replicas=3 replicas=4"
|
||||
assert_failure
|
||||
assert_output_contains "Duplicate key specified: replicas"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:report traefik --format json | jq -c -S ."
|
||||
assert_success
|
||||
assert_output '{"traefik.replicas":"2"}'
|
||||
}
|
||||
|
||||
@test "(scheduler-k3s:charts:clear) removes every override for a chart" {
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:set --replace traefik replicas=2 foo=bar"
|
||||
assert_success
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:set cert-manager.installCRDs false"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:clear traefik"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:report traefik --format json"
|
||||
assert_success
|
||||
assert_output "{}"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:report cert-manager --format json | jq -c -S ."
|
||||
assert_success
|
||||
assert_output '{"cert-manager.installCRDs":"false"}'
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:clear traefik"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:clear"
|
||||
assert_failure
|
||||
assert_output_contains "Missing chart name"
|
||||
|
||||
run /bin/bash -c "dokku scheduler-k3s:charts:clear not-a-chart"
|
||||
assert_failure
|
||||
assert_output_contains "Invalid chart name"
|
||||
}
|
||||
@@ -156,6 +156,34 @@ teardown() {
|
||||
assert_output_contains "SECRET_KEY=fjdkslafjdk"
|
||||
}
|
||||
|
||||
@test "(scheduler-k3s) dockerfile dokku run propagates the command exit code" {
|
||||
if [[ -z "$DOCKERHUB_USERNAME" ]] || [[ -z "$DOCKERHUB_TOKEN" ]]; then
|
||||
skip "skipping due to missing docker.io credentials DOCKERHUB_USERNAME:DOCKERHUB_TOKEN"
|
||||
fi
|
||||
|
||||
INGRESS_CLASS=nginx install_k3s
|
||||
|
||||
run /bin/bash -c "dokku apps:create $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run deploy_app dockerfile-procfile dokku@$DOKKU_DOMAIN:$TEST_APP
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --quiet run $TEST_APP sh -c 'exit 3'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_exit_status 3
|
||||
|
||||
run /bin/bash -c "dokku --quiet run $TEST_APP sh -c 'exit 0'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(scheduler-k3s) dockerfile dokku run resolves Procfile key" {
|
||||
if [[ -z "$DOCKERHUB_USERNAME" ]] || [[ -z "$DOCKERHUB_TOKEN" ]]; then
|
||||
skip "skipping due to missing docker.io credentials DOCKERHUB_USERNAME:DOCKERHUB_TOKEN"
|
||||
|
||||
Loaded 100 of 572 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user