mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-26 06:52:23 +02:00
Merge remote-tracking branch 'origin/master' into sergio/db
This commit is contained in:
commit
cab480b4e6
3
.github/workflows/go-test.yml
vendored
3
.github/workflows/go-test.yml
vendored
@ -49,11 +49,14 @@ jobs:
|
|||||||
colima start
|
colima start
|
||||||
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
|
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
|
||||||
- name: Set up Datadog
|
- name: Set up Datadog
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
uses: datadog/agent-github-action@v1.3
|
uses: datadog/agent-github-action@v1.3
|
||||||
with:
|
with:
|
||||||
api_key: ${{ secrets.DD_API_KEY }}
|
api_key: ${{ secrets.DD_API_KEY }}
|
||||||
- name: Go test
|
- name: Go test
|
||||||
if: ${{ !startsWith(github.event.head_commit.message, 'Release') }}
|
if: ${{ !startsWith(github.event.head_commit.message, 'Release') }}
|
||||||
|
env:
|
||||||
|
DD_API_KEY: ${{ secrets.DD_API_KEY }}
|
||||||
run: |
|
run: |
|
||||||
make retrying-test
|
make retrying-test
|
||||||
# - name: Setup tmate session
|
# - name: Setup tmate session
|
||||||
|
@ -55,7 +55,7 @@ func TestMain(m *testing.M) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Configure the integration to export test failures to datadog for better monitoring
|
// Configure the integration to export test failures to datadog for better monitoring
|
||||||
if testutils.IsGithubAction() {
|
if _, has_dd_api_key := os.LookupEnv("DD_API_KEY"); testutils.IsGithubAction() && has_dd_api_key {
|
||||||
ddStats, err := statsd.New("localhost:8125")
|
ddStats, err := statsd.New("localhost:8125")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Errorf("Failed to start DataDog statsd: %w\n", err))
|
panic(fmt.Errorf("Failed to start DataDog statsd: %w\n", err))
|
||||||
@ -1940,9 +1940,9 @@ func testTui_search(t testing.TB) {
|
|||||||
testutils.CompareGoldens(t, out, "TestTui-InitialInvalidSearch")
|
testutils.CompareGoldens(t, out, "TestTui-InitialInvalidSearch")
|
||||||
|
|
||||||
// Check the output when the search is invalid
|
// Check the output when the search is invalid
|
||||||
out = captureTerminalOutput(t, tester, []string{
|
out = captureTerminalOutputWithComplexCommands(t, tester, []TmuxCommand{
|
||||||
"hishtory SPACE tquery ENTER",
|
{Keys: "hishtory SPACE tquery ENTER"},
|
||||||
"ls", ":",
|
{Keys: "ls", ExtraDelay: 1.0}, {Keys: ":"},
|
||||||
})
|
})
|
||||||
out = strings.TrimSpace(strings.Split(out, "hishtory tquery")[1])
|
out = strings.TrimSpace(strings.Split(out, "hishtory tquery")[1])
|
||||||
testutils.CompareGoldens(t, out, "TestTui-InvalidSearch")
|
testutils.CompareGoldens(t, out, "TestTui-InvalidSearch")
|
||||||
@ -2021,10 +2021,15 @@ func captureTerminalOutput(t testing.TB, tester shellTester, commands []string)
|
|||||||
return captureTerminalOutputWithShellName(t, tester, tester.ShellName(), commands)
|
return captureTerminalOutputWithShellName(t, tester, tester.ShellName(), commands)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func captureTerminalOutputWithComplexCommands(t testing.TB, tester shellTester, commands []TmuxCommand) string {
|
||||||
|
return captureTerminalOutputWithShellNameAndDimensions(t, tester, tester.ShellName(), 200, 50, commands)
|
||||||
|
}
|
||||||
|
|
||||||
type TmuxCommand struct {
|
type TmuxCommand struct {
|
||||||
Keys string
|
Keys string
|
||||||
ResizeX int
|
ResizeX int
|
||||||
ResizeY int
|
ResizeY int
|
||||||
|
ExtraDelay float64
|
||||||
}
|
}
|
||||||
|
|
||||||
func captureTerminalOutputWithShellName(t testing.TB, tester shellTester, overriddenShellName string, commands []string) string {
|
func captureTerminalOutputWithShellName(t testing.TB, tester shellTester, overriddenShellName string, commands []string) string {
|
||||||
@ -2064,6 +2069,9 @@ func captureTerminalOutputWithShellNameAndDimensions(t testing.TB, tester shellT
|
|||||||
if cmd.ResizeX != 0 && cmd.ResizeY != 0 {
|
if cmd.ResizeX != 0 && cmd.ResizeY != 0 {
|
||||||
fullCommand += fmt.Sprintf(" tmux resize-window -t foo -x %d -y %d\n", cmd.ResizeX, cmd.ResizeY)
|
fullCommand += fmt.Sprintf(" tmux resize-window -t foo -x %d -y %d\n", cmd.ResizeX, cmd.ResizeY)
|
||||||
}
|
}
|
||||||
|
if cmd.ExtraDelay != 0 {
|
||||||
|
fullCommand += fmt.Sprintf(" sleep %f\n", cmd.ExtraDelay)
|
||||||
|
}
|
||||||
fullCommand += " sleep " + sleepAmount + "\n"
|
fullCommand += " sleep " + sleepAmount + "\n"
|
||||||
}
|
}
|
||||||
fullCommand += " sleep 2.5\n"
|
fullCommand += " sleep 2.5\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user