nic-chen commented on a change in pull request #1550:
URL: https://github.com/apache/apisix-dashboard/pull/1550#discussion_r587047356
##########
File path: api/test/e2enew/server_info/server_info_test.go
##########
@@ -14,127 +14,113 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package e2e
+package server_info
import (
"net/http"
- "testing"
- "time"
+
+ "github.com/onsi/ginkgo"
+ "github.com/onsi/ginkgo/extensions/table"
+
+ "e2enew/base"
)
-func TestServerInfo_Get(t *testing.T) {
- // wait for apisix report
- time.Sleep(2 * time.Second)
- testCases := []HttpTestCase{
- {
- Desc: "get server info",
- Object: ManagerApiExpect(t),
+var _ = ginkgo.Describe("server info test", func() {
+ table.DescribeTable("get server info",
+ func(tc base.HttpTestCase) {
+ base.RunTestCase(tc)
+ },
+ table.Entry("get server info(apisix-server1)",
base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
Path:
"/apisix/admin/server_info/apisix-server1",
Method: http.MethodGet,
- Headers: map[string]string{"Authorization": token},
+ Headers: map[string]string{"Authorization":
base.GetToken()},
ExpectStatus: http.StatusOK,
ExpectBody: "\"hostname\":\"apisix_server1\"",
- },
- {
- Desc: "get server info",
- Object: ManagerApiExpect(t),
+ Sleep: base.SleepTime * 15,
Review comment:
@Jaycean
It is recommended to directly use the original time - 2 seconds.
Some places may rely on services that are delayed. For example, here is the
reporting interval of the plugin `server-info`.
----------------------------------------------------------------
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:
[email protected]