Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
johzchen committed Dec 24, 2020
1 parent 295b6d1 commit af5dbec
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions api/test/e2e/label_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ func TestLabel(t *testing.T) {
// Todo: test ssl after ssl bug fixed
tests := []HttpTestCase{
{
caseDesc: "config route",
Object: ManagerApiExpect(t),
Path: "/apisix/admin/routes/r1",
Method: http.MethodPut,
Desc: "config route",
Object: ManagerApiExpect(t),
Path: "/apisix/admin/routes/r1",
Method: http.MethodPut,
Body: `{
"uri": "/hello",
"labels": {
Expand All @@ -49,10 +49,10 @@ func TestLabel(t *testing.T) {
ExpectStatus: http.StatusOK,
},
{
caseDesc: "create consumer",
Object: ManagerApiExpect(t),
Path: "/apisix/admin/consumers/c1",
Method: http.MethodPut,
Desc: "create consumer",
Object: ManagerApiExpect(t),
Path: "/apisix/admin/consumers/c1",
Method: http.MethodPut,
Body: `{
"username": "jack",
"plugins": {
Expand All @@ -71,10 +71,10 @@ func TestLabel(t *testing.T) {
ExpectStatus: http.StatusOK,
},
{
caseDesc: "create upstream",
Object: ManagerApiExpect(t),
Method: http.MethodPut,
Path: "/apisix/admin/upstreams/u1",
Desc: "create upstream",
Object: ManagerApiExpect(t),
Method: http.MethodPut,
Path: "/apisix/admin/upstreams/u1",
Body: `{
"nodes": [{
"host": "172.16.238.20",
Expand All @@ -92,10 +92,10 @@ func TestLabel(t *testing.T) {
ExpectStatus: http.StatusOK,
},
{
caseDesc: "create service",
Object: ManagerApiExpect(t),
Method: http.MethodPost,
Path: "/apisix/admin/services",
Desc: "create service",
Object: ManagerApiExpect(t),
Method: http.MethodPost,
Path: "/apisix/admin/services",
Body: `{
"id": "s1",
"plugins": {
Expand Down Expand Up @@ -125,7 +125,7 @@ func TestLabel(t *testing.T) {
ExpectStatus: http.StatusOK,
},
{
caseDesc: "get route label",
Desc: "get route label",
Object: ManagerApiExpect(t),
Method: http.MethodGet,
Headers: map[string]string{"Authorization": token},
Expand All @@ -134,7 +134,7 @@ func TestLabel(t *testing.T) {
ExpectBody: "{\"build\":\"16\"},{\"env\":\"production\"},{\"version\":\"v2\"}",
},
{
caseDesc: "get consumer label",
Desc: "get consumer label",
Object: ManagerApiExpect(t),
Method: http.MethodGet,
Headers: map[string]string{"Authorization": token},
Expand All @@ -143,7 +143,7 @@ func TestLabel(t *testing.T) {
ExpectBody: "{\"build\":\"16\"},{\"env\":\"production\"},{\"version\":\"v3\"}",
},
{
caseDesc: "get upstream label",
Desc: "get upstream label",
Object: ManagerApiExpect(t),
Method: http.MethodGet,
Headers: map[string]string{"Authorization": token},
Expand All @@ -152,7 +152,7 @@ func TestLabel(t *testing.T) {
ExpectBody: "{\"build\":\"17\"},{\"env\":\"production\"},{\"version\":\"v2\"}",
},
{
caseDesc: "get service label",
Desc: "get service label",
Object: ManagerApiExpect(t),
Method: http.MethodGet,
Headers: map[string]string{"Authorization": token},
Expand All @@ -161,7 +161,7 @@ func TestLabel(t *testing.T) {
ExpectBody: "{\"build\":\"16\"},{\"env\":\"production\"},{\"extra\":\"test\"},{\"version\":\"v2\"}",
},
{
caseDesc: "get all label",
Desc: "get all label",
Object: ManagerApiExpect(t),
Method: http.MethodGet,
Headers: map[string]string{"Authorization": token},
Expand All @@ -170,7 +170,7 @@ func TestLabel(t *testing.T) {
ExpectBody: "{\"build\":\"16\"},{\"build\":\"17\"},{\"env\":\"production\"},{\"extra\":\"test\"},{\"version\":\"v2\"},{\"version\":\"v3\"}",
},
{
caseDesc: "get label with page",
Desc: "get label with page",
Object: ManagerApiExpect(t),
Method: http.MethodGet,
Query: "page=1&page_size=1",
Expand All @@ -180,7 +180,7 @@ func TestLabel(t *testing.T) {
ExpectBody: "{\"build\":\"16\"}",
},
{
caseDesc: "get label with page",
Desc: "get label with page",
Object: ManagerApiExpect(t),
Method: http.MethodGet,
Query: "page=3&page_size=1",
Expand All @@ -190,7 +190,7 @@ func TestLabel(t *testing.T) {
ExpectBody: "{\"env\":\"production\"}",
},
{
caseDesc: "get labels (key = build)",
Desc: "get labels (key = build)",
Object: ManagerApiExpect(t),
Method: http.MethodGet,
Headers: map[string]string{"Authorization": token},
Expand All @@ -200,7 +200,7 @@ func TestLabel(t *testing.T) {
ExpectBody: "{\"build\":\"16\"},{\"build\":\"17\"}",
},
{
caseDesc: "get labels (key = build) with page",
Desc: "get labels (key = build) with page",
Object: ManagerApiExpect(t),
Method: http.MethodGet,
Headers: map[string]string{"Authorization": token},
Expand All @@ -210,7 +210,7 @@ func TestLabel(t *testing.T) {
ExpectBody: "{\"build\":\"17\"}",
},
{
caseDesc: "get labels (key = build && env = production)",
Desc: "get labels (key = build && env = production)",
Object: ManagerApiExpect(t),
Method: http.MethodGet,
Headers: map[string]string{"Authorization": token},
Expand All @@ -220,7 +220,7 @@ func TestLabel(t *testing.T) {
ExpectBody: "{\"build\":\"16\"},{\"build\":\"17\"},{\"env\":\"production\"}",
},
{
caseDesc: "get labels (key = build && env = production) with page",
Desc: "get labels (key = build && env = production) with page",
Object: ManagerApiExpect(t),
Method: http.MethodGet,
Headers: map[string]string{"Authorization": token},
Expand All @@ -230,31 +230,31 @@ func TestLabel(t *testing.T) {
ExpectBody: "{\"env\":\"production\"}",
},
{
caseDesc: "delete route",
Desc: "delete route",
Object: ManagerApiExpect(t),
Method: http.MethodDelete,
Path: "/apisix/admin/routes/r1",
Headers: map[string]string{"Authorization": token},
ExpectStatus: http.StatusOK,
},
{
caseDesc: "delete consumer",
Desc: "delete consumer",
Object: ManagerApiExpect(t),
Method: http.MethodDelete,
Path: "/apisix/admin/consumers/c1",
Headers: map[string]string{"Authorization": token},
ExpectStatus: http.StatusOK,
},
{
caseDesc: "delete service",
Desc: "delete service",
Object: ManagerApiExpect(t),
Method: http.MethodDelete,
Path: "/apisix/admin/services/s1",
Headers: map[string]string{"Authorization": token},
ExpectStatus: http.StatusOK,
},
{
caseDesc: "delete upstream",
Desc: "delete upstream",
Object: ManagerApiExpect(t),
Method: http.MethodDelete,
Path: "/apisix/admin/upstreams/u1",
Expand All @@ -264,6 +264,6 @@ func TestLabel(t *testing.T) {
}

for _, tc := range tests {
testCaseCheck(tc)
testCaseCheck(tc, t)
}
}

0 comments on commit af5dbec

Please sign in to comment.