Skip to content

Commit

Permalink
Included option to integration tests locally
Browse files Browse the repository at this point in the history
- Included an option to run integration tests locally.

Signed-off-by: naveensrinivasan <[email protected]>
  • Loading branch information
naveensrinivasan committed Oct 5, 2023
1 parent 2c19f25 commit e440b33
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ test: generate
echo 'mode: atomic' > coverage.txt && go test -covermode=atomic -coverprofile=coverage.txt -v -race -timeout=30s ./...

# Run the integration tests. Requires github token for scorecard (GITHUB_AUTH_TOKEN=<your token>)
# To run it locally you can run the following command: make start-integration-service
.PHONY: integration-test
integration-test: generate check-env
go test -tags=integration ./...
ENT_TEST_DATABASE_URL='postgresql://guac:guac@localhost/guac?sslmode=disable' go test -tags=integration ./...

.PHONY: integration-merge-test
integration-merge-test: generate check-env
Expand Down Expand Up @@ -137,6 +138,11 @@ start-service: check-docker-compose-tool-check
stop-service:
$(CONTAINER) compose down

# This is a helper target to run the integration tests locally.
.PHONY: start-integration-service
start-integration-service: check-docker-compose-tool-check
$(CONTAINER) compose -f integration.docker-compose.yaml up --force-recreate

.PHONY: check-docker-tool-check
check-docker-tool-check:
@if ! command -v $(CONTAINER) >/dev/null 2>&1; then \
Expand Down
59 changes: 59 additions & 0 deletions integration.docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
version: "3.8"

volumes:
arangodb_data_container:
arangodb_apps_data_container:
prometheus_data:
grafana_data:

services:

postgres:
image: postgres:15
environment:
POSTGRES_USER: guac
POSTGRES_PASSWORD: guac
POSTGRES_HOST_AUTH_METHOD: trust
networks: [frontend]
ports:
- "5432:5432"
volumes:
- ./container_files/pg:/var/lib/postgresql/data

guac-graphql:
image: "local-organic-guac"
command: "/opt/guac/guacgql --gql-debug --gql-backend arango"
working_dir: /guac
restart: on-failure
depends_on:
arangodb:
condition: service_healthy
ports:
- "$GUAC_API_PORT:8080"
volumes:
- ./container_files/guac:/guac
healthcheck:
test: ["CMD", "wget", "--spider", "http://localhost:8080"]
interval: 10s
timeout: 10s
retries: 3
start_period: 5s

arangodb:
image: arangodb:latest
environment:
ARANGO_ROOT_PASSWORD: test123
ports:
- 8529:8529
volumes:
- arangodb_data_container:/var/lib/arangodb3
- arangodb_apps_data_container:/var/lib/arangodb3-apps
healthcheck:
test: ["CMD", "wget", "--spider", "http://localhost:8529"]
interval: 10s
timeout: 10s
retries: 3
start_period: 1s
networks:
frontend:
driver: bridge

0 comments on commit e440b33

Please sign in to comment.