k8snetworkplumbingwg / multi-networkpolicy-iptables

MultiNetworkPolicy iptable based implementation
Apache License 2.0
13 stars 19 forks source link

Infer PolicyTypes if missing #50

Closed zeeke closed 11 months ago

zeeke commented 1 year ago

In cases where Spec.PolicyTypes is not specified, it should default to the existence of Ingress or Egress rules.

Updating end2end tests to cover also this scenario.

Changes have been guided by the regular NetworkPolicy documentation:

[...] If this field is not specified, it will default based on the existence of Ingress or Egress rules;

coveralls commented 1 year ago

Pull Request Test Coverage Report for Build 5529027813


Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/server/server.go 5 13 38.46%
<!-- Total: 5 13 38.46% -->
Totals Coverage Status
Change from base Build 5523838027: 5.1%
Covered Lines: 1104
Relevant Lines: 1886

💛 - Coveralls
zeeke commented 11 months ago

e2e-kind job is fixed by:

s1061123 commented 11 months ago

@zeeke Appreciated your e2e test fix! Could you please rebase the PR to get the e2e fix?

s1061123 commented 11 months ago

@zeeke I update the PR but e2e still failed. PTAL?

ok 1 setup simple test environments
ok 2 test-simple-v4-ingress-list check client-a -> server
not ok 3 test-simple-v4-ingress-list check client-b -> server
# (in test file tests/simple-v4-ingress-list.bats, line 35)
#   `[ "$status" -eq  "1" ]' failed
zeeke commented 11 months ago

Sure, I'll have a look

zeeke commented 11 months ago

Some tests were missing a sleep after the test setup. I think some assertions were running before the server policy sync.

s1061123 commented 11 months ago

@zeeke thank you for the quick fix! Let's merge that.