Skip to content

Commit

Permalink
Improve GH actions tests
Browse files Browse the repository at this point in the history
This is the work the BU testing students did to improve the GH actions

Signed-off-by: Isaiah Stapleton <istaplet@redhat.com>
  • Loading branch information
IsaiahStapleton committed Dec 13, 2023
1 parent 2ee1796 commit 3472d76
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
41 changes: 23 additions & 18 deletions .github/workflows/Container_Test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
python-version: "3.9.16"

- name: Install Dependencies
run: |
Expand All @@ -43,6 +43,19 @@ jobs:
echo "Image = $IMAGE"
echo $IMAGE > image.txt
- name: Push Beta Version
run: |
IMAGE=$(docker images --format "{{.Repository}}:{{.Tag}}" | head -n 1)
docker run -d --name stable $IMAGE
REGISTRY=$(cat base/ope_book_registry)
REGISTRY_USER=$(cat base/ope_registry_user)
echo $REGISTRY $REGISTRY_USER
docker login $REGISTRY -u $REGISTRY_USER -p $REGISTRY_PASSWORD
TIME=$(cat time.txt)
SIZE=$(docker images --format "{{.Size}}" | head -n 1)
make push TIME="$TIME" SIZE="$SIZE"
docker stop stable
- name: Upload Image
uses: actions/upload-artifact@v3
with:
Expand All @@ -57,19 +70,6 @@ jobs:
path: |
./containers/testing/time.txt
- name: Push Beta Version
run: |
IMAGE=$(docker images --format "{{.Repository}}:{{.Tag}}" | head -n 1)
docker run -d --name stable $IMAGE
REGISTRY=$(cat base/ope_book_registry)
REGISTRY_USER=$(cat base/ope_registry_user)
echo $REGISTRY $REGISTRY_USER
docker login $REGISTRY -u $REGISTRY_USER -p $REGISTRY_PASSWORD
TIME=$(cat time.txt)
SIZE=$(docker images --format "{{.Size}}" | head -n 1)
make push TIME="$TIME" SIZE="$SIZE"
docker stop stable
Health-Check:
needs: Setup-and-Build
Expand All @@ -93,6 +93,7 @@ jobs:
CONTAINER_NAME="stable"
HEALTH=$(docker ps --format "{{.Names}}: {{.Status}}" | grep "$CONTAINER_NAME" | awk '{print $2}') #extract health status
echo ""
echo "the value of HEALTH is: $HEALTH\n"
if [[ "$HEALTH" == "Up" ]]; then
echo "******Pass: container is up and running*******"
else
Expand Down Expand Up @@ -126,6 +127,9 @@ jobs:
ID=$( docker ps -aqf "name=stable" ) #get id of image
docker inspect $IMAGE > image.json #write inspect info to json for parsing
REPO_TAG=$(jq -r '.[0].RepoTags[0]' image.json) #acquire tag
echo "the value of REPO_TAG is: $REPO_TAG\n"
echo "the value of IMAGE is: $IMAGE\n"
echo "testing if REPO_TAG == IMAGE\n"
if [[ "$REPO_TAG" == "$IMAGE" ]]; then
echo "*********CORRECT IMAGE AND VERSION: $IMAGE*********"
else
Expand Down Expand Up @@ -205,7 +209,6 @@ jobs:
python3 version_check.py ./list.txt versions.txt #send to python for checking
docker stop stable
Checksum:
needs: Setup-and-Build
runs-on: ubuntu-latest
Expand Down Expand Up @@ -344,8 +347,10 @@ jobs:
docker exec stable bash -c 'for ((i=0;i<100; i++)); do gdb -ex starti -ex quit -q --batch /usr/bin/date 2>/dev/null | grep ld; done' | tee out | uniq #run jonatahns gdb test
expected_lines=100
actual_lines=$(wc -l < out)
echo "got $actual_lines of output and expected $expected_lines of output\n"
if [ "$actual_lines" -lt "$expected_lines" ]; then
echo "******************Test failed****************" #if the output file contians no iterations through the test file, gdb has failed
exit -1
else
echo "******************Test passed***************"
fi
Expand Down Expand Up @@ -380,8 +385,8 @@ jobs:
runs-on: ubuntu-latest #use the latest ubuntu container image
needs: Approval
defaults:
run:
working-directory: ./containers/testing
run:
working-directory: ./containers/testing
steps:
- name: Checkout Code
uses: actions/checkout@v3
Expand All @@ -407,4 +412,4 @@ jobs:
TIME=$(cat time.txt)
SIZE=$(cat size.txt)
docker login $REGISTRY -u $REGISTRY_USER -p $REGISTRY_PASSWORD
make publish TIME="$TIME" SIZE="$SIZE"
make publish TIME="$TIME" SIZE="$SIZE"
4 changes: 1 addition & 3 deletions containers/testing/tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
selenium
webdriver_manager
pillow


pillow
2 changes: 1 addition & 1 deletion containers/testing/tests/versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ numpy 1.24.3
pandas 2.0.1
nbconvert 7.4.0
jupyterlab 3.6.1
nbclient 0.5.13
nbclient 0.5.13

0 comments on commit 3472d76

Please sign in to comment.