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

RDS Core: separate general methods from the sriov verification suite #65

Closed
wants to merge 4 commits into from

Conversation

elenagerman
Copy link
Collaborator

@elenagerman elenagerman commented Jun 24, 2024

  • helper.go file created

  • verifySRIOVConnectivity was renamed to the verifyConnectivity and moved to the helper.go

  • createServiceAccount, deleteServiceAccount, deleteClusterRBAC, createClusterRBAC, deleteConfigMap, createConfigMap, deleteDeployments, findPodWithSelector, defineContainer, verifyMsgInPodLogs were moved to the helper.go

  • 'if pState == "NonCompliant"' state was changed to the 'if pState == "NonCompliant"'. Depends on deployment type it can be some extra policies with no state at all be found and it can fail test with no reason

@elenagerman
Copy link
Collaborator Author

@yprokule Hi! as was discussed, PTAL

Comment on lines +36 to +41
deploySa, err := deploySa.Create()

if err != nil {
glog.V(rdscoreparams.RDSCoreLogLevel).Infof("Error creating SA %q in %q namespace: %v",
saName, nsName, err)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be inside Eventually block


deploySa := serviceaccount.NewBuilder(rdscoreinittools.APIClient, saName, nsName)

if !deploySa.Exists() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

please add logging for a case that SA already exists, thanks

Comment on lines +74 to +79
err := deploySa.Delete()

if err != nil {
glog.V(rdscoreparams.RDSCoreLogLevel).Infof("Error deleting ServiceAccount %q in %q namespace: %v",
saName, nsName, err)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be within Eventually block

Comment on lines +113 to +118
err := crbSa.Delete()

if err != nil {
glog.V(rdscoreparams.RDSCoreLogLevel).Infof("Error deleting ClusterRoleBinding %q : %v",
rbacName, err)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto, should be within Eventually block

Comment on lines +153 to +157
crbSa, err := crbSa.Create()
if err != nil {
glog.V(rdscoreparams.RDSCoreLogLevel).Infof(
"Error Creating ClusterRoleBinding %q : %v", crbSa.Definition.Name, err)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto, should be within Eventually block

Comment on lines +185 to +190
err := cmBuilder.Delete()

if err != nil {
glog.V(rdscoreparams.RDSCoreLogLevel).Infof("Error deleting configMap %q : %v",
cmName, err)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

Comment on lines +217 to +222
cmResult, err := cmBuilder.Create()
if err != nil {
glog.V(rdscoreparams.RDSCoreLogLevel).Infof("Error creating ConfigMap %q in %q namespace: %v",
cmName, nsName, err)
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

glog.V(rdscoreparams.RDSCoreLogLevel).Infof("Deleting deployment %q from %q namespace",
deploy.Definition.Name, nsName)

deploy, err = deploy.WithReplicas(int32(0)).Update()
Copy link
Collaborator

Choose a reason for hiding this comment

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

no need to scale down deployment before deletion

Copy link
Collaborator

@yprokule yprokule left a comment

Choose a reason for hiding this comment

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

please address new comments, thanks

@elenagerman
Copy link
Collaborator Author

@yprokule I'm sorry, but I do not understand why general methods like delete/create API objects cannot be outside the sriov validation test. What if we need it for the other operator's tests? For example, configmap, rbac, and sa config can be required for the keda config.
I also do not understand what is terrible in double-checking if ns exists.
Anyway, with all the requested changes, we are returning to the original version; I do not see any value in this MR.
Thank you!

@yprokule
Copy link
Collaborator

@yprokule I'm sorry, but I do not understand why general methods like delete/create API objects cannot be outside the sriov validation test. What if we need it for the other operator's tests? For example, configmap, rbac, and sa config can be required for the keda config.

@elenagerman what are U talking about? I didn't object about having some of the common methods in a dedicated file. What I said is that during your move of existing methods to a new file U broke the existing logic and were asked to fix it

I also do not understand what is terrible in double-checking if ns exists.

U don't double check but create if it's missing which again affects existing logic. And what the problem to run this at the beginning of the test or in the setup block?

Anyway, with all the requested changes, we are returning to the original version; I do not see any value in this MR.

Again, not sure where U got the idea that we are returning to the original version - all U had to do was to address broken logic in the PR.

Feel free to reopen PR and address comments or I might piggyback on this work and adjust it myself.

Thank you!

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.

2 participants