Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: clean the temporary data in etcd at the end of test case #942

Closed
membphis opened this issue Dec 2, 2020 · 9 comments · Fixed by #1319
Closed

test: clean the temporary data in etcd at the end of test case #942

membphis opened this issue Dec 2, 2020 · 9 comments · Fixed by #1319
Assignees
Labels
backend testcase wait for update 1. Solution 2. Due date 3. Assignees if needed
Milestone

Comments

@membphis
Copy link
Member

membphis commented Dec 2, 2020

the current way:

func TestRoute_Delete_Routes_With_Hosts(t *testing.T) {
tests := []HttpTestCase{
{
caseDesc: "delete route",
Object: ManagerApiExpect(t),
Method: http.MethodDelete,
Path: "/apisix/admin/routes/r1",
Headers: map[string]string{"Authorization": token},
ExpectStatus: http.StatusOK,
},
{
caseDesc: "delete not exist route",
Object: ManagerApiExpect(t),
Method: http.MethodDelete,
Path: "/apisix/admin/routes/not-exist",
Headers: map[string]string{"Authorization": token},
ExpectStatus: http.StatusNotFound,
},
{
caseDesc: "hit the route just deleted",
Object: APISIXExpect(t),
Method: http.MethodGet,
Path: "/hello1",
Headers: map[string]string{"Host": "bar.com"},
ExpectStatus: http.StatusNotFound,
ExpectBody: "{\"error_msg\":\"404 Route Not Found\"}\n",
Sleep: sleepTime,
},
}
for _, tc := range tests {
testCaseCheck(tc)
}
}

The current way is to completely depend on the developer and bring extra work to the test case maintainer.

we need a common way to clean all of the temporary data in etcd after running the test cases of each file.

@membphis
Copy link
Member Author

membphis commented Dec 2, 2020

I think this feature is useful. The E2E test cases are unstable, I think this feature will improve the stability of E2E testing.

@membphis
Copy link
Member Author

membphis commented Dec 2, 2020

@nic-chen @ShiningRush do you think we can implement this feature at milestone 2.2?

@ShiningRush
Copy link
Contributor

It is useful and easy to implement with go's TestMain, We can ensure etcd is fresh before start test.

@membphis
Copy link
Member Author

membphis commented Dec 2, 2020

@gxthrj @nic-chen do you know TestMain ? Any suggestions?

@nic-chen
Copy link
Member

nic-chen commented Dec 2, 2020

I think we need to clear ETCD data without distinction before or after running test, by TestMain.

@gxthrj
Copy link
Contributor

gxthrj commented Dec 2, 2020

The TestMain way is a test suite like ginkgo, we can use it make struct more clear, but I still like ginkgo mode.

@juzhiyuan juzhiyuan added the wait for update 1. Solution 2. Due date 3. Assignees if needed label Jan 4, 2021
@juzhiyuan juzhiyuan added this to the 2.4 milestone Jan 8, 2021
@juzhiyuan
Copy link
Member

cc @starsz

@membphis
Copy link
Member Author

any news? @starsz

@starsz
Copy link
Contributor

starsz commented Jan 13, 2021

any news? @starsz

Sorry for I am late. I think we can do this work when we use ginko framework.
As far as I know, we will use ginko framework in M2.4, so this will be solved at that time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend testcase wait for update 1. Solution 2. Due date 3. Assignees if needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants