This repository has been archived on 2022-11-03. You can view files and clone it, but cannot push or open issues or pull requests.
DevOpsOpenHack/apis/trips/README.md
2022-11-03 16:41:13 -04:00

67 lines
1.6 KiB
Markdown

# Trips Service
## Overview
This is the Trips API for the MyDriving service.
The server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project.
By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub.
## Build & Test
### Get dependencies
```shell
go get
```
### Build the Application
```shell
go build
```
### Testing
#### Unit Tests
To run unit tests and get coverage report, execute:
```shell
go test -v ./tripsgo -run Unit -coverprofile=trips_coverage.out -covermode=count
```
To run unit tests and get coverage report and junit report use **gotestsum** tool, execute:
```shell
./gotestsum --format standard-verbose --junitfile unittest_results.xml -- ./tripsgo -run Unit -coverprofile=unittest_coverage.out -covermode=count
```
#### Integration Tests
- Add a file called .evn to the tripsgo folder with the following structure:
```shell
SQL_SERVER="<-- your database server uri -- >"
SQL_PASSWORD="<-- your login password -- >"
SQL_USER="<-- your login user -- >"
SQL_DBNAME="<-- your database name -- >"
SQL_DRIVER="mssql"
```
You shouldn't need to change the SQL_DRIVER variable.
- To run all integration tests, execute:
```shell
go test -v ./tripsgo
```
- To run all integration tests and get junit report use **gotestsum** tool, execute:
```shell
./gotestsum --format standard-verbose --junitfile integrationtest_results.xml -- ./tripsgo
```
> **NOTE** This requires an actual database connection, so the required ENV variables need to be present.