From 54b5f6fb9bed827e5e6d3e96006a2202ee4f71ff Mon Sep 17 00:00:00 2001 From: Dharhas Pothina Date: Wed, 6 Jul 2022 10:27:25 -0500 Subject: [PATCH 1/3] force color prompt --- .../modules/kubernetes/services/jupyterhub/files/skel/.bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/files/skel/.bashrc b/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/files/skel/.bashrc index 3d247ed87..a328cfe08 100644 --- a/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/files/skel/.bashrc +++ b/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/files/skel/.bashrc @@ -46,7 +46,7 @@ esac # uncomment for a colored prompt, if the terminal has the capability; turned # off by default to not distract the user: the focus in a terminal window # should be on the output of commands, not on the prompt -#force_color_prompt=yes +force_color_prompt=yes if [ -n "$force_color_prompt" ]; then if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then From 78c83330994c7e1554c55796f5c1a08a8db37f27 Mon Sep 17 00:00:00 2001 From: Dharhas Pothina Date: Wed, 6 Jul 2022 10:30:45 -0500 Subject: [PATCH 2/3] add colorized bash prompt with git and conda info --- .../services/jupyterhub/files/skel/.bashrc | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/files/skel/.bashrc b/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/files/skel/.bashrc index a328cfe08..884fc42f6 100644 --- a/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/files/skel/.bashrc +++ b/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/files/skel/.bashrc @@ -120,3 +120,33 @@ if ! shopt -oq posix; then fi . /opt/conda/etc/profile.d/conda.sh && conda activate base + +# add nicer bash prompt +conda config --set changeps1 True + +parse_git_branch() { + git branch --color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/' +} + +BASE03=$(tput setaf 234) +BASE02=$(tput setaf 235) +BASE01=$(tput setaf 240) +BASE00=$(tput setaf 241) +BASE0=$(tput setaf 244) +BASE1=$(tput setaf 245) +BASE2=$(tput setaf 254) +BASE3=$(tput setaf 230) +YELLOW=$(tput setaf 136) +ORANGE=$(tput setaf 166) +RED=$(tput setaf 160) +MAGENTA=$(tput setaf 125) +VIOLET=$(tput setaf 61) +BLUE=$(tput setaf 33) +CYAN=$(tput setaf 37) +GREEN=$(tput setaf 64) +BOLD=$(tput bold) +RESET=$(tput sgr0) + +NAME=`whoami | cut -d'@' -f1` + +PS1="\[$CYAN\]$NAME:\w\[$RESET\]\$(parse_git_branch) \n\[$GREEN\]\A \$ \[$RESET\]" \ No newline at end of file From 64358fd2ed4b09da102886ce74c205a567e80a56 Mon Sep 17 00:00:00 2001 From: iameskild Date: Wed, 6 Jul 2022 13:41:06 -0700 Subject: [PATCH 3/3] Increase timeout for ssh test --- .../kubernetes/services/jupyterhub/files/skel/.bashrc | 2 +- tests_deployment/test_jupyterhub_ssh.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/files/skel/.bashrc b/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/files/skel/.bashrc index 884fc42f6..3c863e322 100644 --- a/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/files/skel/.bashrc +++ b/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/files/skel/.bashrc @@ -149,4 +149,4 @@ RESET=$(tput sgr0) NAME=`whoami | cut -d'@' -f1` -PS1="\[$CYAN\]$NAME:\w\[$RESET\]\$(parse_git_branch) \n\[$GREEN\]\A \$ \[$RESET\]" \ No newline at end of file +PS1="\[$CYAN\]$NAME:\w\[$RESET\]\$(parse_git_branch) \n\[$GREEN\]\A \$ \[$RESET\]" diff --git a/tests_deployment/test_jupyterhub_ssh.py b/tests_deployment/test_jupyterhub_ssh.py index db3919376..7bd9a19e4 100644 --- a/tests_deployment/test_jupyterhub_ssh.py +++ b/tests_deployment/test_jupyterhub_ssh.py @@ -13,6 +13,8 @@ monkeypatch_ssl_context() +TIMEOUT_SECS = 300 + @pytest.fixture def paramiko_object(): @@ -57,12 +59,12 @@ def run_command(command, stdin, stdout, stderr): return "".join(output).strip() -@pytest.mark.timeout(120) +@pytest.mark.timeout(TIMEOUT_SECS) def test_simple_jupyterhub_ssh(paramiko_object): stdin, stdout, stderr = paramiko_object.exec_command("") -@pytest.mark.timeout(120) +@pytest.mark.timeout(TIMEOUT_SECS) def test_print_jupyterhub_ssh(paramiko_object): stdin, stdout, stderr = paramiko_object.exec_command("") @@ -81,7 +83,7 @@ def test_print_jupyterhub_ssh(paramiko_object): print(run_command(command, stdin, stdout, stderr)) -@pytest.mark.timeout(120) +@pytest.mark.timeout(TIMEOUT_SECS) def test_exact_jupyterhub_ssh(paramiko_object): stdin, stdout, stderr = paramiko_object.exec_command("") @@ -100,7 +102,7 @@ def test_exact_jupyterhub_ssh(paramiko_object): assert output == run_command(command, stdin, stdout, stderr) -@pytest.mark.timeout(120) +@pytest.mark.timeout(TIMEOUT_SECS) def test_contains_jupyterhub_ssh(paramiko_object): stdin, stdout, stderr = paramiko_object.exec_command("")