From c0811941bf786331680948ed060e83edb660bdd8 Mon Sep 17 00:00:00 2001 From: Gaurav Saini <147703805+gauravsaini04@users.noreply.github.com> Date: Fri, 13 Dec 2024 07:41:25 +0000 Subject: [PATCH] misc change --- test/common-utils/allow_shell_history.sh | 14 +++++------ test/common-utils/scenarios.json | 32 ++++++++++++------------ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/test/common-utils/allow_shell_history.sh b/test/common-utils/allow_shell_history.sh index d60a2e5c1..2c8a15408 100644 --- a/test/common-utils/allow_shell_history.sh +++ b/test/common-utils/allow_shell_history.sh @@ -79,10 +79,10 @@ CMD ["bash"] EOL # Build and tag the image -docker build -t $IMAGE_NAME . +sudo docker build -t $IMAGE_NAME . # Run the container again for attaching volume -CONTAINER_ID=$(docker run -v devcontainers:/devcontainers -itd $IMAGE_NAME) > /dev/null +CONTAINER_ID=$(sudo docker run -v devcontainers:/devcontainers -itd $IMAGE_NAME) > /dev/null # Output the container ID to a file echo "CONTAINER_ID=$CONTAINER_ID" > /tmp/container_id.txt @@ -99,25 +99,25 @@ add_shell_history() { local container_id=$1 local history_message=$2 echo -e "\nWriting shell history: $history_message"; - docker exec -it $container_id /bin/bash -c "echo \"$history_message\" >> ~/.bash_history" + sudo docker exec -it $container_id /bin/bash -c "echo \"$history_message\" >> ~/.bash_history" } # Function to check shell history check_shell_history() { local container_id=$1 echo -e "\nChecking shell history from container: "; - docker exec -it $container_id /bin/bash -c "cat ~/.bash_history" + sudo docker exec -it $container_id /bin/bash -c "cat ~/.bash_history" } source /tmp/container_id.txt # Start the container and add shell history -docker start $CONTAINER_ID > /dev/null +sudo docker start $CONTAINER_ID > /dev/null add_shell_history $CONTAINER_ID "Shell History for First Container Created." -docker stop $CONTAINER_ID > /dev/null +sudo docker stop $CONTAINER_ID > /dev/null # Start the container and check shell history persistence -docker start $CONTAINER_ID > /dev/null +sudo docker start $CONTAINER_ID > /dev/null check_shell_history $CONTAINER_ID # Report result diff --git a/test/common-utils/scenarios.json b/test/common-utils/scenarios.json index 2602ccc56..b500675a5 100644 --- a/test/common-utils/scenarios.json +++ b/test/common-utils/scenarios.json @@ -1,4 +1,20 @@ { + "allow_shell_history": { + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + "features": { + "docker-in-docker": {}, + "common-utils": { + "installZsh": true, + "allowShellHistory": true + } + }, + "overrideFeatureInstallOrder": [ + "./common-utils", + "./docker-in-docker" + ], + "remoteUser": "vscode", + "containerUser": "vscode" + }, "bionic": { "image": "ubuntu:bionic", "remoteUser": "devcontainer", @@ -292,21 +308,5 @@ "features": { "common-utils": {} } - }, - "allow_shell_history": { - "image": "mcr.microsoft.com/devcontainers/base:ubuntu", - "features": { - "docker-in-docker": {}, - "common-utils": { - "installZsh": true, - "allowShellHistory": true - } - }, - "overrideFeatureInstallOrder": [ - "./common-utils", - "./docker-in-docker" - ], - "remoteUser": "vscode", - "containerUser": "vscode" } } \ No newline at end of file