diff --git a/contest/run_tests.py b/contest/run_tests.py new file mode 100644 index 0000000..fd93f20 --- /dev/null +++ b/contest/run_tests.py @@ -0,0 +1,23 @@ +import socket +import time +import pytest +import sys + +def main(): + + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + + while True: + result = sock.connect_ex(('127.0.0.1', 30015)) + if result == 0: + break + else: + print("hana not available yet, retrying...") + time.sleep(10) + + rc = pytest.main(sys.argv[1:]) + if rc != 0: + sys.exit("pytest run has failed") + +if __name__ == "__main__": + main() diff --git a/contest/taskDef.yaml b/contest/taskDef.yaml new file mode 100644 index 0000000..456d520 --- /dev/null +++ b/contest/taskDef.yaml @@ -0,0 +1,26 @@ +version: 0.1 +name: pyhdb-test +containers: + - name: pytest-runner + image: docker.wdf.sap.corp:51037/contest/pytest-runner:2.7 + command: ['bash', '-c', 'python /src/${REPO_NAME}/contest/run_tests.py /src/${REPO_NAME}/tests/'] + resources: + requests: + cpu: 1000m + memory: 500m + withHelpers: + - kind: exportDir + mountPath: /exports + - kind: syncEventSources + mountPath: /src + - kind: injectEventData + + - name: hana + image: docker.wdf.sap.corp:51037/contest/ppms_hana_112_04_standalone:1.0 + resources: + requests: + cpu: 2000m + memory: 12Gi + + command: ['bash', '/tools/build', '/tools/wait.sh'] +mainContainer: pytest-runner diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..203b504 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,5 @@ +[pytest] +hana_host = localhost +hana_port = 30015 +hana_user = System +hana_password = Password01 \ No newline at end of file