Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

feat(e2e): ensures namespace ignore label takes precedence #4073

Merged
merged 2 commits into from
Sep 9, 2021

Conversation

jaellio
Copy link
Contributor

@jaellio jaellio commented Sep 2, 2021

Description:

This test verifies that the ignore label on a namespace resource
takes precedence over the values of the monitored-by label and the
sidecar injection annotation if they have been applied to a Ns.
The ignore label prevents sidecar injection from occurring in the
namespace the label is applied to.

Testing done:

Affected area:

Functional Area
New Functionality [ ]
CI System [ ]
CLI Tool [ ]
Certificate Management [ ]
Control Plane [ ]
Demo [ ]
Documentation [ ]
Egress [ ]
Ingress [ ]
Install [ ]
Networking [ ]
Observability [ ]
Performance [ ]
SMI Policy [ ]
Security [ ]
Sidecar Injection [ ]
Tests [ X ]
Upgrade [ ]
Other [ ]

Please answer the following questions with yes/no.

  1. Does this change contain code from or inspired by another project? No

    • Did you notify the maintainers and provide attribution?
  2. Is this a breaking change? No

@jaellio jaellio force-pushed the e2eIgnoreNamespace branch 3 times, most recently from 85d4109 to ec60fee Compare September 2, 2021 20:08
This test verifies that the ignore label on a namespace resource
takes precedence over the values of the monitored-by label and the
sidecar injection annotation if they have been applied to a Ns.
The ignore label prevents sidecar injection from occuring in the
namespace the label is applied to.

Signed-off-by: jaellio <[email protected]>
var _ = OSMDescribe("Ignore Namespaces",
OSMDescribeInfo{
Tier: 1,
Bucket: 2,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will update to Tier: 2 after PR review is complete

Copy link
Member

Choose a reason for hiding this comment

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

The Tier doesn't matter anymore. All tests run for PR workflows.

@jaellio jaellio marked this pull request as ready for review September 3, 2021 13:53
@jaellio jaellio requested a review from a team as a code owner September 3, 2021 13:53
Comment on lines 38 to 40

// Add monitor-ignore to mesh with sidecar injection disabled
Expect(Td.AddNsToMesh(false, monitorIgnoreNs)).To(Succeed())
Copy link
Member

Choose a reason for hiding this comment

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

This test case here seems unnecessary given that this test is meant to test the ignore label. Just testing ignore label with sidecar-injection enabled should suffice. This is a k8s functionality that we are testing now and not OSM, so I suggest simplifying this test to only test the ignore label and not all combinations of the matchExpression selector exposed by the k8s API.

Copy link
Contributor

@nojnhuh nojnhuh left a comment

Choose a reason for hiding this comment

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

Could this check instead be expressed as a unit test? I don't see a test for this particular scenario, but similar tests are here:

var _ = Describe("Testing mustInject, isNamespaceInjectable", func() {

@shashankram
Copy link
Member

Could this check instead be expressed as a unit test? I don't see a test for this particular scenario, but similar tests are here:

var _ = Describe("Testing mustInject, isNamespaceInjectable", func() {

@nojnhuh this test is primarily testing whether k8s matchExpression on the namespace selector configuration works as expected. I think the idea of this test was to confirm that we are correctly implementing the desired behavior (ignore label overrides sidecar-injection & monitor annotation and labels respectively). A simple e2e test as noted in #4073 (comment) should suffice in my opinion. I don't think we should be testing various permutations around k8s API behavior here.

Signed-off-by: jaellio <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented Sep 5, 2021

Codecov Report

Merging #4073 (e49b267) into main (5ee1940) will increase coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4073      +/-   ##
==========================================
+ Coverage   68.41%   68.44%   +0.03%     
==========================================
  Files         205      206       +1     
  Lines       11616    11673      +57     
==========================================
+ Hits         7947     7990      +43     
- Misses       3619     3633      +14     
  Partials       50       50              
Flag Coverage Δ
unittests 68.44% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/smi/fake.go 0.00% <0.00%> (ø)
pkg/smi/mock_meshspec_generated.go 0.00% <0.00%> (ø)
pkg/smi/types.go 100.00% <0.00%> (ø)
pkg/catalog/endpoint.go 80.76% <0.00%> (+0.76%) ⬆️
pkg/smi/client.go 82.82% <0.00%> (+2.10%) ⬆️
pkg/k8s/announcement_handlers.go 78.37% <0.00%> (+5.40%) ⬆️

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 5ee1940...e49b267. Read the comment docs.

var _ = OSMDescribe("Ignore Namespaces",
OSMDescribeInfo{
Tier: 1,
Bucket: 2,
Copy link
Member

Choose a reason for hiding this comment

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

The Tier doesn't matter anymore. All tests run for PR workflows.

@jaellio jaellio merged commit 98d8904 into openservicemesh:main Sep 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

e2e for testing that ignore label on a namespace takes precedence over the monitor label
5 participants