Skip to content

Commit

Permalink
Create integration tests (#201)
Browse files Browse the repository at this point in the history
* add build tag for integration tests

* add unit rule to run unit tests

* add unit as phony

* improve formatting of each _test file, enable coverate on functional tests

* add badge for test results
  • Loading branch information
peczenyj authored May 6, 2022
1 parent cdb5239 commit fde50e7
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
.PHONY: build test fmt up up-ssl down ssl-test run-examples
.PHONY: build unit test fmt up up-ssl down ssl-test run-examples

default: build

build: fmt
go mod tidy
go build

unit:
go mod tidy
go test -v -race --covermode=atomic --coverprofile coverage.out
test:
go mod tidy
go test -v -race
go test -v -race --tags=integration --covermode=atomic --coverprofile coverage.out

fmt:
go fmt
Expand All @@ -22,10 +24,10 @@ down:
cd ./nebula-docker-compose && docker-compose down -v

ssl-test:
ssl_test=true go test -v -run TestSslConnection;
ssl_test=true go test -v --tags=integration -run TestSslConnection;

ssl-test-self-signed:
self_signed=true go test -v -run TestSslConnection;
self_signed=true go test -v --tags=integration -run TestSslConnection;

run-examples:
go run basic_example/graph_client_basic_example.go && \
Expand Down
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# nebula-go

[![Go Reference](https://pkg.go.dev/badge/github.com/vesoft-inc/nebula-go/v3.svg)](https://pkg.go.dev/github.com/vesoft-inc/nebula-go/v3)
![functional tests](https://github.com/vesoft-inc/nebula-go/actions/workflows/test.yaml/badge.svg)

**IMPORTANT: Code of Nebula go client has been transferred from [nebula-clients](https://github.com/vesoft-inc/nebula-clients) to this repository(nebula-go), and new releases in the future will be published in this repository.
Please update your go.mod and imports correspondingly.**
Expand All @@ -19,7 +21,6 @@ To Use the console with a stable release of Nebula Graph, please check the branc
| **[v3.1.x](https://github.com/vesoft-inc/nebula-go/tree/v3.1.0)** | 3.1.x |
| **[master](https://github.com/vesoft-inc/nebula-go/tree/master)** | 3.x-nightly |


Please be careful not to modify the files in the nebula directory, these codes were all generated by fbthrift.

**NOTE** Installing Nebula Go v2.5.0 could cause **checksum mismatch**, use v2.5.1 instead.
Expand All @@ -29,18 +30,21 @@ Please be careful not to modify the files in the nebula directory, these codes w
```shell
$ go get -u -v github.com/vesoft-inc/nebula-go/v3@master
```

You can specify the version of Nebula-go by substituting `<tag>` in `$ go get -u -v github.com/vesoft-inc/nebula-go@<tag>`.
For example:
for v3: `$ go get -u -v github.com/vesoft-inc/nebula-go/[email protected]`
for v2: `$ go get -u -v github.com/vesoft-inc/nebula-go/[email protected]`
For example:

for v3: `$ go get -u -v github.com/vesoft-inc/nebula-go/[email protected]`
for v2: `$ go get -u -v github.com/vesoft-inc/nebula-go/[email protected]`

**Note**: You will get a message like this if you don't specify a tag:
> ```

> ```shell
> $ go get -u -v github.com/vesoft-inc/nebula-go/v2@master
> go: github.com/vesoft-inc/nebula-go/v2 master => v2.0.0-20210506025434-97d4168c5c4d
> ```
> Here the ` 20210506025434-97d4168c5c4d` is a version tag auto-generated by Github using commit date and SHA.
>
> Here the `20210506025434-97d4168c5c4d` is a version tag auto-generated by Github using commit date and SHA.
> This should match the latest commit in the master branch.
## Usage example
Expand Down
4 changes: 3 additions & 1 deletion client_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
//go:build integration
// +build integration

/*
*
* Copyright (c) 2020 vesoft inc. All rights reserved.
*
* This source code is licensed under Apache 2.0 License.
*
*/

package nebula_go

import (
Expand Down
3 changes: 3 additions & 0 deletions session_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build integration
// +build integration

/* Copyright (c) 2021 vesoft inc. All rights reserved.
*
* This source code is licensed under Apache 2.0 License.
Expand Down
3 changes: 3 additions & 0 deletions ssl_connection_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build integration
// +build integration

/*
*
* Copyright (c) 2020 vesoft inc. All rights reserved.
Expand Down

0 comments on commit fde50e7

Please sign in to comment.