Commit Graph

13 Commits

Author SHA1 Message Date
Jarek Kowalski
514df69afa performance: added wrapper around io.Copy()
this pools copy buffers so they can be reused instead of throwing away
after each io.Copy()
2020-03-10 21:52:30 -07:00
Jarek Kowalski
fb181257bf cli: implemented update check, fixes #119 2020-03-04 22:06:05 -08:00
Nick
8e0167027d Use bytes buffer to capture stderr instead of reading pipe
Give a `*bytes.Buffer` to the command and let `package exec` read from the pipe into the buffer for us.

The current use of the `StderrPipe()` method was problematic; the documentation for os/exec states:

> Wait will close the pipe after seeing the command exit, so most callers need not close the pipe themselves. It is thus incorrect to call Wait before all reads from the pipe have completed. For the same reason, it is incorrect to use Run when using StderrPipe.
2020-03-02 17:04:46 -08:00
Jarek Kowalski
faa7225c23 testing: better fix for ignoring ErrClosed 2020-03-01 10:53:52 -08:00
Jarek Kowalski
5e1b03dcba test: ignore ErrClose when reading from stderr to fix text flake 2020-02-29 20:07:45 -08:00
Nick
835d0b259c Fix error clobbering in kopia cli runner
Error variable was being shared between c.Output and
ioutil.ReadAll. The two could race to set err, and if
Output() finishes first with an error, ReadAll could overwrite
it with nil. Fix is to delegate an independent error for
the pipe read, and fail the test if it is non-nil.
2020-02-29 13:58:10 -08:00
Julio López
a9670762fd Generate shorter file names, and thus paths, in E2E tests (#229)
- Reduces name lengths by ~ 1/2
- Generate file names up to maxNameLength

Co-Authored-By: Nick <nick@kasten.io>
2020-02-14 22:25:50 -08:00
Jarek Kowalski
75929f65e9 travis: add integration tests and install-noui on Windows 2020-02-09 22:46:19 -08:00
Nick
383c042bf5 Adding low-level FSWalker walker/reporter functionality
Adds a wrapper around `Walk` that takes a Policy (protobuf definition) and performs a walk using it as configuration. The resulting Walk struct pointer is returned. The only exported functionality is unfortunately to read the Policy as a protobuf text file, so the implementation creates a temporary policy file whose lifetime is the duration of the call.

Adds a wrapper around the the FSWalker reporter `Compare` functionality. Takes a config file and two Walk pointers and compares the walks, returning the pb-defined Report struct. Again, the only exported functionality for reading config information is to read it as a protobuf text file. Creates a temporary config file, whose lifetime is the duration of the call, to pass in to the fswalker function.
2020-02-07 12:09:39 -08:00
Jarek Kowalski
9680dc376b cli: improvements for 'kopia server' and client
Those will make it possible to securely host 'kopia server' embedded
in a desktop app that runs in the background and can access UI.

- added support for using and generating TLS certificates
- added /api/v1/shutdown API to remotely trigger server shutdown
- added support for automatically shutting down server if no requests
  arrive in certain amount of time
- added support for generating and printing random password to STDERR

TLS supports 3 modes:

1. serve TLS using externally-provided cert/key PEM files
2. generate & write PEM files, then serve TLS using them
3. generate and use emphemeral cert/key (prints SHA256 fingerprint)
2020-01-24 17:25:45 -08:00
Nick
7367f85afe Snapshot failure test and fix kopia panic for non-executable directories
Adding test to probe snapshot failure. Tests snapshot of non-existent source directory, and then iterates through file permissions for files, directories, and issues snapshot to the source. Permission combinations are applied to a parent directory of the source, source itself, contents of source root when the source is a directory, and contents of a subdirectory in that source root.

Fixing kopia executable panic when a directory's contents can't be read. Previously the only Lstat error responded to was not-exist, letting other errors fall through and passing a nil `os.FileInfo` to the following function call, resulting in panic.
2020-01-20 21:29:55 -08:00
Jarek Kowalski
2bc8383e47 testing: customized e2e test directory tree shapes
based on PR feedback, instead of 3 uniform directories,
have 3 different shapes.
2020-01-16 19:40:34 -08:00
Jarek Kowalski
7d39be976f testing: split end_to_end_test into separate files.
refactored test helpers to separate package
made all tests parallel and improved the code structure
2020-01-16 19:40:34 -08:00