Skip to content

feat: adding crud tests (#91) #12

feat: adding crud tests (#91)

feat: adding crud tests (#91) #12

Workflow file for this run

name: CRUD API Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
container:
image: ubuntu:latest
services:
neo4j:
image: neo4j:5
ports:
- 7687:7687
env:
NEO4J_AUTH: neo4j/test123456
options: >-
--health-cmd "wget -q --spider http://localhost:7474 || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
mongo:
image: mongo:6
ports:
- 27017:27017
options: >-
--health-cmd "mongosh --eval 'db.runCommand(\"ping\").ok' --quiet"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Install required dependencies
run: |
apt-get update
apt-get install -y wget gnupg systemd python3 python3-pip golang-go
- name: Set up Database Environment Variables
run: |
echo "NEO4J_URI=bolt://neo4j:7687" >> $GITHUB_ENV
echo "NEO4J_USER=neo4j" >> $GITHUB_ENV
echo "NEO4J_PASSWORD=test123456" >> $GITHUB_ENV
echo "MONGO_URI=mongodb://mongo:27017" >> $GITHUB_ENV
echo "MONGO_DB_NAME=testdb" >> $GITHUB_ENV
echo "MONGO_COLLECTION=entities" >> $GITHUB_ENV
- name: Run CRUD Tests
shell: bash -l {0}
run: |
cd design/crud-api
go build ./...
go build -o crud-service cmd/server/service.go cmd/server/utils.go
go test -v ./...