36 Commits

Author SHA1 Message Date
Vaibhav Kamra
fa190da682
Rename restorepoint to backup (#314) 2022-07-11 16:06:04 +00:00
ashmrtn
e7a6d07c5b
Basic mocks for kopia Entry and File (#307) 2022-07-08 13:59:20 -07:00
Vaibhav Kamra
6e9bd634e4
Create RestorePoint and RestorePointDetails (#290)
Update the backup operation to create RestorePoint and RestorePointDetails models in the repository

Add modelstore to the operation to allow backup/restore operations to update/query for corso models

Closes #268
2022-07-08 01:41:40 +00:00
Vaibhav Kamra
9d21d65bc7
Use MockExchangeData in kopia backup tests (#303)
This implements the DataStreamInfo interface needed by BackupCollections
2022-07-08 00:23:34 +00:00
ashmrtn
5605a204d1
Factor out common code for getting kopia items (#298)
* Factor out common code for getting kopia items

Both directory and single item restore in kopia need to do common tasks
like getting the item in question. Factor out that common code and
adjust tests to prep for directory restore.
2022-07-07 16:04:06 -07:00
ashmrtn
1143a33ce6
Allow multiple items in DataCollection from kopia (#296)
Use a slice to back the data instead of adding directly to the channel
for two reasons (this may change in the future though):
  * kopia loads all data about a directory at the same time
  * consumers of the DataCollection may not pull items from the channel
    at a fast rate, which could block adding to the channel. This could
    lead to delays in discovering other directories to traverse in
    multi-threaded scenarios
2022-07-07 14:54:46 -07:00
ashmrtn
70e7a1e2d3
Split KopiaWrapper into handle and backup/restore logic (#281)
* Split KopiaWrapper into repo handle and logic

With ModelStore, multiple structs need a reference to the kopia repo.
Make a small wrapper class (conn) that can open and initialize a repo. The
wrapper handles concurrent closes and opens and does ref counting to
ensure it only drops the kopia handle when the last reference is closed.

Rename KopiaWrapper to Wrapper and keep backup/restore functionality
in it.
2022-07-06 11:09:35 -07:00
Vaibhav Kamra
233aa43f4c
RestorePoint and RestorePointDetails models (#279)
RestorePoint and RestorePointDetails models.

Refs #268
2022-07-06 11:03:39 -07:00
ashmrtn
9606546336
Use test setup/teardown to reduce code duplication (#277)
Tests that run multiple sub-tests do not use the fields in the test
suite because that would cause the model store instance to be reused
instead of having a new model store instance for each subtest.
2022-07-06 07:57:17 -07:00
ashmrtn
ed4c71c093
Implement more ModelStore Get functions (#267)
* Implement ModelStore GetByType and Get

* Add tests for ModelStore Get functions

* Add stricter "type" checks for loaded models

Take modelType as parameter and check the model in question matches that
type. Adds a little extra layer of protection if models happen to have
the same struct layout.
2022-07-05 15:51:29 -07:00
ashmrtn
26fc4c9075
Implement ModelStore update (#265)
* Add ModelStore Update operation

* Tests for ModelStore Update function

* Add regression test for error during Update()

Ensure that if an error occurs during a ModelStore update operation the
previously stored model remains unchanged and no new model is visible to
the user.
2022-07-05 11:35:53 -07:00
ashmrtn
cdf368ad20
Implement ModelStore delete functions (#264)
* Implement ModelStore delete functions

* Add tests for ModelStore.Delete()
2022-07-01 14:46:43 -07:00
ashmrtn
5ec6d4f286
Base model revision (#263)
* Update model interface and base struct

* Update code and tests for new Model interface
2022-07-01 14:17:15 -07:00
ashmrtn
99691f46d5
ModelStore Put/Get implmentations (#261)
* Simple Get and Put implementations

Get implementation is currently the one that uses the kopia ID of the
model/manifest.

* Basic tests for ModelStore Get/Put
2022-07-01 11:07:01 -07:00
ashmrtn
ed3844b714
API definition for model store (#249)
Basic API definitions for model store CRUD operations
2022-06-29 10:35:41 -07:00
ashmrtn
1c6f0994e4
Switch DataCollection to return a channel (#244)
* Change DataCollection to return channel directly

Precursor to restoring multiple items from kopia. Allows one to keep a
DataCollection open until all items are processed without blocking
consumers of the DataCollection (they can use a select-block if needed).

* Update tests for new DataCollection interface

* Handle context cancellation with DataCollection
2022-06-28 12:48:24 -07:00
Keepers
689c5cc1e9
separate tenantID from m365 creds (#231)
* separate tenantID from m365 creds

Now that account.Account is in place, tenant id needs
to get removed from the credential set (it isn't actually
a secret) and placed in the account configuration instead.
2022-06-27 13:54:37 -06:00
ashmrtn
902294b70d
S3 test prefix naming (#228)
* Update how S3 storage structs are generated

  * fix bug in printing year of date
  * use the name of the test instead of trying to pull name from runtime
  * always log the time when making the storage struct
  * don't allow user to specify prefix

* Fixup tests for new test storage API

* Update function name and comment
2022-06-23 11:55:26 -07:00
Keepers
2b65ff80f2
hook up restore end-to-end (#226)
* hook up restore end-to-end

Now that GC and KW both provide restore operations for a
single message, we can hook up the end-to-end restore
process.  Integration tests for this change will follow in the
next PR.
2022-06-22 18:17:26 -06:00
ashmrtn
756b429362
Add public kopia function to restore a single item (#225)
Returns a DataCollection to the caller on success. Also update tests to
use new public function where appropriate.
2022-06-22 13:14:00 -07:00
ashmrtn
622e8eab95
kopia code to translate single item to DataCollection (#216)
* DataCollection and DataStream structs for kopia

* Helper function to get a single item of data

Returns a DataCollection with a single item.

* Test for backing up and restoring a single item
2022-06-22 09:50:17 -07:00
Keepers
f03432e303
read test config from local file (#179)
* read test config from local file

Allows local configuration of the test environment by reading from
a .toml config file.  If no file exists, the file read is a no-op.  Value
prioritization is specified in the readTestConfig() func.
2022-06-10 13:21:03 -06:00
ashmrtn
d00f9c856f
Add remainder of BackupCollections code (#170)
Fill in BackupCollection logic for kopia dirs and test

"Rehydrate" the given DataCollections into a hierarchy of kopia
virtualfs directories, allowing kopia to make a single snapshot of them.
Directory structure is extracted from the information returned by
DataCollection.FullPath().
2022-06-09 10:33:00 -07:00
ashmrtn
53c7b4a149
Fix kopia test panics if repo is nil (#168) 2022-06-08 13:28:32 -07:00
Keepers
21bf1d8b39
make consts camelCase (#153) 2022-06-07 11:44:14 -06:00
ashmrtn
f84d8e34d6
Backupwriter skeleton code (#141)
Add skeleton and test for backing up data with kopia

Full code for launching kopia snapshots is present but code for building
the directory structure to hand kopia is not. Therefore, no data will be
backed up right now.
2022-06-06 15:59:21 -07:00
Keepers
44392ab8b2
adds env-based integration test controls (#128)
* adds env-based integration test controls

Some integration tests were running locally without being told
to do so via env variables.  This adds some controllers for validating
if and when those tests should run, and for ensuring the env
variables necessary to run the test are available.

* testing helper comments, func name change

* add testing timeOf log, skip gc ci tests

* corrected the test skip in GC_test

* update kopia_test with helpers

* rename /testing files to *_test.go

This will ensure these files do not compile into the release binary.

* Revert "rename /testing files to *_test.go"

This reverts commit 04fd2046cc6d11bf3e3eb98d98a3e84b1bba6366.
2022-06-06 13:17:40 -06:00
ashmrtn
ecb894fc17
Struct with information about completed uploads (#121)
POD struct that holds some simple information about a kopia upload. Not
wrapping or returning a handle to a kopia struct to keep upper layers of
corso clear of type dependencies. Struct will help with tests as it can
be returned from public functions in the KopiaWrapper package allowing
more black-box testing. Especially useful since we don't yet have a
restore flow, which means we can't test data == restore(backup(data)).
2022-06-06 10:12:18 -07:00
ashmrtn
f68a4e3f46
Fix pointer receivers for KopiaWrapper handles (#131)
* Fix pointer receivers

* Some basic tests about closing KopiaWrapper

* Return pointers to structs
2022-06-03 16:15:51 -07:00
ashmrtn
f1550c967b
Add function to open kopia (#111)
* Add function to open kopia and keep handle

* Add kopia handle in Repository

* Have Repository manage lifetime of KopiaWrapper

* Have CLI manage lifetime of Repository
2022-06-03 10:34:28 -07:00
Keepers
cc3306e5e0
validate required storage props (#85) (#108)
* validate required storage props (#85)

Centralizes validation of required storage config properties within
the storage package.  Requiremens are checked eagerly at
configuration creation, and lazily at config retrieval.

Additionally, updates /pkg/storage tests to use suites
and assert funcs.

* add validation failure tests to storage
2022-06-02 15:33:19 -06:00
Keepers
535cb9e1f5
add common config and encryption passwd (#74) (#99)
* add common config and encryption passwd

Adds a provider-independent configuration handler, and the
the encryption password config property.  The password is used
to encrypt and decrypt the kopia repository properties file.

* fix corso_password in ci.yml

* actually use the corso password in testing

* replace passwd in ci.yml with a secret

* ci.yml secret typo fix
2022-06-01 16:00:41 -06:00
Keepers
eaf6018996
add prefix flag for s3 (#94)
* add prefix flag for s3

Adds the flag --prefix for s3 repo init and creation.

* fix missing prefix flag in repo s3 cli
2022-05-27 17:22:50 -06:00
Keepers
d923c4072b
expose s3 endpoint as flag (#87)
Exposes the s3 endpoint option as a cli flag and storage config
property.  Uses the kopia default s3.amazonaws.com as a fallback.
2022-05-27 09:11:26 -06:00
Keepers
e6663fd0f1
changes requried for manual repo init (#25) (#80)
A small collection of changes and code cleanup to successfully run
'corso repo init s3' manually.  Adds a default s3 url (might want
this configurable for local testing) and aws session token support.
2022-05-25 17:27:23 -06:00
Keepers
569ba524ac
adds kopia pkg to handle integration (#25) (#76)
* adds kopia pkg to handle integration (#25)

internal/kopia will be used to abstract all kopia integration in a
central location.

* defer blob.Storage closure in kopia

blob.Storage objects must get closed at the end of their usage.
This currently isn't getting called.
2022-05-25 13:08:47 -06:00