See
- Commit messages should follow the conventional commits guideline,
- Create a PR & wait for review,
- PRs should be "squashed & merged"
- merging to main goes to testing.learngraph.org
- releases go to production
docker-compose up
# or for continuous builds
docker-compose -f docker-compose/wgo.yml up
PORT - port to listen on for graphql queries (& graphql playground), default: 8080
PRODUCTION - true/false, enables/disables production mode: changes logging output, disabled GraphQL playground, etc.
LOG_LEVEL - Levels are {trace, debug, info, warn, error, fatal, panic}. See github.com/rs/[email protected]/log.go for possible values.
TIMEOUT - HTTP timeouts (read and write) as Golang time string, e.g. "30s" for 30 seconds.
DB_POSTGRES_HOST - postgresql db host, e.g. (default: "localhost")
DB_POSTGRES_PASSWORD - postgresql db password for authentication (default: "example")
See grep -r 'env:' .
.
Run unittests via make
make test
To enable gopls
for the *_integration_test.go
-files use
export GOFLAGS='-tags=integration'
Integration tests require a testing database with no authentication
docker-compose -f docker-compose/test.yml up -d
# wait for startup to complete
make test-integration
New integration tests should be a inside a file ending in
_integration_test.go
and contain as first line the tag integration
.
//go:build integration
We use the 'assert' package.
We use gomock, to install it execute
make dev-tools-install
To regenerate mocks execute
make mockgen
Sample query:
curl http://localhost:8124/query -H 'Content-Type: application/json' -d '{"operationName":"getGraph","variables":{},"query":"query getGraph {\n graph {\n nodes {\n id\n __typename\n }\n edges {\n id\n from\n to\n __typename\n }\n __typename\n }\n}"}';echo