David Dworken
44b4cc6df6
Backup and restore .zhistory file in tests
2024-04-14 09:57:05 -07:00
David Dworken
6aea2cb4d9
Remove minor version numbers from os versions for golden files for tests
2024-04-03 19:04:49 -07:00
David Dworken
6065068f9b
Enable colored golden tests for linux ( #184 )
...
* Enable golden tests for linux and ensure all goldens get saved as outputs
* Swap in OS specific goldens
* Update colored goldens to take into account OS version, since different macos versions have different behavior here
* Update goldens
* Re-enable golden tests
* Add missing golden
* Empty commit
* Remove linux kernel version from OS name
2024-03-28 08:03:04 -07:00
David Dworken
17b158d4b3
Swap to checking golden usage post-tests so that it covers all golden usages, and not just per-package
2023-12-22 08:04:10 -08:00
David Dworken
e5764c6f07
Update AssertAllGoldensUsed to use an allowlist of goldens that may not be referenced in GH actions
2023-12-22 06:51:21 -08:00
David Dworken
9f5453f710
Fix issue where we paniced because the colored TUI test goldens weren't used on linux
2023-12-21 18:31:29 -08:00
David Dworken
88f1c0168e
Move test goldens to testdata/ directory to be more idiomatic, and add assertion that they're all actively being used by the tests ( #154 )
...
* Move golden files to testdata dir
* Add assertion that requires that all goldens are used
* Add map init so the map is non-nil
* Add print to confirm that tests finished running
* Remove colon so that this doesn't match against gotestsum looking for the substring "panic:", which can happen depending on how stdout is buffer
* Revert "Remove colon so that this doesn't match against gotestsum looking for the substring "panic:", which can happen depending on how stdout is buffer"
This reverts commit b44e53a17b
.
2023-12-21 17:06:46 -08:00
David Dworken
3ce76d154a
Add timestamp to testlog
2023-12-20 19:41:00 -08:00
David Dworken
8419a883b4
Normalize hostnames in goldens so that golden files work well for local tests too
2023-12-09 15:12:40 -08:00
David Dworken
acdcd9569a
Fix error checking so that if /tmp/test-goldens/ exists, then we don't error out
2023-12-03 16:58:31 -08:00
David Dworken
bdaf0f8a65
Make TUI always take exactly the full width of the terminal through more precise calculations of the overhead used for the table ( #136 )
...
* Make TUI always take exactly the full width of the terminal through more precise calculations of the overhead used for the table
* Update TUI goldens for more accurate TUI sizing
* More golden updates for wider table sizing
* Include failed test goldens as artifacts for easier test fixing on github actions
2023-12-03 13:15:38 -08:00
David Dworken
b928ff642f
Add additional error checking for server startup
2023-11-22 20:47:40 -08:00
David Dworken
390f37f20c
Update testTui tests to run with online and offline installs
2023-10-25 20:44:26 -07:00
David Dworken
9433bd6e94
Refactor offline simulation tests so that they reliably set the env variable before ever starting the shell, since we need the env variable to also apply to presaving
2023-10-22 11:28:41 -07:00
David Dworken
56f54f0f65
Better output formatting for server failures
2023-10-15 12:48:05 -07:00
David Dworken
d33bd6a046
Improve history import performance so that we can import 100k entries in ~6 seconds (down from ~20 seconds)
2023-10-02 22:27:24 -07:00
David Dworken
0b57034c39
Revert "Revert all commits since v0.223 to enable me to release a patch on top of v0.223"
...
This reverts commit 68ed9f2d5d
.
2023-09-29 18:21:23 -07:00
David Dworken
68ed9f2d5d
Revert all commits since v0.223 to enable me to release a patch on top of v0.223
2023-09-28 22:15:30 -07:00
David Dworken
7e33e942e6
Delete no longer used function
2023-09-28 22:14:35 -07:00
David Dworken
9fda54d4c2
Remove testutils.Check(t, err) and replace it with require.NoError which gives a clearer error message and a full stacktrace
2023-09-28 22:13:27 -07:00
David Dworken
6d5a86a8bb
Revert all commits since v0.223 to enable me to release a patch on top of v0.223
2023-09-28 21:49:37 -07:00
David Dworken
0c202e4130
Delete no longer used function
2023-09-24 18:09:41 -07:00
David Dworken
5121df5a8c
Remove testutils.Check(t, err) and replace it with require.NoError which gives a clearer error message and a full stacktrace
2023-09-24 16:05:01 -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
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
2b115844f4
Improve testutils server runner to persist logs and kill existing servers automatically
2023-09-13 20:23:09 -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
25eae144d8
Revert all tmpfs related commits, since running in a tmpfs doesn't seem to meaningfully improve test reliability
2023-09-04 18:03:46 -07:00
David Dworken
9b06e6980a
Revert 2ca6c751d0
and instead have BackupAndRestore keep files on the same mount point
2023-09-02 20:09:22 -07:00
David Dworken
2ca6c751d0
Avoid constantly copying the binary back and forth to make tests faster on github actions
2023-09-02 19:51:43 -07:00
David Dworken
c0f33a3456
Swap from os.Rename to a custom implementation that copies files to support cross-device renames, as needed for making ~/.hishtory/ a tmpfs for tests
2023-09-02 18:50:52 -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
a79d401058
Make queries async for better TUI performance when sqlite is slow
2023-08-27 11:42:17 -07:00
David Dworken
201bedf020
Remove workarounds for half-implemented windows support
2023-05-19 17:16:17 -07:00
David Dworken
413e2e438f
Fix github actions golden paths
2023-02-13 20:49:41 -08:00
David Dworken
a4ae3f83ad
Log goldenPath for golden not found errors
2023-02-13 20:20: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
f8b51e49da
Support customizing HISHTORY_PATH for people who want to install hishtory in an alternate location to fix #54
2022-12-16 22:22:57 -08:00
David Dworken
857e423e10
Fix linter errors + some general clean up
2022-12-11 20:31:50 -08:00
David Dworken
35444bf56e
Swap ioutil to non-deprecated alternatives + clean up pre-commit errors
2022-11-27 11:59:06 -08:00
David Dworken
86f9d67aff
Fix test failures caused by the cobra install command not respecting the secret key
...
Also added a persistLog() function so that I can easily inspect the hishtory logs from test runs.
2022-11-16 20:28:25 -08:00
David Dworken
49a1035169
Fix flakey test failures by removing cache=shared which is a discouraged mode ( https://www.sqlite.org/sharedcache.html ). WAL is sufficient for our purposes. Plus fix a bug where the TUI would go into an infinite loop if there were zero results.
2022-11-15 23:20:19 -08:00
David Dworken
53a417296e
Improve backup and restore env function + fix makefile with quotes + remove the zdotdir created file
2022-11-13 16:53:37 -08:00
David Dworken
cda9c886e1
Introduce a helper method for checking if we're in github actions
2022-11-12 06:46:37 -08:00
David Dworken
ddc9dc1080
Better reset the local state to attempt to fix a github action failure
2022-11-12 06:42:10 -08:00
David Dworken
36ff3d362c
windows: use a temp file rather than hardcoding /tmp/ since that doesn't exist on windows
2022-11-06 17:46:45 -08:00
David Dworken
456513d71e
windows: restore the cd ../ behavior, but for windows
2022-11-06 14:42:01 -08:00
David Dworken
4a9b202e5f
Windows: handle failing to read the VERSION file
2022-11-06 00:17:03 -07:00
David Dworken
6938035715
Windows: handle failing to read the VERSION file
2022-11-06 00:16:14 -07:00
David Dworken
f4925a0999
Windows: Disable killall on windows
2022-11-06 00:02:48 -07:00