Skip to content
This repository was archived by the owner on Oct 18, 2021. It is now read-only.

Commit e0027c3

Browse files
authored
tests: Introduce STORAGE_AZBLOB_INTEGRATION_TEST (#12)
* tests: Introduce STORAGE_AZBLOB_INTEGRATION_TEST Signed-off-by: Xuanwo <github@xuanwo.io> * build: Add count=1 to prevent test cache Signed-off-by: Xuanwo <github@xuanwo.io>
1 parent 446991e commit e0027c3

File tree

7 files changed

+19
-8
lines changed

7 files changed

+19
-8
lines changed

.github/workflows/intergration-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222

2323
- name: Test
2424
env:
25+
STORAGE_AZBLOB_INTEGRATION_TEST: ${{ secrets.STORAGE_INTEGRATION_TEST }}
2526
STORAGE_AZBLOB_CREDENTIAL: ${{ secrets.STORAGE_AZBLOB_CREDENTIAL }}
2627
STORAGE_AZBLOB_NAME: ${{ secrets.STORAGE_AZBLOB_NAME }}
2728
STORAGE_AZBLOB_ENDPOINT: ${{ secrets.STORAGE_AZBLOB_ENDPOINT }}

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,15 @@ generate:
2424
go generate ./...
2525
go fmt ./...
2626

27-
build: generate tidy check
27+
build: tidy generate check
2828
go build ./...
2929

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

3434
integration_test:
35-
go clean -testcache ./tests
36-
go test -tags integration_test -race -covermode=atomic -v ./tests
35+
go test -count=1 -race -covermode=atomic -v ./tests
3736

3837
tidy:
3938
go mod tidy

Makefile.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export STORAGE_AZBLOB_INTEGRATION_TEST=on
12
export STORAGE_AZBLOB_CREDENTIAL=hmac:access_key:secret_key
23
export STORAGE_AZBLOB_NAME=bucketname
34
export STORAGE_AZBLOB_ENDPOINT=https:accountname.blob.core.windows.net

go.sum

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
6262
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
6363
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
6464
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
65+
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
6566
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
6667
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
6768
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
@@ -78,6 +79,7 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
7879
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
7980
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
8081
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
82+
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
8183
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
8284
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
8385
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@@ -110,6 +112,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
110112
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
111113
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
112114
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
115+
gopkg.in/src-d/go-billy.v4 v4.3.0 h1:KtlZ4c1OWbIs4jCv5ZXrTqG8EQocr0g/d4DjNg70aek=
113116
gopkg.in/src-d/go-billy.v4 v4.3.0/go.mod h1:tm33zBoOwxjYHZIE+OV8bxTWFMJLrconzFMd38aARFk=
114117
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
115118
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=

tests/storage_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
// +build integration_test
2-
31
package tests
42

53
import (
4+
"os"
65
"testing"
76

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

1110
func TestStorage(t *testing.T) {
11+
if os.Getenv("STORAGE_AZBLOB_INTEGRATION_TEST") != "on" {
12+
t.Skipf("STORAGE_AZBLOB_INTEGRATION_TEST is not 'on', skipped")
13+
}
1214
tests.TestStorager(t, setupTest(t))
1315
}

tests/utils_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
// +build integration_test
2-
31
package tests
42

53
import (
64
"os"
75
"testing"
86

7+
azblob "github.com/aos-dev/go-service-azblob"
98
ps "github.com/aos-dev/go-storage/v3/pairs"
109
"github.com/aos-dev/go-storage/v3/types"
1110
"github.com/google/uuid"
12-
azblob "github.com/aos-dev/go-service-azblob"
1311
)
1412

1513
func setupTest(t *testing.T) types.Storager {

tools.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// +build tools
2+
3+
package azblob
4+
5+
import (
6+
_ "github.com/aos-dev/go-storage/v3/cmd/definitions"
7+
)

0 commit comments

Comments
 (0)