2548 Commits

Author SHA1 Message Date
Keepers
8272227895
add cron action to purge s3 test bucket weekly (#200)
* add cron action to purge s3 test bucket weekly
2022-06-15 12:46:28 -06:00
Danny
e0199b6b26
Issue 184 Full Path added to DataCollection (#199)
Merge of Branch adds FullPath to the DataCollection() where each DataCollection is based on the folder. Thus, returning a [] DataCollection
2022-06-14 17:09:02 -04:00
Danny
88bc374208
Issue 181: GC Implement restore (#197)
Addition of restoreMessages(dc DataCollection) error for GraphConnector
Merge completes Issue #181. Test suites updated
2022-06-14 14:57:38 -04:00
Keepers
ffdb469cf6
Issue 193 (#194)
* add integration tests to backupop run
2022-06-13 15:45:07 -06:00
Keepers
f39d0ecfc4
add repo connect s3 integration test (#192)
* add repo connect s3 integration test
2022-06-13 08:19:03 -06:00
Danny
1957de09d2
GraphConnector testing expanded (#180)
* GraphConnector testing expanded
setTenantUsers covered and switched the test account for an account with fewer corner cases.
2022-06-10 15:31:20 -04: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
Danny
f713047f95
Testing expansion (#177)
Incremental tests added to project
Functional test added to test package to showcase usage and streamline on GraphConnector test suite.
2022-06-10 10:41:45 -04:00
Danny
8a450c07b5
Error package graph connector (#173)
Merge of this package removes the `errorList` from the Query workflow. Some variable names changed to comply with industry standards.
2022-06-09 17:20:04 -04:00
Keepers
340d875579
use config file for backup create (#171)
* use config file for backup create

Now that corso stores its prior connection details in a config
file, that file should get used to retrieve storage details as needed.
2022-06-09 14:28:26 -06:00
Keepers
9abfb486d8
remove unused repo provider consts (#176) 2022-06-09 13:49:34 -06:00
Keepers
f3866b7283
add pkg/log with zap log library (#155)
Adds a logger pkg using the zap log library.  Generally straight-
forward, though we'll have to watch out for gotchas with the
flush requirements.
2022-06-09 13:17:01 -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
Keepers
875e3cb517
call backup on exchange collection (#172)
Wires up the backupOperation to graphConnector and kopia to
fully run an end-to-end backup.
2022-06-09 00:07:04 -07:00
Vaibhav Kamra
0da0c786b5
Mock ExchangeDataCollection (#166)
Implements a mock exchange data collection that can be used to test without connecting to graph.

Currently returns a "fixed message" but we can extend this to return anything that implements io.Reader
e.g. a file that contains a serialized message.
2022-06-08 16:33:59 -07:00
Keepers
2104e66fea
add graph connector to backupOp (#165)
Adds graph connector to the backup operation implementation.
This includes feeding the account credentials into the
backup as well.
2022-06-08 17:32:14 -06:00
Vaibhav Kamra
9043351716
Implement ExchangeDataCollection iteration (#162)
DataCollection Feature added
In this merge, the DataCollection interface is defined for the GraphConnector. ExchangeDataCollection implements this interface. The subsequent definitions and test suites are included.
2022-06-08 17:59:03 -04:00
Vaibhav Kamra
a91a739d0e
Only run CI once for pull requests (#169)
Currently CI is triggered twice when a PR is updated (the second
run being triggered by the branch push). This removes that
trigger.
2022-06-08 15:45:06 -06:00
ashmrtn
53c7b4a149
Fix kopia test panics if repo is nil (#168) 2022-06-08 13:28:32 -07:00
ashmrtn
042f3eaaee
Add FullPath() to DataCollection interface (#164)
* Add FullPath() to interface

* Simple test for FullPath
2022-06-08 16:24:57 -04:00
Vaibhav Kamra
5dcb2b7579
Unit tests for config file helpers (#160)
Adds unit tests for the config file read/write helpers.

It also uncovered a bug in how viper handles writing a config file when a config file path is set
directly. This required a workaround in our init logic when we are using a custom config file name.

This commit does the following:
- Refactors the init logic into a InitConfig helper
- Adds a unit test to validate basic ReadRepoConfig behavior
- Adds a unit test that uses WriteReadConfig to write config and ReadRepoConfig to read it
2022-06-08 11:13:25 -07:00
Vaibhav Kamra
13ca33fae0
Implement ToReader for ExchangeData (#161) 2022-06-08 13:28:33 -04:00
ashmrtn
33e8e978ba
Use version of kopia with StreamingDirectory (#156)
* Use pseudo-version to pull fork of kopia

Directs to local fork of kopia that has support for
StreamingDirectories.
2022-06-08 09:49:10 -07:00
Niraj Tolia
301e7bd10e
Add minimal S3 configuration for Corso (#158) 2022-06-08 09:47:55 -07:00
Vaibhav Kamra
cbbd5ed0bb
Fix AWS access key override logic (#159) 2022-06-08 08:51:32 -06:00
Danny
ddc9cd2c25
Issue #144 Commit adds ability to add message id to errors (#151)
* Issue #144 Commit adds ability to add message id to errors
Commit related to Issue #140 to find cascading errors associated with
the failures GraphConnector queries.

* Issue 144: Update to go libraries to import multierror

* Reduced error package to include certain multierror interface.

* Issue #144: Added format interface for append. Added additional testing for multiple wrapping of error.
2022-06-08 08:59:59 -04:00
Vaibhav Kamra
ebae1ed037
Utility methods to write and read local config file (#149)
Adds rudimentary support for writing/reading a local config file.
2022-06-07 17:25:14 -07:00
Danny
ed1f444b89
133 implement exchangedatacollection populator (#139)
* Issue 133: Tests Failing.
Unable to troubleshoot the iteration error. Reflecting on an object that
is nil. Fundamentally, the code works in so far as the workflow. Initial
query finds the amount of emails, returns... This is where
DataCollection would be created, then the goroutine would have the
information it would need to run asynchronously.

* Issue #133: Populate DataCollection
Bug fix on NewPageIterator: Incorrect MailDiscriminatorValue.
DataCollection implemented. Brute force. However, this does not use the
populate method. The populate method to be added in the next step.

Test Suite: TestMailCount is an end-to-end test. Tests to see if the
amount of values in a mailbox are the amount of messages that are
retrieved. This is false at present. There are several errors from
ParseNodePackage: `unsupported AdditionalData type:
map[string]*jsonserialization.JsonParseNode`. Will have to determine how
errors are to be sent to the DataCollection. Issue #137. Upon
inspection, there are 59 messages on the test account. 7 of them receive
a parsing error and 2 are unaccounted for. Issue #138

* Issue #133: Collection passed into Serialize Message method.

* Issue #133: Changes for PR
Comments have been updated as requested. Additionally, input params have
been updated for clarity.

* Issue #133: Input structure for Options changed to string literal.

* Update src/internal/connector/graph_connector.go

Co-authored-by: Vaibhav Kamra <vkamra@alcion.ai>

* Update src/internal/connector/graph_connector.go

Co-authored-by: Vaibhav Kamra <vkamra@alcion.ai>

* Update src/internal/connector/graph_connector.go

Internal helper function populateCollection() removed as it was commented out anyway.

Co-authored-by: Vaibhav Kamra <vkamra@alcion.ai>

* Update src/internal/connector/graph_connector.go according to suggestion

Consolidate line 193 response.GetValue() into to for loop over folders

Co-authored-by: Vaibhav Kamra <vkamra@alcion.ai>

* Issue #133: Expected item removed
Expected Item can could change between the time that the DataCollection is created. Therefore, the channel will stay open until the object is filled. Definition updated.

* Issue #133: Updates made to graph_connector packages
- Test package updated to test private functions. Results in import
  changes and calls to package level items. All tests verified as
  operational prior to upload.
- GraphConnector removal of GetCount() for Mail objects.
  ExchangeDataCollection call updated in response to definition change.
  Small changes to call stack to remove troubleshooting stubs.

* Gofmt applied to exchange_data_collection.go

* Issue #133: Merge resolution
These changese resolves the issues with the merge that caused the testing to fail. Tests all passing and now merging back into trunk.

* PR Suggestion Get Length -> Length()

Co-authored-by: Vaibhav Kamra <vkamra@alcion.ai>
2022-06-07 16:04:47 -04:00
Keepers
21bf1d8b39
make consts camelCase (#153) 2022-06-07 11:44:14 -06:00
Keepers
b0fe422035
add pkg/credentials (#147)
credentials requriements surface in many places thorughout corso:
they can be sourced from many locations (envs, files, manually),
and used in many more (cli, repo, kopia).  This usage could blossom
into all kinds of duplicate structs sharing similar info.  The goal
of this change is to centralize where credentials are declared
and managed, and how they then cascade out to other packages.
2022-06-07 10:59:56 -06:00
Keepers
3be698eab9
return errors in cli handlers (#146)
* return errors in cli handlers

* return the wrapped errors
2022-06-07 09:15:00 -06:00
Vaibhav Kamra
dbb778c569
Initialize a config file for the CLI (#148)
Initialize a config file
2022-06-07 08:53:58 -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
d5d92e707d
add create and exchange backup commands (#145)
Adds the create subcommand for backups.  Adds the exchange
subcommand for backup creation.  Centralizes some
common code on top.
2022-06-06 16:33:04 -06:00
Keepers
39a9e0945d
add backup to operations (#132)
* add backup to operations

Extend the operations set with a backupOperation.  New backup
operations are created through an existing repository and, once
created, can be Run synchronously.

Integration tests have a skeleton, but the meat of them is on hold
while dependencies undergo implementation.

* remove operation progress
2022-06-06 14:11:54 -06:00
Keepers
8a9c1acc9e
add cli backup command (#142)
* add cli backup command

adds the `corso backup` command to the cli.  Currently
only displays the backup help.

* add backup to cli cmds, fix verbiage
2022-06-06 14:08:34 -06: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
Vaibhav Kamra
0aa0915adf
Add ExchangeData (#130)
This commit adds ExchangeData which represents a single item in an ExchangeDataCollection.
Also adds a placeholder for a data collection populator that will be implemented later
2022-06-03 15:44:54 -07:00
Keepers
6e71e44024
introduce operations (#114) (#122)
* introduce operations (#114)

Adds the /internal/operations package.  This is a starting point
which only includes the base operation struct and handling.
Per-process (backup/restore) operations to come at a later time.

* adding comments for clarity in op_progress
2022-06-03 15:50:13 -06:00
Vaibhav Kamra
936350b7b4
Embed io.Reader in DataStream (#127)
This allows callers to use DataStream as an io.Reader without the need to call ToReader()
2022-06-03 14:45:48 -07:00
Vaibhav Kamra
b29cedfb34
Introduce DataCollection and DataStream (#125)
This commit does the following:

- Renames DataStream to DataCollection since that describes better the interface
- Introduces DataStream as a streamable item within this collection
2022-06-03 14:44:23 -07:00
Vaibhav Kamra
c33ef8631b
ExchangeDataCollection placeholder (#123)
Introduces ExchangeDataCollection and a method on GraphConnector to instantiate one for a specified user

Refer to https://www.notion.so/alcion/GraphConnector-interfaces-eadd11a49542436cb611da0135dda7cb
2022-06-03 13:43:19 -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
Danny
01c275707a
GraphConnector initialization (#104)
* Issue #68: Updates to dependency files.

* Issue #68: Added GraphConnector module and test suite.

* Issue #68: ErrorList module and test added to package to support GraphConnector.

* Issue #68: Updates made to address comments.

* Issue #68: Added additonal comments to structs and corrected library changes.

* Issue #68: Added additonal comments to structs and corrected library changes.

* Issue #68: Updates made to package.

* Update errorList.go

Fix typo

* Issue #68: ErrorList struct removal required
The structure of the errorList is not required for the first
initialization of the GraphConnector. In the case that this structure or
addtional functionality needs to be added in the future, an issue will
be created.

* Issue #68: Simplification and structure change
The errorList has been changed to []errors. Additionally, the
credentials and authentication have been changed to inline. Provided
early exits for creating NewGraphConnectors. Note, adapter objects can
be created with strings that fail authentication. Reduced the amount of logs.

* Issue #68: Prepend
[errors](https://github.com/alcionai/corso/pull/104#discussion_r887268576)
This fixes the bug that identified in the PR.

* Update src/internal/connector/graphConnector.go

Adjustment for styling.

Co-authored-by: Keepers <104464746+ryanfkeepers@users.noreply.github.com>

* Update src/internal/connector/graphConnector_test.go

Issue #68: PR Resolution
Test environmental value changed to be consistent with the rest of the package.

Co-authored-by: Keepers <104464746+ryanfkeepers@users.noreply.github.com>

* Issue #68: Resolving Open Questions from reviewers
Prior to commit, Issue #116. Additionally, the entire error package was
requested to be removed from the component. GraphConnector tests are
preliminary set-up to investigate the Issue #116. The code will be
redacted after the new functionality is verified. Stashing for merge for
the changes from the reviewers.

* Issue #116: Bug fix. Response verified not to be nil prior to using it in next step.

* Issue #116: Added table structure to verify GraphConnector can handle being given an empty set of parameters.

* Issue #68: PR Changes
List of changes:
- Added check to ensure conversion of user object passed
- setTenant not exported
- TODO added user query during initialization
- Iteration flow adjusted for paging.

Co-authored-by: Keepers <104464746+ryanfkeepers@users.noreply.github.com>
2022-06-03 02:46:15 -04:00
ashmrtn
04d11503a9
Factor out helper functions for testing (#115)
Helper functions do simple validation and initialization for S3 storage
objects.
2022-06-02 16:57:13 -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
f368c596b5
add readme to corso/src (#101) (#102)
Additional documentation to help guide new developers through the
repository layout and design decisions backing that layout.
2022-06-01 12:05:26 -06:00