You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/12/18 02:09:12 UTC

[GitHub] [apisix-dashboard] tokers commented on a change in pull request #1057: feat: support global rules for Manager API

tokers commented on a change in pull request #1057:
URL: https://github.com/apache/apisix-dashboard/pull/1057#discussion_r545524560



##########
File path: api/test/e2e/global_rule_test.go
##########
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package e2e
+
+import (
+	"net/http"
+	"testing"
+	"time"
+)
+
+func TestGlobalRule(t *testing.T) {
+	tests := []HttpTestCase{
+		{
+			caseDesc:     "make sure the route is not created ",

Review comment:
       The description should be "make sure the route doesn't exist".

##########
File path: api/internal/core/store/storehub.go
##########
@@ -28,21 +28,22 @@ import (
 type HubKey string
 
 const (
-	HubKeyConsumer HubKey = "consumer"
-	HubKeyRoute    HubKey = "route"
-	HubKeyService  HubKey = "service"
-	HubKeySsl      HubKey = "ssl"
-	HubKeyUpstream HubKey = "upstream"
-	HubKeyScript   HubKey = "script"
+	HubKeyConsumer   HubKey = "consumer"
+	HubKeyRoute      HubKey = "route"
+	HubKeyService    HubKey = "service"
+	HubKeySsl        HubKey = "ssl"
+	HubKeyUpstream   HubKey = "upstream"
+	HubKeyScript     HubKey = "script"
+	HubKeyGlobalRule HubKey = "global_rule"
 )
 
 var (
 	storeHub = map[HubKey]*GenericStore{}
 )
 
 func InitStore(key HubKey, opt GenericStoreOption) error {
-	if key == HubKeyConsumer || key == HubKeyRoute ||
-		key == HubKeyService || key == HubKeySsl || key == HubKeyUpstream {
+	if key == HubKeyConsumer || key == HubKeyRoute || key == HubKeySsl ||

Review comment:
       Too many types, should use a map to filter.

##########
File path: api/test/e2e/global_rule_test.go
##########
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package e2e
+
+import (
+	"net/http"
+	"testing"
+	"time"
+)
+
+func TestGlobalRule(t *testing.T) {
+	tests := []HttpTestCase{
+		{
+			caseDesc:     "make sure the route is not created ",

Review comment:
       Redundant empty space.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org