Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
muratugureminoglu authored Jan 30, 2025
1 parent ab31e22 commit 3a67539
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/mongodb-install-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test MongoDB Installation

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
test-mongodb:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Make script executable
run: chmod +x mongodb-install.sh

- name: Run MongoDB installation script
run: sudo ./mongodb-install.sh --auto-create

- name: Verify MongoDB service
run: |
systemctl is-active mongod || (echo "MongoDB failed to start" && exit 1)
- name: Test MongoDB authentication
run: |
echo 'show dbs' | mongosh --username "$(grep 'MongoDB username:' mongodb-install.sh | awk '{print $3}')" --password "$(grep 'MongoDB password:' mongodb-install.sh | awk '{print $3}')" --authenticationDatabase admin || (echo "Authentication failed" && exit 1)

0 comments on commit 3a67539

Please sign in to comment.