Skip to content

bdd(volume-event-controller): add sanity test to verify volume-event-exporter exported data#2

Merged
mynktl merged 6 commits intomayadata-io:developfrom
mittachaitu:integration_test_sanity_test
Aug 31, 2021
Merged

bdd(volume-event-controller): add sanity test to verify volume-event-exporter exported data#2
mynktl merged 6 commits intomayadata-io:developfrom
mittachaitu:integration_test_sanity_test

Conversation

@mittachaitu
Copy link
Copy Markdown

@mittachaitu mittachaitu commented Aug 23, 2021

What This PR does?
This PR adds a sanity test to verify volume-event-exporter behavior
during NFS PVC creates and deletes events. When volume-event-exporter
sends events to the server, event server will add annotation of NFS PVC
namespace & name, NFS PV, backend PVC namespace & name, backend PV name
on backend PVC during create & delete event. Later those annotations
will be verified by an integration test.

Note:

  • To run the integration test clone the repository and run make sanity-test.
  • Integration test will start REST server and stop the server when test ends.

Note to reviewers:

@mittachaitu mittachaitu requested review from kmova and mynktl August 23, 2021 10:27
@mittachaitu mittachaitu force-pushed the integration_test_sanity_test branch from 36192cc to 2bad78d Compare August 24, 2021 11:38
mittachaitu added 5 commits August 25, 2021 12:33
…exporter exported data

This PR add sanity test to verify volume-event-exporter behaviour
during NFS PVC create and delete events. When volume-event-exporter
sends events to server, event server will add annotation of NFS PVC
namespace & name, NFS PV, backend PVC namespace & name, backend PV name
on backend PVC during create & delete event. Later those annotations
will be verified by integration test.

Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
…ctions

Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
@mittachaitu mittachaitu force-pushed the integration_test_sanity_test branch from 2bad78d to 5b7b443 Compare August 25, 2021 07:05
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Aug 25, 2021

Codecov Report

Merging #2 (577de32) into develop (8c47658) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop       #2   +/-   ##
========================================
  Coverage    26.64%   26.64%           
========================================
  Files            5        5           
  Lines          334      334           
========================================
  Hits            89       89           
  Misses         235      235           
  Partials        10       10           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c47658...577de32. Read the comment docs.

}

// isAuthorized is a token based authentication check that client should pass the token in request Header
func (s *service) isAuthorized(endpointHandler func(http.ResponseWriter, *http.Request)) http.Handler {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

here comment is confusing. isAuthorized is returning a function handler instead of processing it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated the comments PTAL

Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
@mittachaitu mittachaitu requested a review from mynktl August 30, 2021 11:48
@mittachaitu
Copy link
Copy Markdown
Author

Update:
Locally built image from 93 and ran sanity-test, below are the results by removing work-around code in tests package:

ginkgo -v 
Running Suite: Test application deployment
==========================================
Random Seed: 1630325593
Will run 7 of 7 specs

STEP: waiting for openebs-nfs-provisioner pod to come into running state
Waiting for deployment rollout to finish: 0 out of 1 new replicas have been updated
Waiting for deployment rollout to finish: 0 out of 1 new replicas have been updated
Waiting for deployment rollout to finish: 0 out of 1 new replicas have been updated
Waiting for deployment rollout to finish: 0 out of 1 new replicas have been updated
Waiting for deployment rollout to finish: 0 out of 1 new replicas have been updated
Waiting for deployment rollout to finish: 0 out of 1 new replicas have been updated
Waiting for deployment rollout to finish: 0 out of 1 new replicas have been updated
Waiting for deployment rollout to finish: 0 out of 1 new replicas have been updated
Waiting for deployment rollout to finish: 0 out of 1 new replicas have been updated
Waiting for deployment rollout to finish: 0 out of 1 new replicas have been updated
Waiting for deployment rollout to finish: 0 out of 1 new replicas have been updated
Waiting for deployment rollout to finish: 0 out of 1 new replicas have been updated
Waiting for deployment rollout to finish: 0 out of 1 new replicas have been updated
Waiting for deployment rollout to finish: 0 out of 1 new replicas have been updated
Waiting for deployment rollout to finish: 0 out of 1 new replicas have been updated
Waiting for deployment rollout to finish: 0 out of 1 new replicas have been updated
Waiting for deployment rollout to finish: 0 out of 1 new replicas have been updated
Waiting for deployment rollout to finish: 0 out of 1 new replicas have been updated
Waiting for deployment rollout to finish: 0 of 1 updated replicas are available
STEP: building a namespace
TEST NFS PVC CREATE & DELTE EVENTS when pvc with storageclass openebs-rwx is created 
  should create a pvc 
  /home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:50
STEP: creating above pvc
waiting for PVC {sanity-event-nfs-pvc} in namespace {event-exporter-tests-ns} to get into bound state
waiting for PVC {sanity-event-nfs-pvc} in namespace {event-exporter-tests-ns} to get into bound state
waiting for PVC {sanity-event-nfs-pvc} in namespace {event-exporter-tests-ns} to get into bound state
waiting for PVC {sanity-event-nfs-pvc} in namespace {event-exporter-tests-ns} to get into bound state
waiting for PVC {sanity-event-nfs-pvc} in namespace {event-exporter-tests-ns} to get into bound state
waiting for PVC {sanity-event-nfs-pvc} in namespace {event-exporter-tests-ns} to get into bound state
waiting for PVC {sanity-event-nfs-pvc} in namespace {event-exporter-tests-ns} to get into bound state
waiting for PVC {sanity-event-nfs-pvc} in namespace {event-exporter-tests-ns} to get into bound state
I0830 17:44:33.289934  157571 service.go:84] Received event handler event to process data
I0830 17:44:33.331928  157571 nfs_data.go:132] Addedd annotations map[it.nfs.openebs.io/vc-backend-pv:pvc-1c91b283-dcc6-4e16-9d30-e2da944c697a it.nfs.openebs.io/vc-backend-pvc:openebs-nfs-pvc-755e8db0-626e-4e7e-a77d-8b148b8e8c8f it.nfs.openebs.io/vc-nfspv:pvc-755e8db0-626e-4e7e-a77d-8b148b8e8c8f it.nfs.openebs.io/vc-nfspvc:event-exporter-tests-ns-sanity-event-nfs-pvc] on backend pvc openebs/nfs-pvc-755e8db0-626e-4e7e-a77d-8b148b8e8c8f for create event

• [SLOW TEST:41.439 seconds]
TEST NFS PVC CREATE & DELTE EVENTS
/home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:32
  when pvc with storageclass openebs-rwx is created
  /home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:49
    should create a pvc 
    /home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:50
------------------------------
TEST NFS PVC CREATE & DELTE EVENTS when pvc gets into bounded state 
  should have NFS server in running state
  /home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:80

• [SLOW TEST:10.076 seconds]
TEST NFS PVC CREATE & DELTE EVENTS
/home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:32
  when pvc gets into bounded state
  /home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:79
    should have NFS server in running state
    /home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:80
------------------------------
TEST NFS PVC CREATE & DELTE EVENTS when pvc gets into bounded state 
  should have sent details to server... verify annotation of backing PVC
  /home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:92
•
------------------------------
TEST NFS PVC CREATE & DELTE EVENTS when pvc is deleted 
  should delete pvc
  /home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:122
•
------------------------------
TEST NFS PVC CREATE & DELTE EVENTS when pvc is deleted 
  should send events to server
  /home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:127
I0830 17:44:46.904095  157571 service.go:84] Received event handler event to process data
I0830 17:44:46.931790  157571 nfs_data.go:183] Addedd annotations map[it.nfs.openebs.io/vd-backend-pv:pvc-1c91b283-dcc6-4e16-9d30-e2da944c697a it.nfs.openebs.io/vd-backend-pvc:openebs-nfs-pvc-755e8db0-626e-4e7e-a77d-8b148b8e8c8f it.nfs.openebs.io/vd-nfspv:pvc-755e8db0-626e-4e7e-a77d-8b148b8e8c8f] on backend pvc openebs/nfs-pvc-755e8db0-626e-4e7e-a77d-8b148b8e8c8f for create event

• [SLOW TEST:10.277 seconds]
TEST NFS PVC CREATE & DELTE EVENTS
/home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:32
  when pvc is deleted
  /home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:121
    should send events to server
    /home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:127
------------------------------
TEST NFS PVC CREATE & DELTE EVENTS when test event finalizers are removed on resource 
  should get removed
  /home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:152
•
------------------------------
TEST NFS PVC CREATE & DELTE EVENTS when test event finalizers are removed on resource 
  should get deleted from cluster
  /home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:162

• [SLOW TEST:20.503 seconds]
TEST NFS PVC CREATE & DELTE EVENTS
/home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:32
  when test event finalizers are removed on resource
  /home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:151
    should get deleted from cluster
    /home/sai/gocode/src/github.com/mayadata-io/volume-events-exporter/tests/nfs_sanity_test.go:162
------------------------------
STEP: deleting namespace
W0830 17:45:15.837848  157571 rest_server.go:94] error: http: Server closed

Ran 7 of 7 Specs in 120.505 seconds
SUCCESS! -- 7 Passed | 0 Failed | 0 Pending | 0 Skipped
PASS

Ginkgo ran 1 suite in 2m2.690527352s
Test Suite Passed
sai@sai-ThinkPad-L470:~/gocode/src/github.com/mayadata-io/volume-events-exporter/tests$ git diff
diff --git a/tests/nfs_sanity_test.go b/tests/nfs_sanity_test.go
index f154117..18fc73d 100644
--- a/tests/nfs_sanity_test.go
+++ b/tests/nfs_sanity_test.go
@@ -71,8 +71,8 @@ var _ = Describe("TEST NFS PVC CREATE & DELTE EVENTS", func() {
                        Expect(pvcPhase).To(Equal(corev1.ClaimBound), "pvc %s/%s should be in bound phase", applicationNamespace, pvcName)
 
                        // TODO: Remove below lines after merging https://github.com/openebs/dynamic-nfs-provisioner/pull/97 PR
-                       err = markNFSResources(applicationNamespace, pvcName)
-                       Expect(err).To(BeNil(), "while makrking for events")
+                       // err = markNFSResources(applicationNamespace, pvcName)
+                       // Expect(err).To(BeNil(), "while makrking for events")
                })
        })
 
sai@sai-ThinkPad-L470:~/gocode/src/github.com/mayadata-io/volume-events-exporter/tests$ 

@mynktl mynktl merged commit e50bac3 into mayadata-io:develop Aug 31, 2021
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.

3 participants