mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-23 21:41:38 +02:00
Add FAST=1 env that can be used to run just some fast tests for quick testing
This commit is contained in:
parent
e91e6ab237
commit
2bdfe3d64f
@ -24,6 +24,10 @@ import (
|
|||||||
"github.com/ddworken/hishtory/shared"
|
"github.com/ddworken/hishtory/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func skipSlowTests() bool {
|
||||||
|
return os.Getenv("FAST") != ""
|
||||||
|
}
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
defer shared.RunTestServer()()
|
defer shared.RunTestServer()()
|
||||||
cmd := exec.Command("go", "build", "-o", "/tmp/client")
|
cmd := exec.Command("go", "build", "-o", "/tmp/client")
|
||||||
@ -113,6 +117,9 @@ func (z zshTester) ShellName() string {
|
|||||||
var shellTesters []shellTester = []shellTester{bashTester{}, zshTester{}}
|
var shellTesters []shellTester = []shellTester{bashTester{}, zshTester{}}
|
||||||
|
|
||||||
func TestParameterized(t *testing.T) {
|
func TestParameterized(t *testing.T) {
|
||||||
|
if skipSlowTests() {
|
||||||
|
shellTesters = shellTesters[:1]
|
||||||
|
}
|
||||||
for _, tester := range shellTesters {
|
for _, tester := range shellTesters {
|
||||||
t.Run("testRepeatedCommandThenQuery/"+tester.ShellName(), func(t *testing.T) { testRepeatedCommandThenQuery(t, tester) })
|
t.Run("testRepeatedCommandThenQuery/"+tester.ShellName(), func(t *testing.T) { testRepeatedCommandThenQuery(t, tester) })
|
||||||
t.Run("testRepeatedCommandAndQuery/"+tester.ShellName(), func(t *testing.T) { testRepeatedCommandAndQuery(t, tester) })
|
t.Run("testRepeatedCommandAndQuery/"+tester.ShellName(), func(t *testing.T) { testRepeatedCommandAndQuery(t, tester) })
|
||||||
@ -592,6 +599,9 @@ func testUpdate(t *testing.T, tester shellTester) {
|
|||||||
if runtime.GOOS == "linux" && runtime.GOARCH == "arm64" {
|
if runtime.GOOS == "linux" && runtime.GOARCH == "arm64" {
|
||||||
t.Skip("skipping on linux/arm64 which is unsupported")
|
t.Skip("skipping on linux/arm64 which is unsupported")
|
||||||
}
|
}
|
||||||
|
if skipSlowTests() {
|
||||||
|
t.Skip("skipping slow tests")
|
||||||
|
}
|
||||||
// Set up
|
// Set up
|
||||||
defer shared.BackupAndRestore(t)()
|
defer shared.BackupAndRestore(t)()
|
||||||
userSecret := installHishtory(t, tester, "")
|
userSecret := installHishtory(t, tester, "")
|
||||||
@ -1772,6 +1782,9 @@ func fuzzTest(t *testing.T, tester shellTester, input string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func FuzzTestMultipleUsers(f *testing.F) {
|
func FuzzTestMultipleUsers(f *testing.F) {
|
||||||
|
if skipSlowTests() {
|
||||||
|
f.Skip("skipping slow tests")
|
||||||
|
}
|
||||||
// Format:
|
// Format:
|
||||||
// $Op = $Key;$Device|$Command\n
|
// $Op = $Key;$Device|$Command\n
|
||||||
// $Key;$Device|$Command\n$Op
|
// $Key;$Device|$Command\n$Op
|
||||||
|
Loading…
x
Reference in New Issue
Block a user