diff --git a/test/conformance/README.md b/test/conformance/README.md index 968a12100c5..5ec0bcaf37f 100644 --- a/test/conformance/README.md +++ b/test/conformance/README.md @@ -11,10 +11,20 @@ Run test with e2e tag and optionally select conformance test > NOTE: Make sure you have built the > [test images](https://github.com/knative/eventing/tree/master/test#building-the-test-images)! -```go +```shell go test -v -tags=e2e -count=1 ./test/conformance/... go test -v -timeout 30s -tags e2e knative.dev/eventing/test/conformance -run ^TestMustPassTracingHeaders$ go test -v -timeout 30s -tags e2e knative.dev/eventing/test/conformance -run ^TestMustPassTracingHeaders$ --kubeconfig $KUBECONFIG ``` + +## Running Broker conformance tests against an existing broker + +When developing a new broker, or testings against a preexisting broker setup you +can specify: + +```shell +go test -v -tags e2e knative.dev/eventing/test/conformance -brokername=foo -brokernamespace=bar -run TestBrokerV1Beta1DataPlaneIngress + +``` diff --git a/test/conformance/broker_data_plane_test.go b/test/conformance/broker_data_plane_test.go index 83d15c1a2b3..a0e3c3a07a1 100644 --- a/test/conformance/broker_data_plane_test.go +++ b/test/conformance/broker_data_plane_test.go @@ -26,14 +26,14 @@ import ( ) func TestBrokerV1Beta1DataPlaneIngress(t *testing.T) { - client := testlib.Setup(t, true, testlib.SetupClientOptionNoop) + client := testlib.Setup(t, true, helpers.BrokerDataPlaneNamespaceSetupOption(brokerNamespace)) defer testlib.TearDown(client) broker := helpers.BrokerDataPlaneSetupHelper(client, brokerName, brokerNamespace, brokerClass) helpers.BrokerV1Beta1IngressDataPlaneTestHelper(t, client, broker) } func TestBrokerV1Beta1DataPlaneConsumer(t *testing.T) { - client := testlib.Setup(t, true, testlib.SetupClientOptionNoop) + client := testlib.Setup(t, true, helpers.BrokerDataPlaneNamespaceSetupOption(brokerNamespace)) defer testlib.TearDown(client) broker := helpers.BrokerDataPlaneSetupHelper(client, brokerName, brokerNamespace, brokerClass) diff --git a/test/conformance/helpers/broker_data_plane_test_helper.go b/test/conformance/helpers/broker_data_plane_test_helper.go index ad5dfd4728c..ac48ca3b1ba 100644 --- a/test/conformance/helpers/broker_data_plane_test_helper.go +++ b/test/conformance/helpers/broker_data_plane_test_helper.go @@ -53,6 +53,15 @@ func BrokerDataPlaneSetupHelper(client *testlib.Client, brokerName, brokerNamesp return broker } +func BrokerDataPlaneNamespaceSetupOption(namespace string) testlib.SetupClientOption { + return func(client *testlib.Client) { + if namespace != "" { + client.Kube.Kube.CoreV1().Namespaces().Delete(client.Namespace, nil) + client.Namespace = namespace + } + } +} + //At ingress //Supports CE 0.3 or CE 1.0 via HTTP //Supports structured or Binary mode