mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
fix: skip test when run in github action
This commit is contained in:
parent
d4eef3e3f9
commit
8268ac1d32
1
.github/workflows/go.yml
vendored
1
.github/workflows/go.yml
vendored
|
@ -20,6 +20,7 @@ jobs:
|
||||||
go-version:
|
go-version:
|
||||||
- "1.20"
|
- "1.20"
|
||||||
env:
|
env:
|
||||||
|
GITHUB_CI: true
|
||||||
MYSQL_DATABASE: bbgo
|
MYSQL_DATABASE: bbgo
|
||||||
MYSQL_USER: "root"
|
MYSQL_USER: "root"
|
||||||
MYSQL_PASSWORD: "root" # pragma: allowlist secret
|
MYSQL_PASSWORD: "root" # pragma: allowlist secret
|
||||||
|
|
|
@ -2,6 +2,7 @@ package binance
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
@ -22,6 +23,12 @@ func Test_new(t *testing.T) {
|
||||||
assert.NotEmpty(t, ex)
|
assert.NotEmpty(t, ex)
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ticker, err := ex.QueryTicker(ctx, "btcusdt")
|
ticker, err := ex.QueryTicker(ctx, "btcusdt")
|
||||||
|
if len(os.Getenv("GITHUB_CI")) > 0 {
|
||||||
|
// Github action runs in the US, and therefore binance api is not accessible
|
||||||
|
assert.Empty(t, ticker)
|
||||||
|
assert.Error(t, err)
|
||||||
|
} else {
|
||||||
assert.NotEmpty(t, ticker)
|
assert.NotEmpty(t, ticker)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user