Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Add test #794: make sure volume creation is successful #863

Merged

Conversation

shuklanirdesh82
Copy link
Contributor

@shuklanirdesh82 shuklanirdesh82 commented Jan 13, 2017

This PR is going to add test case for #794. Please refer #794 for the automated steps.

In this PR:

  • New testcase added
  • Added a common library routines for test step verification
  • correcting the bug in one of the test util while creating volume with timestamp
  • deleting the sample testcase (no longer needed)

Testing done: yes

nshukla-mbp:docker-volume-vsphere nshukla$ make e2e-test 
/Library/Developer/CommandLineTools/usr/bin/make --directory=vmdk_plugin e2e-test

=> Running target e2e-test Thu Jan 12 19:13:24 PST 2017

../misc/scripts/build.sh e2e-dkrVolDriver-test "10.20.105.97" "10.20.105.77" "10.20.105.89"
make: Entering directory `/go/src/github.com/vmware/docker-volume-vsphere/vmdk_plugin'

=> Running target e2e-dkrVolDriver-test Fri Jan 13 03:13:25 UTC 2017

GO15VENDOREXPERIMENT=1 go test github.com/vmware/docker-volume-vsphere/vmdk_plugin/E2E_Tests -cover -v
=== RUN   TestVolumeCreationFristTime

creating volume [abc_1484277205] on VM[10.20.105.89]
Successfully created volume abc_1484277205 on 10.20.105.89

destroying volume [abc_1484277205]
volume deletion successful for [abc_1484277205
]--- PASS: TestVolumeCreationFristTime (7.64s)
	createVolume_pvscsiAutoAddCheck_test.go:46: Testcase passed...successfully able to create volume [abc_1484277205
		]
PASS

@@ -0,0 +1,53 @@
// This test is going to create volume on the fresh testbed very first time.
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy the license

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure I will add that part to all newly added files.

@shuklanirdesh82 shuklanirdesh82 changed the title Add test #794: make sure volume creation is successful and pvscsi is added automatically Add test #794: make sure volume creation is successful Jan 17, 2017

// This helper method is going to create vsphere docker volume with
// defaults and verifies as well
func CreateDefaultVolumeAndVerify (ip string, name string) ([]byte, error, bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Other than logging what is the verification done here? Why are there 2 methods that only differ in logging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

one of the method simply creates volume and returns control to testcase to process error whether fails the testcase or ignores the error occurred while executing request.

CreateDefaultVolumeAndVerify processed the err field and on that basis it returns bool for testcase to proceed further.

…d automatically

Add test: make sure volume creation is successful and pvscsci is added automatically

Add test: make sure volume creation is successful and pvscsci is added automatically

improving logging statement

restarting CI run

kicking CI run again

changing the order of test target execution

Addressing Ritesh's comment: copying licence

Removing references of PVSCSI (addressing Ritesh's comment)

Removing unused helper method and simplified test code (Addressing Ritesh's comment)

Simplifying delete method

fmt.Printf("\ncreating volume [%s] on VM[%s]", name, ip)

return exec.Command("/usr/bin/ssh", strings.Split(os.Getenv("SSH_KEY_OPT"), " ")[0], strings.Split(os.Getenv("SSH_KEY_OPT"), " ")[1], "-q", "-kTax", "-o StrictHostKeyChecking=no", "root@"+ip, "docker volume create --driver=vmdk --name="+name).CombinedOutput()
Copy link
Contributor

Choose a reason for hiding this comment

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

Going forward can you define the params to SSH so that they can be reused. You can do this in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I will address this comment in the separate PR.

Thanks for the review!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Proposing the code change with #872

@shuklanirdesh82 shuklanirdesh82 merged commit 0a97c65 into vmware-archive:master Jan 20, 2017
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants