Commit Graph

654 Commits

Author SHA1 Message Date
David Dworken
d613c22e50
Move a bunch of utility functions for tests to a testutils.go file to make client_test.go at least a little shorter 2023-09-22 20:19:12 -07:00
David Dworken
5168efb2c8
Make testControlR more reliable by making it more lenient in how it looks for the separator 2023-09-22 20:03:41 -07:00
David Dworken
51ca2578b7
Follow up to e3d54e: Same thing for querying for pre-saved entries 2023-09-22 19:59:19 -07:00
David Dworken
e3d54e43e8
Make deletion request auto-retry SQLITE_LOCKED errors since deletion requests will now be much more common with pre-saving support 2023-09-22 19:47:10 -07:00
David Dworken
2c9aa099d2
Fix bug in offline sync code that contained off-by-one error leading to missed entries 2023-09-22 19:31:22 -07:00
David Dworken
e089690cbb
no-op formatting change 2023-09-22 19:22:03 -07:00
David Dworken
3f0adbc324
Add support for deleting pre-saved entries on the remote server 2023-09-22 19:00:37 -07:00
David Dworken
1d878195b2
Rework ff98a7907c to use the newly added EntryId column rather than deleting based on the start time 2023-09-22 14:03:41 -07:00
David Dworken
9b847c5e35
Further optimize client-server roundtrips by including deletion and dump requests in submit responses (follow up to 1e43de689f) 2023-09-22 13:49:29 -07:00
David Dworken
a5f11af150
Add initial code to support unique per-entry IDs
This code has two caveats for old entries:
1. the ID is being backfiled with a random per-(device,entry) ID. So the ID won't match cross-device.
2. the server-side ID will still be a random ID that is unrelated to the entry ID
2023-09-22 13:16:24 -07:00
David Dworken
2a5a6d65c4
Roll-forward "Add preliminary support for persisting pre-saved history entries remotely"
This rolls-forward commit 66916c27cb.
2023-09-22 13:13:46 -07:00
David Dworken
dc166ec089
Move fuzz tests to a separate file and add a couple more tests to it 2023-09-22 08:43:58 -07:00
David Dworken
66916c27cb
Revert "Add preliminary support for persisting pre-saved history entries remotely"
This reverts commit ff98a7907c. That commit is incomplete since it doesn't include support for the continous deletion of pre-saved history entries as soon as they
finish running. Support for this will require a good bit more work/thought, so reverting for and keeping this code in the git history.
2023-09-21 12:39:20 -07:00
David Dworken
ff98a7907c
Add preliminary support for persisting pre-saved history entries remotely 2023-09-21 12:39:04 -07:00
David Dworken
63dea34007
Add comment to document a somewhat confusing function 2023-09-21 11:35:47 -07:00
David Dworken
1e43de689f
Optimize number of round-trip HTTP connections made by the client by having the submit handler return metadata about whether there are pending dump/deletion requests
For now, I'm still keeping the dedicated endpoints for those functionalities, but since most of the time there are no dump/deletion requests this should cut down the number of requests made by the client by 2/3.
2023-09-21 11:35:24 -07:00
David Dworken
b05fb0f818
Fix typo-ed variable name 2023-09-21 11:25:26 -07:00
David Dworken
1c4570586c
Increase max supported line length for #93 2023-09-19 18:59:09 -07:00
David Dworken
69047109ac
Skip presaving the presave command, since it is currently spamming the recorded history entries in bash 2023-09-19 13:35:11 -07:00
David Dworken
216803f325
Bring back logic that was removed in c9da7a10e4 that made it so invalid initial search queries will get replaced with a query for the empty string 2023-09-18 22:21:10 -07:00
David Dworken
c9da7a10e4
Make the initial search query for the TUI async so that the UI opens immediately, so that user's can start typing their query without any delay 2023-09-18 19:35:53 -07:00
David Dworken
4f592f4aef
Automatically retry search queries when the DB is locked to increase reliability (especially when the backend is down, which leads to more queries, and thus more instances of the DB being locked) 2023-09-18 19:22:26 -07:00
David Dworken
f589a0b1ba
Increment the test_retry_count metric for failures too to ensure that it captures tests that fail all retries 2023-09-17 23:07:10 -07:00
David Dworken
134061085b
Fix bug in searching logic that caused gorm to template in NULL for non-null values 2023-09-17 20:24:48 -07:00
David Dworken
e6c76eb222
Make WHERE query for deleting presaved entries stricter and re-add in the error check that was removed in 713ee96a96 2023-09-17 14:38:48 -07:00
David Dworken
4c912cfaed
Improve sh config file tweak function to make it stricter with presaving 2023-09-17 14:35:56 -07:00
David Dworken
1d7ba41289
Avoid performance hit caused by pre-saving by presaving in the background 2023-09-17 14:11:44 -07:00
David Dworken
713ee96a96
Delete error checking branch that isn't necessary because the filter condition above is much more precise now 2023-09-17 12:06:19 -07:00
David Dworken
4b99e4d0e8
Fix misleading error message that contained the wrong shell name due to a copy/paste mistake 2023-09-14 23:09:15 -07:00
David Dworken
48e33d5034
Make the query input box in the TUI match the terminal dimensions 2023-09-14 21:14:16 -07:00
David Dworken
30ba0bd35c
Presaving clean up improvements: Skip presaving empty commands and make timestamp format clearer 2023-09-14 21:04:23 -07:00
David Dworken
328c35a096
Add presaving support for fish 2023-09-14 21:03:36 -07:00
David Dworken
c5a7245991
Add bug fix for presaving history where entries would sometimes end up duplicated 2023-09-14 21:01:13 -07:00
David Dworken
9fcdb7f960
Add TODO for tui UX improvement 2023-09-14 20:40:35 -07:00
David Dworken
01d9924cc0
Check sqlite DB error messages with Contains to be slightly more lenient 2023-09-14 12:32:50 -07:00
David Dworken
d4e01ceb11
Add another error message substring for detecting errors due to being offline, to improve #30 2023-09-13 22:49:40 -07:00
David Dworken
e8ceb02138
Move tui.go out of lib and into a separate package 2023-09-13 22:47:48 -07:00
David Dworken
6d6a1a5e12
Move a bunch of update-specific code out of the generic lib.go file and into the update command 2023-09-13 22:45:49 -07:00
David Dworken
f3e4a4e1e6
Disable tquery test that is failing on github actions 2023-09-13 21:56:58 -07:00
David Dworken
b6b4dbe37a
Add tests for presaving history entries 2023-09-13 20:29:06 -07:00
David Dworken
6540b4dbf6
Improve logged error messages for API failures 2023-09-13 20:24:25 -07:00
David Dworken
a039b19b9c
Change root command name to all lower case so that the cobra-generated examples work correctly on case-sensitive file systems 2023-09-13 19:46:49 -07:00
David Dworken
763c8208f7
Make RetryingDbFunction more lenient so that it always ignores UNIQUE constraint errors, since if a DB.Create returns a UNIQUE error, then the create is not actually necessary 2023-09-13 19:20:15 -07:00
David Dworken
f1e2b8ddbf
Update TestSortByConsistentTimezone to not use a golden for tquery since it was leading to occasional flakes, and swap it to using a regex. Also add a test for hishtory export as part of the sorting tests. 2023-09-12 19:09:01 -07:00
David Dworken
57c5a69f7d
Fix bug where we failed to delete pre-saved history entries due to race conditions causing the DB to be locked 2023-09-12 18:55:13 -07:00
David Dworken
aebf526d1f
Add TODO for a theoretical bug I noticed 2023-09-12 17:51:55 -07:00
David Dworken
c311b09844
Improve error messages when we fail to delete pre-saved history entries 2023-09-12 15:53:52 -07:00
Sergio Moura
2b3912c750 fix check for empty array result 2023-09-11 16:34:22 -04:00
David Dworken
9b871e93ed
Fix consistent time zone sorting test to account for table sizing differences on github actions 2023-09-10 17:13:48 -07:00
David Dworken
c269e7832e
Release v0.212 2023-09-09 15:17:55 -07:00
David Dworken
e3e3a7bd0d
Add tablesizing command to get consistent table dimensions 2023-09-09 14:02:47 -07:00
David Dworken
2ccbb8d587
Store timestamps in DB in Unix time, and display them in the Local time for consistent TZs in displays, and to ensure ordering is correct
This fixes a bug where entries could be out of order if they were recorded on machines in different TZs (e.g. if one machine had the TZ set to UTC). Admittedly, this commit isn't a perfect fix since
it doesn't change all the existing hishtory entries to be stored in UTC, but this just means that the ordering bug will continue to exist for historical entries, but be fixed for new entries. And
for our purposes, that is good enough. :)

 # Please enter the commit message for your changes. Lines starting
2023-09-09 12:28:01 -07:00
David Dworken
223598c8f2
Remove golden that was forked for actions, that didn't need to be 2023-09-09 11:56:06 -07:00
David Dworken
b6b4499a42
Add a few more ExtraDelays + comments to further improve test reliability 2023-09-09 11:50:07 -07:00
David Dworken
4d7e685a6e
Add ExtraDelay to make testTui/delete more reliable 2023-09-08 19:44:36 -07:00
David Dworken
ba099c384b
Add statsd incr for overall test failure 2023-09-08 19:40:10 -07:00
David Dworken
27d5c59263
Skip datadog integratio on macos if colima fails to start, since colima appears to be flaky due to a code signing error 2023-09-08 19:27:16 -07:00
David Dworken
3a8243d25d
Another set of extra delays for testTui/search, similar to 37c06a31db 2023-09-08 10:09:01 -07:00
David Dworken
cc10689d09
Skip running DD on non-master branches so that PRs can run successfully 2023-09-08 09:59:55 -07:00
David Dworken
37c06a31db
Add extra delay before adding token that makes it an invalid search query to make the race condition less likely 2023-09-08 09:53:39 -07:00
David Dworken
3448c3fdf6
Add hishtory export test as a pre-req for testTui/search to ensure that entries are getting properly stored 2023-09-07 22:18:16 -07:00
David Dworken
519a7ba706
Add OS tag for datadog test export 2023-09-07 22:03:03 -07:00
David Dworken
e5864c9a16
Fix datadog tags to be passed as key/values 2023-09-07 21:05:30 -07:00
David Dworken
a13549851c
Add basic datadog integration to monitor test failures in github actions 2023-09-07 18:30:47 -07:00
David Dworken
4bc23c9575
Add additional information about sync status to hishtory status -v for debugging purposes 2023-09-07 18:10:17 -07:00
David Dworken
c73b10011b
Add TODO for a bug where sorting entries by timestamps in different timezones causes issues 2023-09-07 18:09:30 -07:00
David Dworken
578113e07c
Revert "use errors.Is to determine what the error is" since it doesn't work with modernc.org/sqlite which we need in order to avoid using CGO (which we do to enable easy cross-compiles)
This reverts commit 1589f77956. When building with CGO_ENABLED=0, this code will fail to build.
2023-09-06 20:21:00 -07:00
David Dworken
d80afc27d4
Clear out ~/.other-path/ in tests since it wasn't getting cleared, which meant retries were guaranteed to fail for this function 2023-09-06 20:13:36 -07:00
David Dworken
c5bdee9ad5
Merge pull request #102 from lsmoura/sergio/no-ctx-ptr
Remove context pointers since there is no need to pass around a pointer to an interface
2023-09-06 19:58:08 -07:00
Sergio Moura
ce6484f465 constant context keys 2023-09-05 15:54:47 -04:00
Sergio Moura
a12b0e5f6f no context pointers 2023-09-05 15:45:17 -04:00
Sergio Moura
1589f77956 use errors.Is to determine what the error is 2023-09-05 15:37:42 -04:00
Sergio Moura
83ad8c7b1f wrap errors with %w instead of using %v 2023-09-05 15:08:55 -04:00
David Dworken
f778c1b2b6
Increase number of retries for all retriable tests on github actions 2023-09-04 21:21:13 -07:00
David Dworken
fd018fa759
Increase number of retries for testTui/search since that method appears to be the flakiest on github actions 2023-09-04 18:57:00 -07:00
David Dworken
af0234797c
Refactor test retrying functions to make the number of retries configurable, and change the default to 3 retries (I'll be tuning this number in a follow up commit) 2023-09-04 18:17:02 -07:00
David Dworken
7b02d6f2a2
Update testTui setup function to ensure that entries are also added in the remote server and not just locally, to ensure they show up post-sync 2023-09-04 18:13:22 -07:00
David Dworken
434acd3738
Increase timeout amount for all github action tests 2023-09-04 18:09:11 -07:00
David Dworken
c690688834
Implement a few additional methods on retryingTester so it works with testify 2023-09-02 17:49:31 -07:00
David Dworken
58c791b662
Add extra delay before ENTER for searching to ensure that the async query finishes 2023-09-01 21:57:25 -07:00
David Dworken
96d14d3b9f
Add extra timing between search and the atom that makes it invalid to ensure that the initial search is processed 2023-09-01 21:54:12 -07:00
David Dworken
f808e3815a
Increase num retries for github actions 2023-09-01 16:30:42 -07:00
David Dworken
ab694c38b1
Split testTui again into smaller more specific test functions 2023-09-01 16:28:41 -07:00
David Dworken
1608543a4d
Remove TODO 2023-09-01 15:57:11 -07:00
David Dworken
134dba5ddd
Auto retry testControlR since it is the other test function that is flaky due to race conditions in screenshot tests 2023-09-01 15:55:13 -07:00
David Dworken
3b07aa9a37
Split testTui method into separate smaller test methods that are more specific 2023-09-01 15:42:02 -07:00
David Dworken
21e2370d98
Rework delays to primarily only do a delay before capturing output, since that is the critical time for async rendering 2023-09-01 11:23:03 -07:00
David Dworken
5fcd7a9c7b
Further increase sleep amount on github actions since actions seem to be super slow 2023-08-29 23:47:22 -07:00
David Dworken
ddddff0f1b
Add automatic retries for the TestTui method which is sadly inherently flaky since it is akin to screenshot tests of a terminal 2023-08-29 23:23:21 -07:00
David Dworken
a53485f04b
Remove TODOs that were fixed in 23a377e3c1 2023-08-29 19:03:12 -07:00
David Dworken
5fe9515749
Fix test for the user column so it passes on github actions 2023-08-29 19:01:46 -07:00
David Dworken
23a377e3c1
Preserve cursor position after deleting entries and resizing 2023-08-29 18:59:20 -07:00
David Dworken
6bc70d0732
Add additional delay for TestTui-Search 2023-08-28 20:56:16 -07:00
David Dworken
ab567edce3
Migrate more of client tests to testify for assertions 2023-08-28 20:55:15 -07:00
David Dworken
596b5b2770
Add tests for the User column + swap to using require.NoError(...) in a few places 2023-08-28 19:27:29 -07:00
David Dworken
66f3dc13ec
Add support for displaying the user as a column via the 'User' column 2023-08-28 12:19:14 -07:00
David Dworken
5e44159a0b
Remove extraneous fmt.Println from beta-mode feature for pre-saving history entries 2023-08-27 22:11:22 -07:00
David Dworken
2490082088
no-op refactoring: Move history entry building code from lib.go to cmd file for saving history entries 2023-08-27 22:05:24 -07:00
David Dworken
fe41687fd0
Remove extraneous new lines from TUI that make the UI jump around for invalid search atoms 2023-08-27 21:47:44 -07:00
David Dworken
9b37cb6db1
Increase sleep time to make tests reliably pass even with async queries 2023-08-27 18:36:08 -07:00
David Dworken
eba27e7721
Fix race condition in tests introduced by a79d401058
The race condition stems from the fact that queries are now async, so there is a chance this test hits ENTER before the new search queries have come in.
2023-08-27 16:12:54 -07:00
David Dworken
2294241003
Remove Search() call from install to optimize 2023-08-27 15:53:01 -07:00
David Dworken
ecdd6094b8
Remove Search() call from init to optimize init 2023-08-27 15:41:35 -07:00
David Dworken
5dae81d336
Sort by start_time in beta mode only, to fix failing tests caused by changing the sorting 2023-08-27 15:20:40 -07:00
David Dworken
25ec191f1a
Implement pre-saving feature to ensure that long-running/non-terminating commands are saved in hishtory 2023-08-27 14:24:59 -07:00
David Dworken
a79d401058
Make queries async for better TUI performance when sqlite is slow 2023-08-27 11:42:17 -07:00
David Dworken
311b698388
Add TODOs 2023-05-19 17:16:54 -07:00
David Dworken
9f2b392ddb
Add key binding to select an entry and cd into that directory 2023-05-19 17:14:33 -07:00
David Dworken
06cbd0e7f3
Add extra string split so the test passes on github actions 2023-05-17 08:38:47 -07:00
David Dworken
082d342b0d
Add test to cover breakage in #82 2023-05-16 17:34:25 -07:00
David Dworken
c0e56eff0d
Fix #82 by ensuring that the results list also filters out duplicates 2023-05-16 17:12:52 -07:00
David Dworken
0b13a9705d
Fix control-K in offline mode for #80 2023-04-30 08:50:17 -07:00
David Dworken
3d3260db37
Re-enable tests on actions so I can debug them 2023-02-28 19:26:13 -08:00
David Dworken
765c1c18d0
Remove && false to enable the getwd syscall as a fallback 2023-02-28 17:44:05 -08:00
David Dworken
8422aa21db
Skip configuring the bash_profile on linux if bash_profile does not exist to fix #79 2023-02-27 18:14:32 -08:00
David Dworken
ff24b66fce
Fix unescape function per comments on #73 and add tests for searching for a backslash 2023-02-20 15:46:39 -08:00
David Dworken
0a694c39d5
Add workaround for #69 that avoids go's getCwd method that relies on stat rather than getwd 2023-02-20 12:42:23 -08:00
David Dworken
5089058165
Add missing help page text for a golden 2023-02-20 12:33:22 -08:00
David Dworken
c03f9d3d76
Add tests for opening and closing the help page 2023-02-20 12:15:27 -08:00
David Dworken
be5338ee21
Add updated goldens for help page 2023-02-20 11:56:16 -08:00
David Dworken
11c110e13e
Add untested version of help page 2023-02-20 10:54:16 -08:00
David Dworken
b69788967f
Fix bug where typing 'foo:' and then hitting backspace would lead to the error still being displayed 2023-02-19 22:08:38 -08:00
David Dworken
dc65fffd7b
Add an index on end_time to ensure that initial queries are fast to fix #68 2023-02-18 22:26:18 -08:00
David Dworken
27cd544524
Add support for arm7 for #63 to support raspberry pis 2023-02-18 22:00:39 -08:00
David Dworken
f2298def32
Ignore a single dash as a token to improve search behavior for queries like 'ls -' to improve #67 2023-02-18 21:46:51 -08:00
David Dworken
2ae54ef74e
Simplify stripBackslash 2023-02-14 08:47:38 -08:00
David Dworken
4b5b729328
Add integration tests for escaping 2023-02-13 22:43:55 -08:00
David Dworken
a5926af49c
Unit tests for Search taking advantage of escaping 2023-02-13 22:32:42 -08:00
David Dworken
162dd86893
Add unit tests + rename method 2023-02-13 22:26:02 -08:00
David Dworken
b6eb4da4f3
Rename deEscape to unescape 2023-02-13 21:36:54 -08:00
David Dworken
f79ab37bcf
Merge pull request #70 from hakanf/escape_chars
Allow search strings to escape special chars ' ', ':' and '-' using '\'
2023-02-13 21:34:23 -08:00
David Dworken
01e9d39350
Add TUI test for scrolling right by 2 2023-02-13 20:24:20 -08:00
David Dworken
f12cc8cdff
Add basic TUI test for horizontal scrolling 2023-02-11 23:09:40 -08:00
David Dworken
8f59b801dd
Add left scrolling test 2023-02-11 09:10:45 -08:00
David Dworken
fea151261f
Move goldens func to testutils and use it for some simple horizontal scrolling tests 2023-02-11 09:09:48 -08:00
David Dworken
e1cb97f7c6
Add comment calling out the fork + import table_test.go too 2023-02-11 08:51:28 -08:00
Håkan Fouren
3c468f46aa
Added local customized version of bubbles/table with horizontal cell scroll 2023-02-05 02:19:18 +08:00
Håkan Fouren
f08cac491c
Use rune instead of byte when traversing strings 2023-02-05 02:13:42 +08:00
Håkan Fouren
9062c24a7e
Allow search strings to escape special chars ' ', ':' and '-' using '\' 2023-02-05 02:13:42 +08:00
David Dworken
226b39609f
Cleanup TUI code now that we persist table entries in the model 2022-12-18 22:29:23 -08:00
David Dworken
9322614a91
Add shortcut to delete entries in the TUI to fix #33 2022-12-18 22:02:29 -08:00
David Dworken
554d518caa
Persist history entries in the TUI model to prep for #33 2022-12-18 21:26:00 -08:00
David Dworken
27dce98528
Remove outdated TODO 2022-12-18 01:04:24 -08:00
David Dworken
c0bd577084
Add test to confirm that window resizing works 2022-12-18 01:01:05 -08:00
David Dworken
ebfdaa7a4a
Refactor tests to prep for supporting resizing tmux sessions 2022-12-18 00:34:25 -08:00
David Dworken
5f95ac48a4
Add control-d as an alternate key binding to close the TUI to fix #61 (plus some tests) 2022-12-18 00:27:29 -08:00
David Dworken
d15376f37d
Refactor out deletion request handling to prep for #33 2022-12-18 00:19:52 -08:00
David Dworken
10c8b97e84
Add comment 2022-12-17 21:55:30 -08:00
David Dworken
2edbf3977f
Add test for left scrolling in the input box 2022-12-17 12:14:28 -08:00
David Dworken
e6186d17b1
Fix TUI cursor bug by upgrading bubbles to include commit d1775121146a88a44a48562490cf08b7dd9df1c4 2022-12-17 11:54:51 -08:00