diff --git a/emission/tests/storageTests/TestTokenQueries.py b/emission/tests/storageTests/TestTokenQueries.py index 7e570de5e..c9be13ab0 100644 --- a/emission/tests/storageTests/TestTokenQueries.py +++ b/emission/tests/storageTests/TestTokenQueries.py @@ -158,18 +158,34 @@ def test_run_script_show(self): sp = subprocess.run(["python3", "bin/auth/insert_tokens.py", "--show"], capture_output=True) # The first message is displayed when we run tests locally # The second is displayed when we run in the docker CI, since the `DB_HOST` is set to `db` - self.assertIn(sp.stdout, + stripped_out_stdout = sp.stdout\ + .replace(b"\'CONDA_EXE\': \'/root/miniconda-23.5.2/bin/conda\', ",b"")\ + .replace(b"\'HOSTNAME\': \'78346225cfef\', ",b"")\ + .replace(b"\'EXP_CONDA_VER\': \'23.5.2\', ",b"")\ + .replace(b"\'CONDA_PREFIX\': \'/root/miniconda-23.5.2/envs/emissiontest\', ",b"")\ + .replace(b"\'CONDA_PYTHON_EXE\': \'/root/miniconda-23.5.2/bin/python\', ",b"")\ + .replace(b"\'PATH\': \'/root/miniconda-23.5.2/envs/emissiontest/bin:/root/miniconda-23.5.2/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\', ",b"")\ + .replace(b"\'_\': \'/root/miniconda-23.5.2/envs/emissiontest/bin/python\'",b"") + self.assertIn(stripped_out_stdout, [b'Retrieved config {\'DB_HOST\': \'localhost\', \'DB_RESULT_LIMIT\': 250000}\nURL not formatted, defaulting to "Stage_database"\nConnecting to database URL localhost\nx\ny\nz\n', - b'Config file not found, returning a copy of the environment variables instead...\nRetrieved config {\'PYTHONPATH\': \'.\', \'CONDA_EXE\': \'/root/miniconda-23.5.2/bin/conda\', \'_CE_M\': \'\', \'HOSTNAME\': \'a846a70e9205\', \'EXP_CONDA_VER\': \'23.5.2\', \'PWD\': \'/src/e-mission-server\', \'CONDA_PREFIX\': \'/root/miniconda-23.5.2/envs/emissiontest\', \'WEB_SERVER_HOST\': \'0.0.0.0\', \'HOME\': \'/root\', \'CONDA_PROMPT_MODIFIER\': \'(emissiontest) \', \'_CE_CONDA\': \'\', \'DB_HOST\': \'db\', \'CONDA_SHLVL\': \'1\', \'SHLVL\': \'2\', \'CONDA_PYTHON_EXE\': \'/root/miniconda-23.5.2/bin/python\', \'CONDA_DEFAULT_ENV\': \'emissiontest\', \'PATH\': \'/root/miniconda-23.5.2/envs/emissiontest/bin:/root/miniconda-23.5.2/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\', \'EXP_CONDA_VER_SUFFIX\': \'0\', \'OLDPWD\': \'/\', \'_\': \'/root/miniconda-23.5.2/envs/emissiontest/bin/python\', \'LC_CTYPE\': \'C.UTF-8\', \'KMP_DUPLICATE_LIB_OK\': \'True\', \'KMP_INIT_AT_FORK\': \'FALSE\'}\nURL not formatted, defaulting to "Stage_database"\nConnecting to database URL db\nx\ny\nz\n' + b'Config file not found, returning a copy of the environment variables instead...\nRetrieved config {\'PYTHONPATH\': \'.\', \'_CE_M\': \'\', \'PWD\': \'/src/e-mission-server\', \'WEB_SERVER_HOST\': \'0.0.0.0\', \'HOME\': \'/root\', \'CONDA_PROMPT_MODIFIER\': \'(emissiontest) \', \'_CE_CONDA\': \'\', \'DB_HOST\': \'db\', \'CONDA_SHLVL\': \'1\', \'SHLVL\': \'2\', \'CONDA_DEFAULT_ENV\': \'emissiontest\', \'EXP_CONDA_VER_SUFFIX\': \'0\', \'OLDPWD\': \'/\', \'LC_CTYPE\': \'C.UTF-8\', \'KMP_DUPLICATE_LIB_OK\': \'True\', \'KMP_INIT_AT_FORK\': \'FALSE\'}\nURL not formatted, defaulting to "Stage_database"\nConnecting to database URL db\nx\ny\nz\n' ]) def test_run_script_empty(self): sp = subprocess.run(["python3", "bin/auth/insert_tokens.py"], capture_output=True) # The first message is displayed when we run tests locally # The second is displayed when we run in the docker CI, since the `DB_HOST` is set to `db` - self.assertIn(sp.stdout, + stripped_out_stdout = sp.stdout\ + .replace(b"\'CONDA_EXE\': \'/root/miniconda-23.5.2/bin/conda\', ",b"")\ + .replace(b"\'HOSTNAME\': \'78346225cfef\', ",b"")\ + .replace(b"\'EXP_CONDA_VER\': \'23.5.2\', ",b"")\ + .replace(b"\'CONDA_PREFIX\': \'/root/miniconda-23.5.2/envs/emissiontest\', ",b"")\ + .replace(b"\'CONDA_PYTHON_EXE\': \'/root/miniconda-23.5.2/bin/python\', ",b"")\ + .replace(b"\'PATH\': \'/root/miniconda-23.5.2/envs/emissiontest/bin:/root/miniconda-23.5.2/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\', ",b"")\ + .replace(b"\'_\': \'/root/miniconda-23.5.2/envs/emissiontest/bin/python\'",b"") + self.assertIn(stripped_out_stdout, [b'Retrieved config {\'DB_HOST\': \'localhost\', \'DB_RESULT_LIMIT\': 250000}\nURL not formatted, defaulting to "Stage_database"\nConnecting to database URL localhost\nPlease provide the script with an argument. Use the "--help" option for more details\n', - b'Config file not found, returning a copy of the environment variables instead...\nRetrieved config {\'PYTHONPATH\': \'.\', \'CONDA_EXE\': \'/root/miniconda-23.5.2/bin/conda\', \'_CE_M\': \'\', \'HOSTNAME\': \'a846a70e9205\', \'EXP_CONDA_VER\': \'23.5.2\', \'PWD\': \'/src/e-mission-server\', \'CONDA_PREFIX\': \'/root/miniconda-23.5.2/envs/emissiontest\', \'WEB_SERVER_HOST\': \'0.0.0.0\', \'HOME\': \'/root\', \'CONDA_PROMPT_MODIFIER\': \'(emissiontest) \', \'_CE_CONDA\': \'\', \'DB_HOST\': \'db\', \'CONDA_SHLVL\': \'1\', \'SHLVL\': \'2\', \'CONDA_PYTHON_EXE\': \'/root/miniconda-23.5.2/bin/python\', \'CONDA_DEFAULT_ENV\': \'emissiontest\', \'PATH\': \'/root/miniconda-23.5.2/envs/emissiontest/bin:/root/miniconda-23.5.2/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\', \'EXP_CONDA_VER_SUFFIX\': \'0\', \'OLDPWD\': \'/\', \'_\': \'/root/miniconda-23.5.2/envs/emissiontest/bin/python\', \'LC_CTYPE\': \'C.UTF-8\', \'KMP_DUPLICATE_LIB_OK\': \'True\', \'KMP_INIT_AT_FORK\': \'FALSE\'}\nURL not formatted, defaulting to "Stage_database"\nConnecting to database URL db\nPlease provide the script with an argument. Use the "--help" option for more details\n' + b'Config file not found, returning a copy of the environment variables instead...\nRetrieved config {\'PYTHONPATH\': \'.\', \'_CE_M\': \'\', \'PWD\': \'/src/e-mission-server\', \'WEB_SERVER_HOST\': \'0.0.0.0\', \'HOME\': \'/root\', \'CONDA_PROMPT_MODIFIER\': \'(emissiontest) \', \'_CE_CONDA\': \'\', \'DB_HOST\': \'db\', \'CONDA_SHLVL\': \'1\', \'SHLVL\': \'2\', \'CONDA_DEFAULT_ENV\': \'emissiontest\', \'EXP_CONDA_VER_SUFFIX\': \'0\', \'OLDPWD\': \'/\', \'LC_CTYPE\': \'C.UTF-8\', \'KMP_DUPLICATE_LIB_OK\': \'True\', \'KMP_INIT_AT_FORK\': \'FALSE\'}\nURL not formatted, defaulting to "Stage_database"\nConnecting to database URL db\nPlease provide the script with an argument. Use the "--help" option for more details\n' ]) #test that no two options can be used together