Wrap whole networkpolicy test in InNetworkPolicyContext()
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-package e2e
+package networking
import (
"k8s.io/kubernetes/pkg/api/v1"
@@ -28,6 +28,10 @@ import (
. "github.com/onsi/gomega"
)
+/* Taken from kubernetes PR #35660 and locally modified:
+ 1. Update "package" decl, wrap all tests in InNetworkPolicyContext().
+*/
+
/*
The following Network Policy tests verify that policy object definitions
are correctly enforced by a networking plugin. It accomplishes this by launching
@@ -37,7 +41,8 @@ connections from one of the clients. The test then asserts that the clients
failed or succesfully connected as expected.
*/
-var _ = framework.KubeDescribe("NetworkPolicy", func() {
+var _ = Describe("NetworkPolicy", func() {
+ InNetworkPolicyContext(func() {
f := framework.NewDefaultFramework("network-policy")
It("should support setting DefaultDeny namespace policy [Feature:NetworkPolicy]", func() {
@@ -536,6 +541,7 @@ var _ = framework.KubeDescribe("NetworkPolicy", func() {
testCanConnect(f, nsB, "client-b", service, 80)
})
})
+})
func testCanConnect(f *framework.Framework, ns *v1.Namespace, podName string, service *v1.Service, targetPort int) {
By(fmt.Sprintf("Creating client pod %s that should successfully connect to %s.", podName, service.Name))
