- Ensure Docker is installed and running.
- Pull the latest image from Docker Hub:
docker pull ayusht45cyber/notes-keeping:latest
- Run the container interactively:
docker run -it --rm ayusht45cyber/notes-keeping
- Verify logs to ensure that services start without errors.
| Test Case | Steps | Expected Outcome |
|---|---|---|
| Build Docker Image | Run docker build -t "$IMAGE_NAME:$IMAGE_TAG" . |
Docker image builds successfully without errors. |
| Save Image | Run docker save -o image.tar "$IMAGE_NAME:$IMAGE_TAG" |
Image is saved as a tar file for the next stage. |
| Check Image Size | Run `docker images | grep notes-keeping` |
| Test Case | Steps | Expected Outcome |
|---|---|---|
| Load Docker Image | Run docker load -i image.tar |
Docker image loads successfully without errors. |
| Run the Container | Run docker run -d --name test-container "$IMAGE_NAME:$IMAGE_TAG" |
Container starts successfully in detached mode. |
| Check Nginx Process | Run `docker exec test-container pgrep -fl "nginx" | |
| Check Nginx Port | Run `docker exec test-container netstat -an | grep ':80 '` |
| Test Health Check Endpoint | Run `docker exec test-container curl -s http://localhost/health | |
| Test Default HTTP Route | Run `docker exec test-container curl -s http://localhost | |
| Stop the Container | Run docker stop test-container |
Container stops successfully after testing. |
| Test Case | Steps | Expected Outcome |
|---|---|---|
| Docker Hub Login | Run `echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USER" --password-stdin` |
| Load Docker Image | Run docker load -i image.tar |
Docker image loads successfully before pushing. |
| Push Image to Docker Hub | Run docker push "$IMAGE_NAME:$IMAGE_TAG" |
Docker image is pushed to Docker Hub successfully. |
| Test Case | Steps | Expected Outcome |
|---|---|---|
| Container Startup Time | Measure startup time from docker run to readiness |
Should be <5 seconds |
| Memory Usage | Monitor docker stats |
Memory usage stays within expected limits. |
| CPU Usage | Execute multiple CRUD operations on the app | No excessive CPU spikes or crashes during operations. |
| Test Case | Steps | Expected Outcome |
|---|---|---|
| Docker Security Scan | Run docker scan ayusht45cyber/notes-keeping |
No critical vulnerabilities found. |
| Environment Variables Security | Check .env and logs for exposed credentials |
No credentials should be visible in logs or environment. |
| Container Isolation | Attempt to access the host filesystem from the container | Access to the host filesystem should be restricted. |
| Test Case | Steps | Expected Outcome |
|---|---|---|
| User-Friendly Responses | Run index.html in a browser and interact with the app |
Responses are clear and easy to understand. |
| Error Messages Clarity | Provide incorrect inputs (e.g., blank fields) | Errors should be informative and not vague. |