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

tests: Introduce STORAGE_S3_INTEGRATION_TEST #65

Merged
merged 2 commits into from
Apr 22, 2021
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
1 change: 1 addition & 0 deletions .github/workflows/intergration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:

- name: Test
env:
STORAGE_S3_INTEGRATION_TEST: ${{ secrets.STORAGE_INTEGRATION_TEST }}
STORAGE_S3_CREDENTIAL: ${{ secrets.STORAGE_S3_CREDENTIAL }}
STORAGE_S3_NAME: ${{ secrets.STORAGE_S3_NAME }}
STORAGE_S3_LOCATION: ${{ secrets.STORAGE_S3_LOCATION }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-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" ]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ test:
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_S3_INTEGRATION_TEST=on
export STORAGE_S3_CREDENTIAL=hmac:access_key:secret_key
export STORAGE_S3_NAME=bucketname
export STORAGE_S3_LOCATION=location
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_S3_INTEGRATION_TEST=on
export STORAGE_S3_CREDENTIAL=hmac:access_key:secret_key
export STORAGE_S3_NAME=bucketname
export STORAGE_S3_LOCATION=location
```

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_S3_INTEGRATION_TEST") != "on" {
t.Skipf("STORAGE_S3_INTEGRATION_TEST is not 'on', skipped")
}
tests.TestStorager(t, setupTest(t))
}
2 changes: 0 additions & 2 deletions tests/utils_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// +build integration_test

package tests

import (
Expand Down