Replaced os.system calls with native python calls
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
echo "Creating users ..."
|
echo "Creating users ..."
|
||||||
docker-compose -f tests/compose/core/docker-compose.yml exec admin python manage.py admin admin mailu.io password || exit 1
|
docker-compose -f tests/compose/core/docker-compose.yml exec admin python manage.py admin admin mailu.io password || exit 1
|
||||||
docker-compose -f tests/compose/core/docker-compose.yml exec admin python manage.py user --hash_scheme='SHA512-CRYPT' user mailu.io 'password' || exit 1
|
docker-compose -f tests/compose/core/docker-compose.yml exec admin python manage.py user --hash_scheme='SHA512-CRYPT' user mailu.io 'password' || exit 1
|
||||||
|
echo "Admin and user successfully created!"
|
||||||
@@ -17,7 +17,7 @@ containers = []
|
|||||||
# Stop containers
|
# Stop containers
|
||||||
def stop(exit_code):
|
def stop(exit_code):
|
||||||
print_logs()
|
print_logs()
|
||||||
os.system("docker-compose -f " + compose_file + " down")
|
print(os.popen("docker-compose -f " + compose_file + " down").read())
|
||||||
sys.exit(exit_code)
|
sys.exit(exit_code)
|
||||||
|
|
||||||
# Sleep for a defined amount of time
|
# Sleep for a defined amount of time
|
||||||
@@ -64,25 +64,25 @@ def print_logs():
|
|||||||
#Iterating through docker container inspect list and print logs
|
#Iterating through docker container inspect list and print logs
|
||||||
for container in containers:
|
for container in containers:
|
||||||
print(Fore.LIGHTMAGENTA_EX + "Printing logs for: " + Fore.GREEN + container['Name'] + Style.RESET_ALL)
|
print(Fore.LIGHTMAGENTA_EX + "Printing logs for: " + Fore.GREEN + container['Name'] + Style.RESET_ALL)
|
||||||
os.system('docker container logs ' + container['Name'])
|
print(os.popen('docker container logs ' + container['Name']).read())
|
||||||
|
|
||||||
#Iterating over hooks in test folder and running them
|
#Iterating over hooks in test folder and running them
|
||||||
def hooks():
|
def hooks():
|
||||||
print("Running hooks")
|
print("Running hooks")
|
||||||
for test_file in sorted(os.listdir(test_path)):
|
for test_file in sorted(os.listdir(test_path)):
|
||||||
if test_file.endswith(".py"):
|
if test_file.endswith(".py"):
|
||||||
os.system("python3 " + test_path + test_file)
|
print(os.popen("python3 " + test_path + test_file).read())
|
||||||
elif test_file.endswith(".sh"):
|
elif test_file.endswith(".sh"):
|
||||||
os.system("./" + test_path + test_file)
|
print(os.popen("./" + test_path + test_file).read())
|
||||||
|
|
||||||
os.system("python3 tests/compose/email_test.py")
|
print(os.popen("python3 tests/compose/email_test.py").read())
|
||||||
|
|
||||||
# Start up containers
|
# Start up containers
|
||||||
os.system("docker-compose -f " + compose_file + " up -d ")
|
print(os.popen("docker-compose -f " + compose_file + " up -d ").read())
|
||||||
print()
|
print()
|
||||||
sleep()
|
sleep()
|
||||||
print()
|
print()
|
||||||
os.system("docker ps -a")
|
print(os.popen("docker ps -a").read())
|
||||||
print()
|
print()
|
||||||
health_checks()
|
health_checks()
|
||||||
print()
|
print()
|
||||||
|
|||||||
Reference in New Issue
Block a user