Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/intergration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
go: [ "1.14", "1.15" ]
go: [ "1.15", "1.16" ]

steps:
- name: Set up Go 1.x
Expand All @@ -22,6 +22,7 @@ jobs:

- name: Test
env:
STORAGE_OSS_INTEGRATION_TEST: ${{ secrets.STORAGE_INTEGRATION_TEST }}
STORAGE_OSS_CREDENTIAL: ${{ secrets.STORAGE_OSS_CREDENTIAL }}
STORAGE_OSS_NAME: ${{ secrets.STORAGE_OSS_NAME }}
STORAGE_OSS_ENDPOINT: ${{ secrets.STORAGE_OSS_ENDPOINT }}
Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,15 @@ generate:
go generate ./...
go fmt ./...

build: generate tidy check
build: tidy generate check
go build ./...

test:
go test -race -coverprofile=coverage.txt -covermode=atomic -v .
go tool cover -html="coverage.txt" -o "coverage.html"

integration_test:
go clean -testcache ./tests
go test -tags integration_test -race -covermode=atomic -v ./tests
go test -count=1 -race -covermode=atomic -v ./tests

tidy:
go mod tidy
Expand Down
1 change: 1 addition & 0 deletions Makefile.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export STORAGE_OSS_INTEGRATION_TEST=on
export STORAGE_OSS_CREDENTIAL=hmac:access_key:secret_key
export STORAGE_OSS_NAME=bucketname
export STORAGE_OSS_ENDPOINT=https:oss-region-name.aliyuncs.com
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
Expand All @@ -60,6 +61,7 @@ golang.org/x/arch v0.0.0-20180920145803-b19384d3c130/go.mod h1:cYlCBUl1MsqxdiKgm
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
Expand All @@ -85,6 +87,7 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/src-d/go-billy.v4 v4.3.0 h1:KtlZ4c1OWbIs4jCv5ZXrTqG8EQocr0g/d4DjNg70aek=
gopkg.in/src-d/go-billy.v4 v4.3.0/go.mod h1:tm33zBoOwxjYHZIE+OV8bxTWFMJLrconzFMd38aARFk=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
Expand Down
32 changes: 32 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## How run integration tests

### Run tests locally

Copy example files and update corresponding values.

```shell
cp Makefile.env.exmaple Makefile.env
```

Run tests

```shell
make integration_test
```

### Run tests in CI

Set following environment variables:

```shell
export STORAGE_OSS_INTEGRATION_TEST=on
export STORAGE_OSS_CREDENTIAL=hmac:access_key:secret_key
export STORAGE_OSS_NAME=bucketname
export STORAGE_OSS_ENDPOINT=https:oss-region-name.aliyuncs.com
```

Run tests

```shell
make integration_test
```
6 changes: 4 additions & 2 deletions tests/storage_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// +build integration_test

package tests

import (
"os"
"testing"

tests "github.com/aos-dev/go-integration-test/v3"
)

func TestStorage(t *testing.T) {
if os.Getenv("STORAGE_OSS_INTEGRATION_TEST") != "on" {
t.Skipf("STORAGE_OSS_INTEGRATION_TEST is not 'on', skipped")
}
tests.TestStorager(t, setupTest(t))
}
4 changes: 1 addition & 3 deletions tests/utils_test.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
// +build integration_test

package tests

import (
"os"
"testing"

oss "github.com/aos-dev/go-service-oss"
ps "github.com/aos-dev/go-storage/v3/pairs"
"github.com/aos-dev/go-storage/v3/types"
"github.com/google/uuid"
oss "github.com/aos-dev/go-service-oss"
)

func setupTest(t *testing.T) types.Storager {
Expand Down
5 changes: 5 additions & 0 deletions tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//+build tools

package oss

import _ "github.com/aos-dev/go-storage/v3/cmd/definitions"