Skip to content

Add e2e tests for neg naming and neg crd#1207

Merged
k8s-ci-robot merged 1 commit intokubernetes:masterfrom
swetharepakula:neg-crd-e2e
Aug 6, 2020
Merged

Add e2e tests for neg naming and neg crd#1207
k8s-ci-robot merged 1 commit intokubernetes:masterfrom
swetharepakula:neg-crd-e2e

Conversation

@swetharepakula
Copy link
Copy Markdown
Member

No description provided.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 5, 2020
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @swetharepakula. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Aug 5, 2020
@freehan
Copy link
Copy Markdown
Contributor

freehan commented Aug 5, 2020

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 5, 2020
})
}

func TestEnableNegCRD(t *testing.T) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: TestNegCRDTransitions

}

// CheckDeletedNegCRs verifies that the provided neg list does not have negs that are associated with the provided neg atrributes
func CheckDeletedNegCRs(negs *negv1beta1.ServiceNetworkEndpointGroupList, deletedNegAttrs, negConfigs map[string]string) bool {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: s/negs/svcNeg

}

// WaitForStandaloneNegDeletion waits for all NEGs associated with a GCLB to be deleted via GC
func WaitForStandaloneNegDeletion(ctx context.Context, c cloud.Cloud, s *Sandbox, expectedDeletedNegCRs, negConfigs map[string]string, zones []string, expectDeletion bool) error {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

negConfigs => map port -> negName
expectedDeleteNegCRs => map port -> name

})
}

func TestNegCRDUserActions(t *testing.T) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

E2e test is quite heavy. I would recommend not adding e2e test for negative cases.
Unless, it is a very important negative case.

Let us discuss if this is worth keeping

desc string
annotations annotations.NegAnnotation
expectedNegAttrs map[string]string
gcNegAttrs map[string]string
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

might be worth adding another parameter: replicas?

I think WaitForNegs should already check the number of endpoints in the NEGs.

}

// CheckCustomNegNameStatus checks if the NEG Status annotation is present and in the expected state
func CheckCustomNegNameStatus(svc *v1.Service, expectedNegAttrs map[string]string) (annotations.NegStatus, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

add a comment about expectedNegAttrs parameter

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CheckNameInNegStatus?

return nil
}

// WaitForStandaloneNegDeletion waits for all NEGs associated with a GCLB to be deleted via GC
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

// WaitForStandaloneNegDeletion waits for standalone NEGs and corresponding CRDs are deleted via GC.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

add comments about expectedDelteNegsCRs, negConfigs

consider:

  1. pass negConfigs and zones together as pastNegStatus.
  2. pass the NEG name which expected to be deleted. So that making the function simpler only validate if one NEG and CRD has been delete .

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 6, 2020
Copy link
Copy Markdown
Contributor

@freehan freehan left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 6, 2020
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: freehan, swetharepakula

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 6, 2020
@k8s-ci-robot k8s-ci-robot merged commit c50bd88 into kubernetes:master Aug 6, 2020
@swetharepakula swetharepakula deleted the neg-crd-e2e branch August 6, 2020 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants