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
2022-11-03 16:41:13 -04:00
..
api add openhack files 2022-11-03 16:41:13 -04:00
tripsgo add openhack files 2022-11-03 16:41:13 -04:00
.dockerignore add openhack files 2022-11-03 16:41:13 -04:00
.gitignore add openhack files 2022-11-03 16:41:13 -04:00
buildtest.sh add openhack files 2022-11-03 16:41:13 -04:00
Dockerfile add openhack files 2022-11-03 16:41:13 -04:00
glide.yaml add openhack files 2022-11-03 16:41:13 -04:00
go.mod add openhack files 2022-11-03 16:41:13 -04:00
install_gotestsum.sh add openhack files 2022-11-03 16:41:13 -04:00
main.go add openhack files 2022-11-03 16:41:13 -04:00
README.md add openhack files 2022-11-03 16:41:13 -04:00

Trips Service

Overview

This is the Trips API for the MyDriving service.

The server was generated by the swagger-codegen project.
By using the OpenAPI-Spec from a remote server, you can easily generate a server stub.

Build & Test

Get dependencies

go get

Build the Application

go build

Testing

Unit Tests

To run unit tests and get coverage report, execute:

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:

./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:

    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:

    go test -v ./tripsgo
    
  • To run all integration tests and get junit report use gotestsum tool, execute:

./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.