Skip to content

Commit f9eaafc

Browse files
committed
resolve rate limit for unit test
1 parent 2eda697 commit f9eaafc

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

client/src/test/java/cn/vika/client/api/RecordPagerTest.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static void initTestData() throws IOException {
9494

9595
@Test
9696
@Order(101)
97-
void testGetAll() throws ApiException, JsonProcessingException {
97+
void testGetAll() throws ApiException, JsonProcessingException, InterruptedException {
9898
assertThat(DATASHEET_ID).isNotNull();
9999
Pager<Record> pager = vikaApiClient.getRecordApi().getRecords(DATASHEET_ID);
100100
assertThat(pager).isNotNull();
@@ -103,19 +103,21 @@ void testGetAll() throws ApiException, JsonProcessingException {
103103
for (Record record : records) {
104104
System.out.format("record: %s \n", JacksonJsonUtil.toJson(record, true));
105105
}
106+
Thread.sleep(1000);
106107
}
107108

108109
@Test
109110
@Order(102)
110-
void testPageStream() throws ApiException {
111+
void testPageStream() throws ApiException, InterruptedException {
111112
Stream<Record> records = vikaApiClient.getRecordApi().getRecordsAsStream(DATASHEET_ID);
112113
assertThat(records).isNotNull();
113114
assertThat(records.findFirst()).isPresent();
115+
Thread.sleep(1000);
114116
}
115117

116118
@Test
117119
@Order(103)
118-
void testWithPageNumAndPageSize() throws ApiException, JsonProcessingException {
120+
void testWithPageNumAndPageSize() throws ApiException, JsonProcessingException, InterruptedException {
119121
int page = Integer.parseInt(ConstantKey.PAGE_NUM.get());
120122
int itemPerPage = Integer.parseInt(ConstantKey.PAGE_SIZE.get());
121123
List<Record> records = vikaApiClient.getRecordApi().getRecords(DATASHEET_ID, page, itemPerPage);
@@ -124,11 +126,12 @@ void testWithPageNumAndPageSize() throws ApiException, JsonProcessingException {
124126
for (Record record : records) {
125127
System.out.format("record: %s \n", JacksonJsonUtil.toJson(record, true));
126128
}
129+
Thread.sleep(1000);
127130
}
128131

129132
@Test
130133
@Order(104)
131-
void testPageWithPageSize() throws ApiException, JsonProcessingException {
134+
void testPageWithPageSize() throws ApiException, JsonProcessingException, InterruptedException {
132135
int itemPerPage = Integer.parseInt(ConstantKey.PAGE_SIZE.get());
133136
Pager<Record> pager = vikaApiClient.getRecordApi().getRecords(DATASHEET_ID, itemPerPage);
134137
assertThat(pager).isNotNull();
@@ -151,11 +154,12 @@ void testPageWithPageSize() throws ApiException, JsonProcessingException {
151154
}
152155
}
153156
assertThat(pageIndex).isEqualTo(pager.getTotalPages());
157+
Thread.sleep(1000);
154158
}
155159

156160
@Test
157161
@Order(105)
158-
void testPageWithView() throws ApiException, JsonProcessingException {
162+
void testPageWithView() throws ApiException, JsonProcessingException, InterruptedException {
159163
ApiQueryParam queryParam = ApiQueryParam.EMPTY.withView(ConstantKey.TEST_VIEW_ID.get());
160164
Pager<Record> pager = vikaApiClient.getRecordApi().getRecords(DATASHEET_ID, queryParam);
161165
assertThat(pager).isNotNull();
@@ -170,11 +174,12 @@ void testPageWithView() throws ApiException, JsonProcessingException {
170174
System.out.format("record: %s \n", JacksonJsonUtil.toJson(record, true));
171175
}
172176
}
177+
Thread.sleep(1000);
173178
}
174179

175180
@Test
176181
@Order(106)
177-
void testPageWithSort() throws ApiException, JsonProcessingException {
182+
void testPageWithSort() throws ApiException, JsonProcessingException, InterruptedException {
178183
String[] sorts = TEST_SORT.get().split(",");
179184
ApiQueryParam queryParam = ApiQueryParam.EMPTY;
180185
for (String s : sorts) {
@@ -194,6 +199,7 @@ void testPageWithSort() throws ApiException, JsonProcessingException {
194199
System.out.format("record: %s \n", JacksonJsonUtil.toJson(record, true));
195200
}
196201
}
202+
Thread.sleep(1000);
197203
}
198204

199205
@Test
@@ -218,7 +224,7 @@ void testPageWithFields() throws ApiException, JsonProcessingException {
218224

219225
@Test
220226
@Order(108)
221-
void testPagesWithRecordIds() throws ApiException, JsonProcessingException {
227+
void testPagesWithRecordIds() throws ApiException, JsonProcessingException, InterruptedException {
222228
Random random = new Random();
223229
List<String> randomRecordIds = new ArrayList<>(2);
224230
int length = 2;
@@ -240,11 +246,12 @@ void testPagesWithRecordIds() throws ApiException, JsonProcessingException {
240246
System.out.format("record: %s \n", JacksonJsonUtil.toJson(record, true));
241247
}
242248
}
249+
Thread.sleep(1000);
243250
}
244251

245252
@Test
246253
@Order(109)
247-
void testPagesWithFormulaFilter() throws ApiException, JsonProcessingException {
254+
void testPagesWithFormulaFilter() throws ApiException, JsonProcessingException, InterruptedException {
248255
ApiQueryParam queryParam = ApiQueryParam.EMPTY.withFilter(ConstantKey.TEST_FILTER_FORMULA.get());
249256
Pager<Record> pager = vikaApiClient.getRecordApi().getRecords(DATASHEET_ID, queryParam);
250257
assertThat(pager).isNotNull();
@@ -259,5 +266,6 @@ void testPagesWithFormulaFilter() throws ApiException, JsonProcessingException {
259266
System.out.format("record: %s \n", JacksonJsonUtil.toJson(record, true));
260267
}
261268
}
269+
Thread.sleep(1000);
262270
}
263271
}

0 commit comments

Comments
 (0)