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

Changes for ut #29

Closed
wants to merge 1 commit into from
Closed

Changes for ut #29

wants to merge 1 commit into from

Conversation

ambiknai
Copy link
Member

UT coverage : 82.6% of statements

@ambiknai ambiknai linked an issue May 20, 2021 that may be closed by this pull request
@YiannisGkoufas YiannisGkoufas self-assigned this May 20, 2021
@ambiknai
Copy link
Member Author

  1. checkout the ut branch of this repo
  2. Run
    go test -v -coverprofile cover.out go list ./... | grep -v "functest"``
?   	github.com/IBM/satellite-object-storage-plugin/cmd	[no test files]
?   	github.com/IBM/satellite-object-storage-plugin/config	[no test files]
=== RUN   TestCreateVolumeArguments
    controllerserver_test.go:238: test case: Success default
I0615 10:05:31.997350   27164 controllerserver.go:108] CSIControllerServer-CreateVolume... | Request: {test-volume required_bytes:20971520  [mount:<fs_type:"ext2" > access_mode:<mode:MULTI_NODE_MULTI_WRITER > ] map[] map[access-key:xxx bucket-name:test-bucket cos-endpoint:test-endpoint location-constraint:test-region secret-key:yyy] <nil> <nil> {} [] 0}
I0615 10:05:31.998253   27164 controllerserver.go:132] Got a request to create volume: test-volume
CreateVolume Parameters:
	 map[]
CreateVolume Secrets:
	 map[access-key:xxx bucket-name:test-bucket cos-endpoint:test-endpoint location-constraint:test-region secret-key:yyy]
I0615 10:05:31.998286   27164 controllerserver.go:176] create volume: test-volume
    controllerserver_test.go:238: test case: Empty volume name
I0615 10:05:31.998337   27164 controllerserver.go:108] CSIControllerServer-CreateVolume... | Request: { required_bytes:20971520  [mount:<fs_type:"ext2" > access_mode:<mode:MULTI_NODE_MULTI_WRITER > ] map[] map[] <nil> <nil> {} [] 0}
    controllerserver_test.go:238: test case: Empty volume capabilities
I0615 10:05:31.998429   27164 controllerserver.go:108] CSIControllerServer-CreateVolume... | Request: {test-volume required_bytes:20971520  [] map[] map[] <nil> <nil> {} [] 0}
    controllerserver_test.go:238: test case: Not supported volume Capabilities
I0615 10:05:31.998463   27164 controllerserver.go:108] CSIControllerServer-CreateVolume... | Request: {test-volume required_bytes:20971520  [block:<> access_mode:<mode:MULTI_NODE_MULTI_WRITER > ] map[] map[] <nil> <nil> {} [] 0}
    controllerserver_test.go:238: test case: Requested capacity out of Range
I0615 10:05:31.998507   27164 controllerserver.go:108] CSIControllerServer-CreateVolume... | Request: {test-volume required_bytes:21474836480  [mount:<fs_type:"ext2" > access_mode:<mode:MULTI_NODE_MULTI_WRITER > ] map[] map[] <nil> <nil> {} [] 0}
    controllerserver_test.go:238: test case: Empty Secret Key
I0615 10:05:31.998586   27164 controllerserver.go:108] CSIControllerServer-CreateVolume... | Request: {test-volume required_bytes:20971520  [mount:<fs_type:"ext2" > access_mode:<mode:MULTI_NODE_MULTI_WRITER > ] map[] map[access-key:xxx bucket-name:test-bucket cos-endpoint:test-endpoint location-constraint:test-region secret-key:] <nil> <nil> {} [] 0}
I0615 10:05:31.998631   27164 controllerserver.go:132] Got a request to create volume: test-volume
CreateVolume Parameters:
	 map[]
CreateVolume Secrets:
	 map[access-key:xxx bucket-name:test-bucket cos-endpoint:test-endpoint location-constraint:test-region secret-key:]
    controllerserver_test.go:238: test case: Empty Bucket Name
I0615 10:05:31.998694   27164 controllerserver.go:108] CSIControllerServer-CreateVolume... | Request: {test-volume required_bytes:20971520  [mount:<fs_type:"ext2" > access_mode:<mode:MULTI_NODE_MULTI_WRITER > ] map[] map[access-key:xxx bucket-name: cos-endpoint:test-endpoint location-constraint:test-region secret-key:xxx] <nil> <nil> {} [] 0}
I0615 10:05:31.998736   27164 controllerserver.go:132] Got a request to create volume: test-volume
CreateVolume Parameters:
	 map[]
CreateVolume Secrets:
	 map[access-key:xxx bucket-name: cos-endpoint:test-endpoint location-constraint:test-region secret-key:xxx]
    controllerserver_test.go:238: test case: Empty Access Key
I0615 10:05:31.998782   27164 controllerserver.go:108] CSIControllerServer-CreateVolume... | Request: {test-volume required_bytes:20971520  [mount:<fs_type:"ext2" > access_mode:<mode:MULTI_NODE_MULTI_WRITER > ] map[] map[access-key: bucket-name:test-bucket cos-endpoint:test-endpoint location-constraint:test-region secret-key:xxx] <nil> <nil> {} [] 0}
I0615 10:05:31.998812   27164 controllerserver.go:132] Got a request to create volume: test-volume
CreateVolume Parameters:
	 map[]
CreateVolume Secrets:
	 map[access-key: bucket-name:test-bucket cos-endpoint:test-endpoint location-constraint:test-region secret-key:xxx]
--- PASS: TestCreateVolumeArguments (0.00s)
=== RUN   TestDeleteVolume
    controllerserver_test.go:346: test case: Success volume delete
I0615 10:05:31.998956   27164 controllerserver.go:190] CSIControllerServer-DeleteVolume... {testVolumeId map[access-key:xxx bucket-name:test-bucket cos-endpoint:test-endpoint location-constraint:test-region secret-key:xxx] {} [] 0}
I0615 10:05:31.999002   27164 controllerserver.go:196] Deleting volume testVolumeId
I0615 10:05:31.999007   27164 controllerserver.go:197] deleting volume testVolumeId
DeleteVolume Secrets:
	 map[access-key:xxx bucket-name:test-bucket cos-endpoint:test-endpoint location-constraint:test-region secret-key:xxx]
    controllerserver_test.go:346: test case: Failed volume delete with volume id empty
I0615 10:05:31.999050   27164 controllerserver.go:190] CSIControllerServer-DeleteVolume... { map[] {} [] 0}
    controllerserver_test.go:352: Error code
    controllerserver_test.go:346: test case: Failed lib volume delete failed
I0615 10:05:31.999086   27164 controllerserver.go:190] CSIControllerServer-DeleteVolume... { map[] {} [] 0}
    controllerserver_test.go:352: Error code
    controllerserver_test.go:346: test case: Empty bucket name
I0615 10:05:31.999148   27164 controllerserver.go:190] CSIControllerServer-DeleteVolume... {testVolumeId map[access-key:xxx bucket-name: cos-endpoint:test-endpoint location-constraint:test-region secret-key:xxx] {} [] 0}
I0615 10:05:31.999160   27164 controllerserver.go:196] Deleting volume testVolumeId
I0615 10:05:31.999165   27164 controllerserver.go:197] deleting volume testVolumeId
DeleteVolume Secrets:
	 map[access-key:xxx bucket-name: cos-endpoint:test-endpoint location-constraint:test-region secret-key:xxx]
    controllerserver_test.go:346: test case: Empty service instance id
I0615 10:05:31.999193   27164 controllerserver.go:190] CSIControllerServer-DeleteVolume... {testVolumeId map[api-key:xxx bucket-name: cos-endpoint:test-endpoint location-constraint:test-region s-id:] {} [] 0}
I0615 10:05:31.999203   27164 controllerserver.go:196] Deleting volume testVolumeId
I0615 10:05:31.999207   27164 controllerserver.go:197] deleting volume testVolumeId
DeleteVolume Secrets:
	 map[api-key:xxx bucket-name: cos-endpoint:test-endpoint location-constraint:test-region s-id:]
    controllerserver_test.go:352: Error code
--- PASS: TestDeleteVolume (0.00s)
=== RUN   TestControllerPublishVolume
    controllerserver_test.go:377: test case: Success attachment
I0615 10:05:31.999327   27164 controllerserver.go:307] CSIControllerServer-ControllerPublishVolume | Request: {volumeid nodeid <nil> false map[] map[] {} [] 0}
--- PASS: TestControllerPublishVolume (0.00s)
=== RUN   TestControllerUnpublishVolume
    controllerserver_test.go:408: test case: Success detach volume
I0615 10:05:31.999453   27164 controllerserver.go:313] CSIControllerServer-ControllerUnPublishVolume | Request: {volumeid nodeid map[] {} [] 0}
--- PASS: TestControllerUnpublishVolume (0.00s)
=== RUN   TestValidateVolumeCapabilities
    controllerserver_test.go:458: test case: Success validate volume capabilities
    controllerserver_test.go:458: test case: Empty volume capabilities
    controllerserver_test.go:464: Error code
    controllerserver_test.go:458: test case: Empty volume ID
    controllerserver_test.go:464: Error code
--- PASS: TestValidateVolumeCapabilities (0.00s)
=== RUN   TestCreateSnapshot
    controllerserver_test.go:489: test case: Success create snapshot
--- PASS: TestCreateSnapshot (0.00s)
=== RUN   TestDeleteSnapshot
    controllerserver_test.go:520: test case: Success delete snapshot
--- PASS: TestDeleteSnapshot (0.00s)
=== RUN   TestListSnapshots
    controllerserver_test.go:551: test case: Success list snapshots
--- PASS: TestListSnapshots (0.00s)
=== RUN   TestControllerExpandVolume
    controllerserver_test.go:582: test case: Success controller expand volume
--- PASS: TestControllerExpandVolume (0.00s)
=== RUN   TestListVolumes
    controllerserver_test.go:613: test case: Success list volumes
--- PASS: TestListVolumes (0.00s)
=== RUN   TestGetCapacity
    controllerserver_test.go:645: test case: Success GetCapacity
--- PASS: TestGetCapacity (0.00s)
=== RUN   TestControllerGetCapabilities
    controllerserver_test.go:681: test case: Success controller get capabilities
--- PASS: TestControllerGetCapabilities (0.00s)
=== RUN   TestGetPluginInfo
I0615 10:05:32.000170   27164 identityserver.go:32] identityServer-GetPluginInfo... | Request: {{} [] 0}
I0615 10:05:32.000199   27164 identityserver.go:32] identityServer-GetPluginInfo... | Request: {{} [] 0}
--- PASS: TestGetPluginInfo (0.00s)
=== RUN   TestGetPluginCapabilities
I0615 10:05:32.000245   27164 identityserver.go:45] identityServer-GetPluginCapabilities...| Request {{} [] 0}
--- PASS: TestGetPluginCapabilities (0.00s)
=== RUN   TestProbe
I0615 10:05:32.000289   27164 identityserver.go:75] identityServer-Probe... Request {{} [] 0}
--- PASS: TestProbe (0.00s)
=== RUN   TestNodePublishVolume
    nodeserver_test.go:113: Test case: Valid request
I0615 10:05:32.000350   27164 nodeserver.go:55] CSINodeServer-NodePublishVolume...| Request {csiprovidervolumeid map[] /staging /mnt/test mount:<fs_type:"ext2" > access_mode:<mode:MULTI_NODE_MULTI_WRITER >  false map[] map[] {} [] 0}
I0615 10:05:32.028632   27164 nodeserver.go:100] target /mnt/test
device 
readonly false
volumeId csiprovidervolumeid
attributes map[]
mountflags []
CreateVolume VolumeContext:
	 map[]
CreateVolume Secrets:
	 map[]
I0615 10:05:32.028734   27164 nodeserver.go:124] -NodePublishVolume-: Mount
I0615 10:05:32.028750   27164 nodeserver.go:130] s3: bucket  successfuly mounted to /mnt/test
    nodeserver_test.go:113: Test case: Empty volume ID
I0615 10:05:32.028786   27164 nodeserver.go:55] CSINodeServer-NodePublishVolume...| Request { map[] /staging /mnt/test mount:<fs_type:"ext2" > access_mode:<mode:MULTI_NODE_MULTI_WRITER >  false map[] map[] {} [] 0}
    nodeserver_test.go:113: Test case: Empty staging target path
I0615 10:05:32.028882   27164 nodeserver.go:55] CSINodeServer-NodePublishVolume...| Request {testvolumeid map[]  /mnt/test mount:<fs_type:"ext2" > access_mode:<mode:MULTI_NODE_MULTI_WRITER >  false map[] map[] {} [] 0}
    nodeserver_test.go:113: Test case: Empty target path
I0615 10:05:32.028942   27164 nodeserver.go:55] CSINodeServer-NodePublishVolume...| Request {testvolumeid map[] /mnt/test  mount:<fs_type:"ext2" > access_mode:<mode:MULTI_NODE_MULTI_WRITER >  false map[] map[] {} [] 0}
    nodeserver_test.go:113: Test case: Empty volume capabilities
I0615 10:05:32.028991   27164 nodeserver.go:55] CSINodeServer-NodePublishVolume...| Request {testvolumeid map[] /staging /mnt/test <nil> false map[] map[] {} [] 0}
--- PASS: TestNodePublishVolume (0.03s)
=== RUN   TestNodeUnpublishVolume
    nodeserver_test.go:167: Test case: Valid request
I0615 10:05:32.029170   27164 nodeserver.go:135] CSINodeServer-NodeUnpublishVolume...| Request: {csiprovidervolumeid /mnt/test {} [] 0}
I0615 10:05:32.029192   27164 nodeserver.go:149] Unmounting  target path /mnt/test
I0615 10:05:32.029202   27164 nodeserver.go:154] Successfully unmounted  target path /mnt/test
    nodeserver_test.go:167: Test case: Empty volume ID
I0615 10:05:32.029223   27164 nodeserver.go:135] CSINodeServer-NodeUnpublishVolume...| Request: { /mnt/test {} [] 0}
    nodeserver_test.go:167: Test case: Empty target path
I0615 10:05:32.029249   27164 nodeserver.go:135] CSINodeServer-NodeUnpublishVolume...| Request: {csiprovidervolumeid  {} [] 0}
--- PASS: TestNodeUnpublishVolume (0.00s)
=== RUN   TestNodeStageVolume
    nodeserver_test.go:232: Test case: Valid request
I0615 10:05:32.029363   27164 nodeserver.go:160] CSINodeServer-NodeStageVolume... | Request {newstagevolumeID map[] /staging mount:<fs_type:"ext2" > access_mode:<mode:MULTI_NODE_MULTI_WRITER >  map[] map[] {} [] 0}
    nodeserver_test.go:232: Test case: Empty volume ID
I0615 10:05:32.029493   27164 nodeserver.go:160] CSINodeServer-NodeStageVolume... | Request { map[] /staging mount:<fs_type:"ext2" > access_mode:<mode:MULTI_NODE_MULTI_WRITER >  map[] map[] {} [] 0}
    nodeserver_test.go:232: Test case: Empty Stage target path
I0615 10:05:32.029558   27164 nodeserver.go:160] CSINodeServer-NodeStageVolume... | Request {newstagevolumeID map[]  mount:<fs_type:"ext2" > access_mode:<mode:MULTI_NODE_MULTI_WRITER >  map[] map[] {} [] 0}
    nodeserver_test.go:232: Test case: Empty volume capabilities
I0615 10:05:32.029626   27164 nodeserver.go:160] CSINodeServer-NodeStageVolume... | Request {newstagevolumeID map[] /mnt/test <nil> map[] map[] {} [] 0}
--- PASS: TestNodeStageVolume (0.00s)
=== RUN   TestNodeUnstageVolume
    nodeserver_test.go:284: Test case: Valid request
I0615 10:05:32.029775   27164 nodeserver.go:199] Unmounting staging target path /mnt/test
    nodeserver_test.go:284: Test case: Empty volume ID
    nodeserver_test.go:284: Test case: Empty target path
--- PASS: TestNodeUnstageVolume (0.00s)
=== RUN   TestNodeGetCapabilities
--- PASS: TestNodeGetCapabilities (0.00s)
=== RUN   TestNodeExpandVolume
--- PASS: TestNodeExpandVolume (0.00s)
=== RUN   TestNodeUnpublishVolumeUnMountFail
    nodeserver_test.go:337: Test case: Unmount failure
I0615 10:05:32.030193   27164 nodeserver.go:135] CSINodeServer-NodeUnpublishVolume...| Request: {csiprovidervolumeid /staging {} [] 0}
I0615 10:05:32.030203   27164 nodeserver.go:149] Unmounting  target path /staging
--- PASS: TestNodeUnpublishVolumeUnMountFail (0.00s)
=== RUN   TestNodePublishVolumeCheckMountFail
    nodeserver_test.go:376: Test case: checkMount failure
I0615 10:05:32.030258   27164 nodeserver.go:55] CSINodeServer-NodePublishVolume...| Request {csiprovidervolumeid map[] /staging /mnt/test mount:<fs_type:"ext2" > access_mode:<mode:MULTI_NODE_MULTI_WRITER >  false map[] map[] {} [] 0}
E0615 10:05:32.030310   27164 nodeserver.go:84] Can not validate target mount point: /mnt/test 
--- PASS: TestNodePublishVolumeCheckMountFail (0.00s)
=== RUN   TestNodePublishVolumeCheckMountIsNotMountFail
    nodeserver_test.go:415: Test case: checkMount failure - not a mount point
I0615 10:05:32.030387   27164 nodeserver.go:55] CSINodeServer-NodePublishVolume...| Request {csiprovidervolumeid map[] /staging /mnt/test mount:<fs_type:"ext2" > access_mode:<mode:MULTI_NODE_MULTI_WRITER >  false map[] map[] {} [] 0}
--- PASS: TestNodePublishVolumeCheckMountIsNotMountFail (0.00s)
=== RUN   TestSetups3Driver
--- PASS: TestSetups3Driver (0.00s)
=== RUN   TestSetup
    server_test.go:38: Good setup
    server_test.go:50: Wrong endpoint format
    server_test.go:55: ---------> error parse "---:/tmp/testcsi.sock": first path segment in URL cannot contain colon
    server_test.go:59: Wrong Scheme
    server_test.go:63: ---------> error Endpoint scheme not supported
    server_test.go:67: tcp Scheme
    server_test.go:71: ---------> error <nil>
    server_test.go:76: Wrong address
    server_test.go:80: ---------> error <nil>
--- PASS: TestSetup (0.00s)
=== RUN   TestLogGRPC
    server_test.go:85: TODO:~ TestLogGRPC
--- PASS: TestLogGRPC (0.00s)
PASS
coverage: 82.6% of statements
ok  	github.com/IBM/satellite-object-storage-plugin/pkg/driver	0.180s	coverage: 82.6% of statements
?   	github.com/IBM/satellite-object-storage-plugin/pkg/driver/fake/mounter	[no test files]
?   	github.com/IBM/satellite-object-storage-plugin/pkg/driver/fake/s3client	[no test files]
?   	github.com/IBM/satellite-object-storage-plugin/pkg/mounter	[no test files]
?   	github.com/IBM/satellite-object-storage-plugin/pkg/s3client	[no test files]

@ambiknai ambiknai closed this Mar 17, 2023
@ambiknai ambiknai deleted the ut branch March 7, 2024 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write basic UT for the code
2 participants