Files
kopia/internal/testutil/testutil.go
Jarek Kowalski 77691cf0a2 sftp: run private SFTP server based on Docker (atmoz/sftp) (#796)
* sftp: run private SFTP server based on Docker (atmoz/sftp)

* sftp: disable test on GH Actions && !linux because it does not support Docker.
2021-01-25 22:13:30 -08:00

34 lines
739 B
Go

package testutil
import (
"fmt"
"os"
"runtime"
"testing"
)
// TestSkipUnlessCI skips the current test with a provided message, except when running
// in CI environment, in which case it causes hard failure.
func TestSkipUnlessCI(t *testing.T, msg string, args ...interface{}) {
t.Helper()
if len(args) > 0 {
msg = fmt.Sprintf(msg, args...)
}
if os.Getenv("CI") != "" {
t.Fatal(msg)
} else {
t.Skip(msg)
}
}
// TestSkipOnCIUnlessLinuxAMD64 skips the current test if running on CI unless the environment is Linux/AMD64.
func TestSkipOnCIUnlessLinuxAMD64(t *testing.T) {
t.Helper()
if os.Getenv("CI") != "" && runtime.GOOS+"/"+runtime.GOARCH != "linux/amd64" {
t.Skip("test not supported in this environment.")
}
}