mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-06 14:33:10 -06:00
Look up environment variables and determine if they are set or not instead of checking the value
This commit is contained in:
parent
11b284a639
commit
ef53e8b599
|
|
@ -44,6 +44,7 @@ import (
|
||||||
|
|
||||||
var sam, err = goSam.NewClient(*samAddr)
|
var sam, err = goSam.NewClient(*samAddr)
|
||||||
|
|
||||||
|
// Dial a network connection to an I2P server or a unix socket. Fail for clearnet addresses.
|
||||||
func Dial(network, addr string) (net.Conn, error) {
|
func Dial(network, addr string) (net.Conn, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,10 @@ import (
|
||||||
// Generate HTML with coverage: go tool cover -html=/somewhere/where/there/is/integrationcover.out -o cover.html
|
// Generate HTML with coverage: go tool cover -html=/somewhere/where/there/is/integrationcover.out -o cover.html
|
||||||
// Source: https://dzone.com/articles/measuring-integration-test-coverage-rate-in-pouchc
|
// Source: https://dzone.com/articles/measuring-integration-test-coverage-rate-in-pouchc
|
||||||
func TestMain(t *testing.T) {
|
func TestMain(t *testing.T) {
|
||||||
if os.Getenv("CI") != "" {
|
if _, ex := os.LookupEnv("CI"); ex {
|
||||||
t.Skip("skipping test, as no TOR/I2P client is available")
|
t.Skip("skipping test, as no TOR/I2P client is available")
|
||||||
} else {
|
} else {
|
||||||
|
t.Log("running locally, continuing with tests")
|
||||||
var (
|
var (
|
||||||
args []string
|
args []string
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,10 @@ import (
|
||||||
// Generate HTML with coverage: go tool cover -html=/somewhere/where/there/is/integrationcover.out -o cover.html
|
// Generate HTML with coverage: go tool cover -html=/somewhere/where/there/is/integrationcover.out -o cover.html
|
||||||
// Source: https://dzone.com/articles/measuring-integration-test-coverage-rate-in-pouchc
|
// Source: https://dzone.com/articles/measuring-integration-test-coverage-rate-in-pouchc
|
||||||
func TestMain(t *testing.T) {
|
func TestMain(t *testing.T) {
|
||||||
if os.Getenv("CI") != "" {
|
if _, ex := os.LookupEnv("CI"); ex {
|
||||||
t.Skip("skipping test, as no TOR/I2P client is available")
|
t.Skip("skipping test, as no TOR/I2P client is available")
|
||||||
} else {
|
} else {
|
||||||
|
t.Log("running locally, continuing with tests")
|
||||||
var (
|
var (
|
||||||
args []string
|
args []string
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ import (
|
||||||
var t, terr = tor.Start(context.Background(), nil)
|
var t, terr = tor.Start(context.Background(), nil)
|
||||||
var tdialer, tderr = t.Dialer(context.TODO(), nil)
|
var tdialer, tderr = t.Dialer(context.TODO(), nil)
|
||||||
|
|
||||||
|
// Dial either a unix socket address, or connect to a remote address over Tor. Always uses Tor.
|
||||||
func Dial(network, addr string) (net.Conn, error) {
|
func Dial(network, addr string) (net.Conn, error) {
|
||||||
if terr != nil {
|
if terr != nil {
|
||||||
return nil, terr
|
return nil, terr
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue