Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an E2E test framework to test Velero across cloud platforms #3060

Merged
merged 13 commits into from Nov 24, 2020

Conversation

dsu-igeek
Copy link
Contributor

Uses distributed data generator

Signed-off-by: Dave Smith-Uchida dsmithuchida@vmware.com

Uses distributed data generator

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>
@dsu-igeek dsu-igeek changed the title Basic end-to-end tests, generate data/backup/remove/restore/verify WIP - Basic end-to-end tests, generate data/backup/remove/restore/verify Nov 9, 2020
@carlisia carlisia marked this pull request as draft November 10, 2020 00:30
dsu-igeek and others added 7 commits November 9, 2020 21:35
…restore

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>
Signed-off-by: Ashish Amarnath <ashisham@vmware.com>
Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>
Signed-off-by: Ashish Amarnath <ashisham@vmware.com>
…elero into e2e-tests-10-05-2020

# Conflicts:
#	test/e2e/backup_test.go
Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>
Signed-off-by: Ashish Amarnath <ashisham@vmware.com>
@ashish-amarnath ashish-amarnath changed the title WIP - Basic end-to-end tests, generate data/backup/remove/restore/verify Add an E2E test framework to test Velero across cloud platforms Nov 13, 2020
@ashish-amarnath
Copy link
Contributor

Marking this as ready for review.

@ashish-amarnath ashish-amarnath marked this pull request as ready for review November 13, 2020 02:13
Copy link
Contributor

@ashish-amarnath ashish-amarnath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving my own changes.

@ashish-amarnath ashish-amarnath added this to the v1.6.0 milestone Nov 13, 2020
@ashish-amarnath ashish-amarnath added this to In progress in v1.6.0 via automation Nov 13, 2020
@ashish-amarnath ashish-amarnath moved this from In progress to Review in progress in v1.6.0 Nov 13, 2020
go.mod Outdated Show resolved Hide resolved
test/e2e/Makefile Outdated Show resolved Hide resolved
test/e2e/README.md Outdated Show resolved Hide resolved
ashish-amarnath and others added 2 commits November 19, 2020 16:02
…elero into e2e-tests-10-05-2020

# Conflicts:
#	.gitignore
#	test/e2e/Makefile
#	test/e2e/README.md
#	test/e2e/backup_test.go
#	test/e2e/common.go
…e GOPATH/bin

Updated to ginkgo 1.14.2
Put cobra back to v0.0.7

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>
Copy link
Contributor

@ashish-amarnath ashish-amarnath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a couple of minor and non-blocking comments. But overall LGTM.

.gitignore Outdated Show resolved Hide resolved
test/e2e/Makefile Show resolved Hide resolved
…d ginkgo from .gitignore

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>
Signed-off-by: Ashish Amarnath <ashisham@vmware.com>
Copy link
Contributor

@ashish-amarnath ashish-amarnath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though there is still work to be done here we should get this merged as it adds a foundation to add more tests and making this slightly more robust.

I am already working on a PR to build on top of this and improving things.

@nrb @carlisia @zubron Let's get this merged.

Copy link
Contributor

@zubron zubron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your efforts on this, @dsu-igeek and @ashish-amarnath! I've left some comments but they are all mostly cosmetic things that I think would just make the code a bit easier to read and the results easier to interpret. They aren't blocking, just things that would be good to address in further changes :)

I agree with @ashish-amarnath, I think it's fine to merge and iterate on 👍

stdoutReader := bufio.NewReader(stdoutPipe)
var readErr error
for true {
buf, isPrefix, err := stdoutReader.ReadLine()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs for ReadLine recommend most users to use ReadString or use a Scanner. I think we could use a Scanner here and it would simplify this loop (we wouldn't need to check the isPrefix value for example). Same applies for the loop in VerifyData below.

}

func CreateNamespace(ctx context.Context, namespace string) error {
// TODO - should we talk directly to the API server?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be my preference. It can be a bit of a pain setting up a client, but I think it's clearer than setting up and running external commands when we don't need to. It might make the error handling easier to manage. For example, I tried running this locally and the test failed the first time. On subsequent runs, the kibishii namespace already existed so this returned an error, however there wasn't any useful information along with it, it only printed an *exec.ExitError.

return err
}

jsonBuf := make([]byte, 16*1024) // If the YAML is bigger than 16K, there's probably something bad happening
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than creating the slice with a size, we could use a bytes.Buffer here. You can also set the buffer to be Stdout writer on the command directly, rather than needing to get the StdoutPipe and then read into the created slice. Here's an example from the exec.Command docs: https://play.golang.org/p/eGFQtL39Qve

Expect(err).NotTo(HaveOccurred())
backupName = "backup-" + backupUUID.String()
restoreName = "restore-" + backupUUID.String()
println("backupName = " + backupName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure this will be changed in later commits, but just a general comment that we should use the fmt package rather than builtins.

println("running kibishii generate")
timeoutCTX, _ = context.WithTimeout(context.Background(), time.Minute*60)

err = GenerateData(timeoutCTX, kibishiNamespace, 2, 10, 10, 1024, 1024, 0, 2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nice to wrap the arguments that are needed for kibishii into a struct so that it's a bit clearer what each of these integers represent.

v1.6.0 automation moved this from Review in progress to Reviewer approved Nov 24, 2020
@zubron zubron merged commit aa47309 into vmware-tanzu:main Nov 24, 2020
v1.6.0 automation moved this from Reviewer approved to Done Nov 24, 2020
georgettica pushed a commit to georgettica/velero that referenced this pull request Dec 23, 2020
…re-tanzu#3060)

* Basic end-to-end tests, generate data/backup/remove/restore/verify
Uses distributed data generator

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Moved backup/restore into velero_utils, started using a name for the restore

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* remove checked in binary and update test/e2e Makefile

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

* Ran make update

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Save

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

* Ran make update

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Basic end-to-end test, generate data/backup/remove/restore/verify
Uses distributed data generator

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Changed tests/e2e Makefile to just use go get to install ginkgo in the GOPATH/bin
Updated to ginkgo 1.14.2
Put cobra back to v0.0.7

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Added CLOUD_PLATFORM env variable to Makefile, updated README, removed ginkgo from .gitignore

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* choose velero CLI binary based on local env

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

Co-authored-by: Ashish Amarnath <ashisham@vmware.com>
georgettica pushed a commit to georgettica/velero that referenced this pull request Jan 26, 2021
…re-tanzu#3060)

* Basic end-to-end tests, generate data/backup/remove/restore/verify
Uses distributed data generator

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Moved backup/restore into velero_utils, started using a name for the restore

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* remove checked in binary and update test/e2e Makefile

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

* Ran make update

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Save

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

* Ran make update

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Basic end-to-end test, generate data/backup/remove/restore/verify
Uses distributed data generator

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Changed tests/e2e Makefile to just use go get to install ginkgo in the GOPATH/bin
Updated to ginkgo 1.14.2
Put cobra back to v0.0.7

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Added CLOUD_PLATFORM env variable to Makefile, updated README, removed ginkgo from .gitignore

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* choose velero CLI binary based on local env

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

Co-authored-by: Ashish Amarnath <ashisham@vmware.com>
vadasambar pushed a commit to vadasambar/velero that referenced this pull request Feb 3, 2021
…re-tanzu#3060)

* Basic end-to-end tests, generate data/backup/remove/restore/verify
Uses distributed data generator

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Moved backup/restore into velero_utils, started using a name for the restore

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* remove checked in binary and update test/e2e Makefile

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

* Ran make update

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Save

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

* Ran make update

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Basic end-to-end test, generate data/backup/remove/restore/verify
Uses distributed data generator

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Changed tests/e2e Makefile to just use go get to install ginkgo in the GOPATH/bin
Updated to ginkgo 1.14.2
Put cobra back to v0.0.7

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Added CLOUD_PLATFORM env variable to Makefile, updated README, removed ginkgo from .gitignore

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* choose velero CLI binary based on local env

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

Co-authored-by: Ashish Amarnath <ashisham@vmware.com>
dharmab pushed a commit to dharmab/velero that referenced this pull request May 25, 2021
…re-tanzu#3060)

* Basic end-to-end tests, generate data/backup/remove/restore/verify
Uses distributed data generator

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Moved backup/restore into velero_utils, started using a name for the restore

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* remove checked in binary and update test/e2e Makefile

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

* Ran make update

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Save

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

* Ran make update

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Basic end-to-end test, generate data/backup/remove/restore/verify
Uses distributed data generator

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Changed tests/e2e Makefile to just use go get to install ginkgo in the GOPATH/bin
Updated to ginkgo 1.14.2
Put cobra back to v0.0.7

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Added CLOUD_PLATFORM env variable to Makefile, updated README, removed ginkgo from .gitignore

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* choose velero CLI binary based on local env

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

Co-authored-by: Ashish Amarnath <ashisham@vmware.com>
ywk253100 pushed a commit to ywk253100/velero that referenced this pull request Jun 29, 2021
…re-tanzu#3060)

* Basic end-to-end tests, generate data/backup/remove/restore/verify
Uses distributed data generator

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Moved backup/restore into velero_utils, started using a name for the restore

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* remove checked in binary and update test/e2e Makefile

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

* Ran make update

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Save

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

* Ran make update

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Basic end-to-end test, generate data/backup/remove/restore/verify
Uses distributed data generator

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Changed tests/e2e Makefile to just use go get to install ginkgo in the GOPATH/bin
Updated to ginkgo 1.14.2
Put cobra back to v0.0.7

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Added CLOUD_PLATFORM env variable to Makefile, updated README, removed ginkgo from .gitignore

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* choose velero CLI binary based on local env

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

Co-authored-by: Ashish Amarnath <ashisham@vmware.com>
@dsu-igeek dsu-igeek deleted the e2e-tests-10-05-2020 branch March 18, 2022 22:04
gyaozhou pushed a commit to gyaozhou/velero-read that referenced this pull request May 14, 2022
…re-tanzu#3060)

* Basic end-to-end tests, generate data/backup/remove/restore/verify
Uses distributed data generator

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Moved backup/restore into velero_utils, started using a name for the restore

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* remove checked in binary and update test/e2e Makefile

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

* Ran make update

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Save

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

* Ran make update

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Basic end-to-end test, generate data/backup/remove/restore/verify
Uses distributed data generator

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Changed tests/e2e Makefile to just use go get to install ginkgo in the GOPATH/bin
Updated to ginkgo 1.14.2
Put cobra back to v0.0.7

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Added CLOUD_PLATFORM env variable to Makefile, updated README, removed ginkgo from .gitignore

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* choose velero CLI binary based on local env

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

Co-authored-by: Ashish Amarnath <ashisham@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
v1.6.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants