mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
tests: add tests for build-dir
This commit is contained in:
2
tests/apps/python/sub-app/Procfile
Normal file
2
tests/apps/python/sub-app/Procfile
Normal file
@@ -0,0 +1,2 @@
|
||||
web: python3 web.py
|
||||
release: python3 release.py
|
||||
0
tests/apps/python/sub-app/null
Normal file
0
tests/apps/python/sub-app/null
Normal file
10
tests/apps/python/sub-app/release.py
Normal file
10
tests/apps/python/sub-app/release.py
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
|
||||
|
||||
def main():
|
||||
print("SECRET_KEYS: {0}".format(os.getenv('SECRET_KEY')))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
23
tests/apps/python/sub-app/web.py
Normal file
23
tests/apps/python/sub-app/web.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import http.server
|
||||
import json
|
||||
import os
|
||||
|
||||
|
||||
class GetHandler(http.server.BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "text/plain; charset=utf-8")
|
||||
self.end_headers()
|
||||
|
||||
if self.path == '/':
|
||||
self.wfile.write("python/http.server".encode("utf-8"))
|
||||
else:
|
||||
data = json.dumps(dict(os.environ), sort_keys=True, indent=4)
|
||||
self.wfile.write(data.encode("utf-8"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
port = int(os.getenv("PORT", 5000))
|
||||
server = http.server.HTTPServer(("0.0.0.0", port), GetHandler)
|
||||
print("Listening on port {0}".format(port))
|
||||
server.serve_forever()
|
||||
@@ -187,3 +187,42 @@ teardown() {
|
||||
assert_success
|
||||
assert_line 0 "herokuish"
|
||||
}
|
||||
|
||||
@test "(builder:set)" {
|
||||
run deploy_app python
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku builder:set $TEST_APP build-dir nonexistent-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
|
||||
|
||||
run /bin/bash -c "dokku builder:set $TEST_APP build-dir sub-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
|
||||
assert_output_contains 'SECRET_KEYS:'
|
||||
|
||||
run /bin/bash -c "dokku builder:set $TEST_APP build-dir"
|
||||
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 'SECRET_KEY:'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user